Excuse me: in a 64 - bit Windows, SetForegroundWindow function how to use? Want complement some code or use other function? Master please help,
Other: BringWindowToTop, SetActiveWindow function are tried, such as null and void, also checked a lot of information online, didn't find the effective solutions, Delphi
I attached a more see posts online, but I am clumsy, really don't understand,
The HWND HWND=: : FindWindow (_T (" # 32770 "), _T (" test "));
If (hWnd)
{
HWND hForeWnd=: : GetForegroundWindow ();
DWORD dwForeID=: : GetWindowThreadProcessId (hForeWnd, NULL);
DWORD dwCurID=: : GetCurrentThreadId ();
: : AttachThreadInput (dwCurID dwForeID, TRUE);
: : ShowWindow (hWnd, SW_SHOWNORMAL);
: : SetWindowPos (hWnd HWND_TOPMOST, 0,0,0,0, SWP_NOSIZE | SWP_NOMOVE);
: : SetWindowPos (hWnd HWND_NOTOPMOST, 0,0,0,0, SWP_NOSIZE | SWP_NOMOVE);
: : SetForegroundWindow (hWnd);
: : AttachThreadInput (dwCurID dwForeID, FALSE);
return 0;
}
CodePudding user response:
The use of API, Delphi is also can be the sameCodePudding user response:
Don't know what is the difference between 32-bit and 64 - bit down, I also have no a 64 - bit system testCodePudding user response:
It can help me put on the code above rewritten into Delphi format?The HWND HWND=: : FindWindow (_T (" # 32770 "), _T (" test "));
If (hWnd)
{
HWND hForeWnd=: : GetForegroundWindow ();
DWORD dwForeID=: : GetWindowThreadProcessId (hForeWnd, NULL);
DWORD dwCurID=: : GetCurrentThreadId ();
: : AttachThreadInput (dwCurID dwForeID, TRUE);
: : ShowWindow (hWnd, SW_SHOWNORMAL);
: : SetWindowPos (hWnd HWND_TOPMOST, 0,0,0,0, SWP_NOSIZE | SWP_NOMOVE);
: : SetWindowPos (hWnd HWND_NOTOPMOST, 0,0,0,0, SWP_NOSIZE | SWP_NOMOVE);
: : SetForegroundWindow (hWnd);
: : AttachThreadInput (dwCurID dwForeID, FALSE);
return 0;
}
CodePudding user response:
Var
Hw, hForeWnd: HWND;
DwForeID dwCurID: dwords.
The begin
.
Hw:=FindWindow (' # 32770 ', 'test');
If (hw & gt; 0) then
The begin
DwForeID:=GetWindowThreadProcessId (hForeWnd, nil);
DwCurID:=GetCurrentThreadId;
ShowWindow (hw, SW_SHOWNORMAL);
SetWindowPos (hw, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE or SWP_NOMOVE);
SetWindowPos (hw, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE or SWP_NOMOVE);
The SetForegroundWindow (hw);
AttachThreadInput (dwCurID dwForeID, False);
Result:=0;
The Exit;
end;
.
end;
CodePudding user response:
The above code must be within a particular function, otherwise there is no ResultCodePudding user response:
The SetForegroundWindow (hd0);Now find the set-top and activate this function can put the window, but perform t:=SetCursorPos (500500); , they found some window T value is true, some window T return value to false?
I use the silver star city go go and implement two test interface, silver star go T the return value is true; Implement city go t return values for the falsh, SetCursorPos use is wrong?
CodePudding user response:
Don't know the silver star city, go, go and implement various software on UI, drawing and so on all may have their own way to handle it, use the API to control them is not always effective, depending on the software works, to understand their working principle and targeted treatment,CodePudding user response:
Find this BBS is becoming more and more cold and cheerless, looking forward to the emergence of you, it's already dusk,Is the window of the city in 64 - bit Windows system implement go Style different from ordinary window, thus lead to SetCursorPos function effect?
CodePudding user response:
If you even tried AttachThreadInput function, still not solve, so, I suggest you on a 64 - bit operating system, shilling minimize, restore again, so it must be the current window, in order to replace the SetForegroundWindow, a minimization function, a reduction of window function, use Delphi for a long time, can't remember what is minimized function, but we use openicon function restore Windows,CodePudding user response: