PostMessage(FindWindowW(L"TTOTAL_CMD", 0), 1075, 307, 0);
SetForegroundWindow(hListerHandle);
SetFocus(hListerHandle);
This design hangs TC when exiting Quick View.
Without focus transfer when only one command is used PostMessage(FindWindowW(L"TTOTAL_CMD", 0), 1075, 307, 0); everything works perfectly. But the focus remains in the view pane.
Is it possible to somehow use the command PostMessage(FindWindowW(L"TTOTAL_CMD", 0), 1075, 307, 0); and move focus to the panel where the plugin was called from, so that TC does not freeze.
The problem itself arose due to the fact that I have to handle exiting an external program using Esc in the TC Quick View. There is no way to disable Esc in an external program.
PostMessage(FindWindowW(L"TTOTAL_CMD", 0), 1075, 307, 0) causes a glitch
Moderators: Hacker, petermad, Stefan2, white
- ghisler(Author)
- Site Admin
- Posts: 50386
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
Re: PostMessage(FindWindowW(L"TTOTAL_CMD", 0), 1075, 307, 0) causes a glitch
307 is cm_SrcHideQuickView. Do you call this from within a lister plugin? This would close quick view and the plugin, but only when Total Commander gets active again (the message loop handles the posted message). Your SetForegroundWindow and SetFocus calls are therefore handled before cm_SrcHideQuickView.
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
Re: PostMessage(FindWindowW(L"TTOTAL_CMD", 0), 1075, 307, 0) causes a glitch
Thank you for the clarification.
Re: PostMessage(FindWindowW(L"TTOTAL_CMD", 0), 1075, 307, 0) causes a glitch
And this is how it happened:ghisler(Author) wrote: 2024-03-25, 08:32 UTC Your SetForegroundWindow and SetFocus calls are therefore handled before cm_SrcHideQuickView.
SetForegroundWindow(hListerHandle);
SetFocus(hListerHandle);
PostMessageW(FindWindowW(L"TTOTAL_CMD", 0), 1075, 307, 0);
SendMessageW(hAppHandle, WM_SYSCOMMAND, SC_CLOSE, 0);
- ghisler(Author)
- Site Admin
- Posts: 50386
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
Re: PostMessage(FindWindowW(L"TTOTAL_CMD", 0), 1075, 307, 0) causes a glitch
Your SendMessageW is also handled before the PostMessageW call, because it directly calls the message handler and waits for the response, while PostMessageW puts the message at the end of the message queue. It is only handled when Total Commander handles messages in the message loop (GetMessage or PeekMessage).
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
Re: PostMessage(FindWindowW(L"TTOTAL_CMD", 0), 1075, 307, 0) causes a glitch
Yes, sure. To make the code more correct, I fixed it:ghisler(Author) wrote: 2024-03-29, 13:49 UTC Your SendMessageW is also handled before the PostMessageW call
SetForegroundWindow(hListerHandle);
SetFocus(hListerHandle);
SendMessageW(hAppHandle, WM_SYSCOMMAND, SC_CLOSE, 0);
PostMessageW(FindWindowW(L"TTOTAL_CMD", 0), 1075, 307, 0);