Total Commander Forum Index Total Commander
Forum - Public Discussion and Support
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

API help for Lister plugin

 
Post new topic   Reply to topic    Total Commander Forum Index -> Plugins and addons: devel.+support (English) Printable version
View previous topic :: View next topic  
Author Message
HenrikHusted
Junior Member
Junior Member


Joined: 24 Mar 2003
Posts: 39

PostPosted: Tue Apr 22, 2003 5:48 am    Post subject: API help for Lister plugin Reply with quote

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
Back to top
View user's profile Send private message
hpg
Junior Member
Junior Member


Joined: 16 Mar 2003
Posts: 79

PostPosted: Tue Apr 22, 2003 10:07 am    Post subject: Reply with quote

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 Smile
_________________
hpg666@hotmail.com (hpg :-)
Back to top
View user's profile Send private message Send e-mail
HenrikHusted
Junior Member
Junior Member


Joined: 24 Mar 2003
Posts: 39

PostPosted: Tue Apr 22, 2003 12:21 pm    Post subject: Reply with quote

Actually my problem is the exact opposite Very Happy
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 Confused Back to the debugger.

.Henrik
Back to top
View user's profile Send private message
HenrikHusted
Junior Member
Junior Member


Joined: 24 Mar 2003
Posts: 39

PostPosted: Tue Apr 22, 2003 12:42 pm    Post subject: Reply with quote

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

Ohh... can I unsubclass my window Question

[edit]
I can use
Code:
 ::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
Back to top
View user's profile Send private message
ghisler(Author)
Site Admin
Site Admin


Joined: 04 Feb 2003
Posts: 24602
Location: Switzerland

PostPosted: Thu Apr 24, 2003 10:24 am    Post subject: Reply with quote

Quote:
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
http://www.ghisler.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
HenrikHusted
Junior Member
Junior Member


Joined: 24 Mar 2003
Posts: 39

PostPosted: Mon Apr 28, 2003 2:05 pm    Post subject: Reply with quote

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

.H
Back to top
View user's profile Send private message
ghisler(Author)
Site Admin
Site Admin


Joined: 04 Feb 2003
Posts: 24602
Location: Switzerland

PostPosted: Mon Apr 28, 2003 2:46 pm    Post subject: Reply with quote

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
http://www.ghisler.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
HenrikHusted
Junior Member
Junior Member


Joined: 24 Mar 2003
Posts: 39

PostPosted: Tue Apr 29, 2003 7:25 am    Post subject: Reply with quote

Quote:
Btw, why do you call it with hWndParent? Lister doesn't subclass itself, it subclasses YOUR window!

I knew it was something basic.. Embarassed
Now it works, thanks for the help.

.Henrik
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Total Commander Forum Index -> Plugins and addons: devel.+support (English) All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Impressum: This site is maintained by Ghisler Software GmbH

Using phpBB © 2001-2005 phpBB Group