Hi,
In my lister-plugin I need to handle all keys before the hot-keys are evaluated by the subclassed window. Currently I'm registering a WS_CHILD type of window.
After crawling trough the forum I figured, that I need to save my windowProc-address I set and when my window is subclassed and thus the window's windowProc changes I need to somehow set the original windowProc again (to handle the keys myself) and then redirect to the TC-set windowProc.
My code looks like this:
WNDPROC tc_internal_func = nullptr;
LONG WINAPI
WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
//...handle keyown ..//
if ((WNDPROC)address != (WNDPROC)WindowProc)
{
tc_internal_func = (WNDPROC)address;
SetWindowLongPtr(hWnd, GWLP_WNDPROC,(LONG_PTR)WindowProc);
}
if (tc_internal_func)
{
return CallWindowProc(tc_internal_func, hWnd, uMsg, wParam, lParam);
}
else
{
return DefWindowProc(hWnd, uMsg, wParam, lParam);
}
}
Unfortunately this doesn't work, as I suspect it to simply create an infinite loop. Can anyone help me with how to re-direct the messages in a way I can handle all keys inside my lister plugin?
Cheers
Sebastian
ListerPlugin: how subclassing and message loop?
Moderators: Hacker, petermad, Stefan2, white
-
- Junior Member
- Posts: 3
- Joined: 2017-07-20, 06:45 UTC
- ghisler(Author)
- Site Admin
- Posts: 50406
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
Yes, you create an infinite loop because TC's subclass function calls the original function again.
Instead, just create a second subclass function and set that via SetWindowLongPtr, then call TC's function from it. TC's function will then call the original:
Windows -> Your new subclass function -> TC's function -> original function
Instead, just create a second subclass function and set that via SetWindowLongPtr, then call TC's function from it. TC's function will then call the original:
Windows -> Your new subclass function -> TC's function -> original function
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
-
- Junior Member
- Posts: 3
- Joined: 2017-07-20, 06:45 UTC
-
- Junior Member
- Posts: 3
- Joined: 2017-07-20, 06:45 UTC
- ghisler(Author)
- Site Admin
- Posts: 50406
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
Hmm, they could be filtered by the Delphi menu function because they are part of the menu.
This isn't present in Total Commander Ctrl+Q quick view panel. Do you get all the keys there?
This isn't present in Total Commander Ctrl+Q quick view panel. Do you get all the keys there?
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com