mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 11:48:06 +01:00
PowerRename: bring the rename dialog to foreground
This commit is contained in:
committed by
Andrey Nekrasov
parent
1e6936a8c3
commit
9607888fc5
@@ -6,6 +6,7 @@
|
||||
#include <helpers.h>
|
||||
#include <settings.h>
|
||||
#include <windowsx.h>
|
||||
#include <thread>
|
||||
#include <trace.h>
|
||||
|
||||
extern HINSTANCE g_hInst;
|
||||
@@ -512,6 +513,12 @@ HRESULT CPowerRenameUI::_DoModal(__in_opt HWND hwnd)
|
||||
}
|
||||
return hr;
|
||||
}
|
||||
void CPowerRenameUI::BecomeForegroundWindow()
|
||||
{
|
||||
static INPUT i = {INPUT_MOUSE, {}};
|
||||
SendInput(1, &i, sizeof(i));
|
||||
SetForegroundWindow(m_hwnd);
|
||||
}
|
||||
|
||||
HRESULT CPowerRenameUI::_DoModeless(__in_opt HWND hwnd)
|
||||
{
|
||||
@@ -520,6 +527,7 @@ HRESULT CPowerRenameUI::_DoModeless(__in_opt HWND hwnd)
|
||||
if (NULL != CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_MAIN), hwnd, s_DlgProc, (LPARAM)this))
|
||||
{
|
||||
ShowWindow(m_hwnd, SW_SHOWNORMAL);
|
||||
BecomeForegroundWindow();
|
||||
MSG msg;
|
||||
while (GetMessage(&msg, NULL, 0, 0))
|
||||
{
|
||||
|
||||
@@ -86,6 +86,7 @@ private:
|
||||
|
||||
HRESULT _DoModal(__in_opt HWND hwnd);
|
||||
HRESULT _DoModeless(__in_opt HWND hwnd);
|
||||
void BecomeForegroundWindow();
|
||||
|
||||
static INT_PTR CALLBACK s_DlgProc(HWND hdlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user