API help for Lister plugin

Discuss and announce Total Commander plugins, addons and other useful tools here, both their usage and their development.

Moderators: white, Hacker, petermad, Stefan2

Post Reply
HenrikHusted
Junior Member
Junior Member
Posts: 39
Joined: 2003-03-24, 10:47 UTC

API help for Lister plugin

Post by *HenrikHusted »

Hi all,
Some keys in a lister plugin has special meaning.
In a normal lister window the user can switch viewing mode by means of the 1,2,3,4 etc keys. Also the N and P keys are used to switch to the next and previous files.
I want my lister plugin to handle all keys but at the moment I'm not getting any WM_KEYDOWN messages on those special tcmd keys. Is there any way to tell tcmd to pass on all windows messages?

.Henrik
hpg
Junior Member
Junior Member
Posts: 79
Joined: 2003-03-16, 12:20 UTC

Post by *hpg »

For '0'...'9' just use the WM_CHAR command with the correct VK code

For 'n' and 'P' use:

SetFocus( ParentWin );

keybd_event('N', 0,0,0);
keybd_event('N', 0,KEYEVENTF_KEYUP,0);

---
I encountered the same problems with my hpg_ed plugin :-)
HenrikHusted
Junior Member
Junior Member
Posts: 39
Joined: 2003-03-24, 10:47 UTC

Post by *HenrikHusted »

Actually my problem is the exact opposite :D
I never get the WM_CHAR messages for '0'...'9', tcmd handles them before I get a change to do anything.
It's a bit odd, I create a normal child window using ::CreateWindowEx(...) and I get every WM_CHAR messages except for the ones tcmd handles.
hmprf, I must have overlooked something :? Back to the debugger.

.Henrik
HenrikHusted
Junior Member
Junior Member
Posts: 39
Joined: 2003-03-24, 10:47 UTC

Post by *HenrikHusted »

From the help files:
"Lister will subclass your window to catch some hotkeys like 'n' or 'p'."

Ohh... can I unsubclass my window :?:

[edit]
I can use

Code: Select all

 ::SetWindowLongPtr( hParentHwnd, GWLP_WNDPROC, (LONG_PTR)MySubClassFunc );
to make all WM_* go to MySubClassFunc, then it's my job to use CallWindowProc(...) to send messages to the Lister so it can update itself.

Is this a good way of doing it? Doesn't seem that clean a solution. Plus I need a list of WM_* that the Lister uses.

.Henrik
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48093
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Ohh... can I unsubclass my window
No you can't. But you can subclass your window again later. TC will subclass your window when the function ListLoad returns. You could set a timer, and check in the WM_TIMER handler via GetWindowLong whether the window has been subclassed. When this happens, just re-subclass it, but save the window function set by TC. This way the messages will first go to your subclass function, then you pass it on with CallWindowProc() to my own subclass function.

> Plus I need a list of WM_* that the Lister uses.

Hmm, why? Just pass the commands on which you don't handle yourself.
Author of Total Commander
https://www.ghisler.com
HenrikHusted
Junior Member
Junior Member
Posts: 39
Joined: 2003-03-24, 10:47 UTC

Post by *HenrikHusted »

I call

Code: Select all

::GetWindowLong( hWndParent, GWLP_WNDPROC );
in ListLoad() and store the address. But the WNDPROC address doesn't seem to change.

.H
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48093
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

It's changed AFTER ListLoad, because TC can subclass the window only when it has its handle! Btw, why do you call it with hWndParent? Lister doesn't subclass itself, it subclasses YOUR window!
Author of Total Commander
https://www.ghisler.com
HenrikHusted
Junior Member
Junior Member
Posts: 39
Joined: 2003-03-24, 10:47 UTC

Post by *HenrikHusted »

Btw, why do you call it with hWndParent? Lister doesn't subclass itself, it subclasses YOUR window!
I knew it was something basic.. :oops:
Now it works, thanks for the help.

.Henrik
Post Reply