How to control TC from other app?

English support forum

Moderators: Hacker, petermad, Stefan2, white

Post Reply
mia
Junior Member
Junior Member
Posts: 25
Joined: 2004-03-17, 09:53 UTC

How to control TC from other app?

Post by *mia »

Hi there. I wrote small application that provides remote control for other applications. Tried to control TC but -

TC react "strange" if i send "UP" or "DOWN" key. "RETURN" is functional, "F-" keys too. Numeric or alphabetic keys are without reaction.

My code:

tcHWND = FindWindow("TTOTAL_CMD", vbNullString")
res = SetForegroundWindow(tcHWND)
.
.
.
'for UP key
res = PostMessage(tcHWND, WM_KEYDOWN, VK_UP, 0&) 'not work

'for DOWN key
res = PostMessage(tcHWND, WM_KEYDOWN, VK_DOWN, 0&) 'not work

'for RETURN key
res = PostMessage(tcHWND, WM_KEYDOWN, VK_RETURN, 0&) 'thats work

'for SPACE key
res = PostMessage(tcHWND, WM_KEYDOWN, &H20&, 0&) 'not work

What's wrong? Thanks for answers :-)
User avatar
SanskritFritz
Power Member
Power Member
Posts: 3693
Joined: 2003-07-24, 09:25 UTC
Location: Budapest, Hungary

Post by *SanskritFritz »

I tried the same with Macro Express, it works flawlessly for me. I make some more investigations.
I switched to Linux, bye and thanks for all the fish!
User avatar
SanskritFritz
Power Member
Power Member
Posts: 3693
Joined: 2003-07-24, 09:25 UTC
Location: Budapest, Hungary

Post by *SanskritFritz »

You have to send the up and down keys to the TMyListBox control, the main window does not propagate the message to its children. Return and F keys are captured on the main form.
I switched to Linux, bye and thanks for all the fish!
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50505
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Try using keybd_event instead of SendMessage.
Author of Total Commander
https://www.ghisler.com
Post Reply