Exetools  

Go Back   Exetools > General > General Discussion

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 07-04-2006, 22:25
aldente aldente is offline
VIP
 
Join Date: Jul 2003
Posts: 266
Rept. Given: 27
Rept. Rcvd 7 Times in 5 Posts
Thanks Given: 35
Thanks Rcvd at 10 Times in 9 Posts
aldente Reputation: 7
WinAPI: No WM_COMMAND Message?

Hello!

I'm trying to remote control an application using SendMessage. When you send ALT+P to that application, it does what it should do, but I want to control it directly by sending a message. So I do NOT want to send KEYDOWN and KEYUP messages, but the message that invokes the proper function (normally WM_COMMAND). Instead, there are hundreds of strange other messages within less than one second.

The problem with this app is: There are no WM_COMMAND messages, like in 'normal' applications, so I'm a bit confused Maybe some API-expert can help me?

This is what happens after lifting the last key (press ALT, press P, lift P, lift ALT):

Code:
<00040> 0024094C P WM_KEYUP nVirtKey:VK_MENU cRepeat:1 ScanCode:00 fExtended:0 fAltDown:0 fRepeat:1 fUp:1
<00041> 0024094C S message:0xBD01 [Benutzerdefiniert:WM_USER+47361] wParam:00000012 lParam:C0000001
<00042> 0024094C R message:0xBD01 [Benutzerdefiniert:WM_USER+47361] lResult:00000000
<00043> 003E07A6 S WM_NCHITTEST xPos:802 yPos:481
<00044> 003E07A6 R WM_NCHITTEST nHittest:HTCLIENT
<00045> 003E07A6 S WM_NCHITTEST xPos:802 yPos:481
<00046> 003E07A6 R WM_NCHITTEST nHittest:HTCLIENT
<00047> 003E07A6 S WM_SETCURSOR hwnd:003E07A6 nHittest:HTCLIENT wMouseMsg:WM_MOUSEMOVE
<00048> 003E07A6 S WM_NCHITTEST xPos:802 yPos:481
<00049> 003E07A6 R WM_NCHITTEST nHittest:HTCLIENT
<00050> 003E07A6 S WM_NCHITTEST xPos:802 yPos:481
<00051> 003E07A6 R WM_NCHITTEST nHittest:HTCLIENT
<00052> 004F07F2 S WM_SETCURSOR hwnd:003E07A6 nHittest:HTCLIENT wMouseMsg:WM_MOUSEMOVE
<00053> 004406DC S WM_SETCURSOR hwnd:003E07A6 nHittest:HTCLIENT wMouseMsg:WM_MOUSEMOVE
<00054> 006306FE S WM_SETCURSOR hwnd:003E07A6 nHittest:HTCLIENT wMouseMsg:WM_MOUSEMOVE
<00055> 004E07C6 S WM_SETCURSOR hwnd:003E07A6 nHittest:HTCLIENT wMouseMsg:WM_MOUSEMOVE
<00056> 004E07C6 R WM_SETCURSOR fHaltProcessing:False
<00057> 006306FE R WM_SETCURSOR fHaltProcessing:False
<00058> 004406DC R WM_SETCURSOR fHaltProcessing:False
<00059> 004F07F2 R WM_SETCURSOR fHaltProcessing:False
<00060> 003E07A6 R WM_SETCURSOR fHaltProcessing:False
<00061> 003E07A6 P WM_MOUSEMOVE fwKeys:0000 xPos:398 yPos:9
<00062> 003E07A6 S WM_NCHITTEST xPos:802 yPos:481
<00063> 003E07A6 R WM_NCHITTEST nHittest:HTCLIENT
<00064> 003E07A6 S WM_NCHITTEST xPos:802 yPos:481
<00065> 003E07A6 R WM_NCHITTEST nHittest:HTCLIENT
<00066> 003E07A6 S WM_NCHITTEST xPos:802 yPos:481
<00067> 003E07A6 R WM_NCHITTEST nHittest:HTCLIENT
<00068> 003E07A6 S WM_NCHITTEST xPos:802 yPos:481
<00069> 003E07A6 R WM_NCHITTEST nHittest:HTCLIENT
<00070> 003E07A6 S WM_NCHITTEST xPos:802 yPos:481
<00071> 003E07A6 R WM_NCHITTEST nHittest:HTCLIENT
<00072> 003E07A6 S WM_SETCURSOR hwnd:003E07A6 nHittest:HTCLIENT wMouseMsg:WM_MOUSEMOVE
<00073> 003E07A6 S WM_NCHITTEST xPos:802 yPos:481
<00074> 003E07A6 R WM_NCHITTEST nHittest:HTCLIENT
<00075> 003E07A6 S WM_NCHITTEST xPos:802 yPos:481
<00076> 003E07A6 R WM_NCHITTEST nHittest:HTCLIENT
<00077> 004F07F2 S WM_SETCURSOR hwnd:003E07A6 nHittest:HTCLIENT wMouseMsg:WM_MOUSEMOVE
<00078> 004406DC S WM_SETCURSOR hwnd:003E07A6 nHittest:HTCLIENT wMouseMsg:WM_MOUSEMOVE
<00079> 006306FE S WM_SETCURSOR hwnd:003E07A6 nHittest:HTCLIENT wMouseMsg:WM_MOUSEMOVE
<00080> 004E07C6 S WM_SETCURSOR hwnd:003E07A6 nHittest:HTCLIENT wMouseMsg:WM_MOUSEMOVE
<00081> 004E07C6 R WM_SETCURSOR fHaltProcessing:False
<00082> 006306FE R WM_SETCURSOR fHaltProcessing:False
<00083> 004406DC R WM_SETCURSOR fHaltProcessing:False
<00084> 004F07F2 R WM_SETCURSOR fHaltProcessing:False
<00085> 003E07A6 R WM_SETCURSOR fHaltProcessing:False
<00086> 003E07A6 P WM_MOUSEMOVE fwKeys:0000 xPos:398 yPos:9
I logged it three different times, maybe that can help you:

http://home.scarlet.be/~lb178476/test1.txt
http://home.scarlet.be/~lb178476/test2.txt
http://home.scarlet.be/~lb178476/test3.txt

Thanks in advance!


/Edit: Additional information:

The application is written in Delphi and uses the SpTBXLib (http://club.telepolis.com/silverpointdev/index.htm).

Last edited by aldente; 07-04-2006 at 23:38.
Reply With Quote
  #2  
Old 07-05-2006, 06:14
Mkz Mkz is offline
Friend
 
Join Date: Jan 2002
Posts: 98
Rept. Given: 0
Rept. Rcvd 2 Times in 2 Posts
Thanks Given: 5
Thanks Rcvd at 25 Times in 17 Posts
Mkz Reputation: 2
I think the key might be here:

Code:
<00174> 0024094C P WM_SYSKEYDOWN nVirtKey:VK_MENU cRepeat:1 ScanCode:00 fExtended:0 fAltDown:1 fRepeat:0 fUp:0
<00175> 0024094C S message:0xBD04 [Benutzerdefiniert:WM_USER+47364] wParam:00000012 lParam:20000001
<00176> 004206AA S message:0xB016 [Benutzerdefiniert:WM_USER+44054] wParam:00000012 lParam:20000001
<00177> 004206AA R message:0xB016 [Benutzerdefiniert:WM_USER+44054] lResult:00000000
<00178> 0024094C R message:0xBD04 [Benutzerdefiniert:WM_USER+47364] lResult:00000000
<00179> 0024094C P WM_SYSKEYDOWN nVirtKey:'P' cRepeat:1 ScanCode:00 fExtended:0 fAltDown:1 fRepeat:0 fUp:0
<00180> 0024094C S message:0xBD04 [Benutzerdefiniert:WM_USER+47364] wParam:00000050 lParam:20000001
<00181> 004206AA S message:0xB016 [Benutzerdefiniert:WM_USER+44054] wParam:00000050 lParam:20000001
<00182> 004206AA S message:0xB03F [Benutzerdefiniert:WM_USER+44095] wParam:00000000 lParam:01CB8420
....
<00200> 004206AA R message:0xB016 [Benutzerdefiniert:WM_USER+44054] lResult:00000001
<00201> 0024094C R message:0xBD04 [Benutzerdefiniert:WM_USER+47364] lResult:00000001
First when you press ALT, the user message USER+47364 message is sent, with wparam=12 and lparam=20000001, which in turn generates another message USER+44054.
Afterwards, you press P. This is the moment that things get done, when the key goes down and not up. Of course this always ends up being a decision of the developer, but for menus for instance, they appear when the key goes down and not up. Anyway, when P goes down there is this message once again, USER+43764, this time with wparam=50.
Have you tried sending this message? If you have, have you also tried sending it first with wparam=12 (ALT down), then with wparam=50 (P down)?

I believe the developer might have implemented triggering the action on the equivalent of the OnKeyDown event:
if Key = 'P' then ....

Which leads me to another suggestion. How about sending the WM_SYSKEYDOWN messages yourself? The WM_USER messages might be just for other stuff, maybe the action you want is executed directly in the key down event, without resorting to any further message exchanges.
Reply With Quote
  #3  
Old 07-05-2006, 07:17
aldente aldente is offline
VIP
 
Join Date: Jul 2003
Posts: 266
Rept. Given: 27
Rept. Rcvd 7 Times in 5 Posts
Thanks Given: 35
Thanks Rcvd at 10 Times in 9 Posts
aldente Reputation: 7
Hmm, obviously the WParam is just the value of the virtual key scancode, as you can see here:

Code:
{ Virtual Keys, Standard Set }
VK_CONTROL = 17; //=$11
{$EXTERNALSYM VK_MENU}
VK_MENU = 18; //=$12
(also fits for the other keys, I checked it)


Sending that myself works:

Code:
SendMessage($C0A52, WM_USER+47364, VK_MENU, $20000001);
SendMessage($C0A52, WM_USER+47364, Ord('P'), $20000001);
Thanks! Now all I have to do is to find a nice way to get that window handle...
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[MASM Source] - ZwCreateThread example (winAPI CreateThread emulation) TomaHawk Source Code 4 09-08-2019 14:06
[C] Winapi Call Dynamically and easily 0xall0c Source Code 40 10-17-2018 19:36
[C++, WinAPI] Enigma HWID patcher with hardware breakpoints mr.exodia Source Code 1 07-31-2014 11:50
RCE Message Board hobferret General Discussion 2 06-22-2003 00:40


All times are GMT +8. The time now is 18:11.


Always Your Best Friend: Aaron, JMI, ahmadmansoor, ZeNiX, chessgod101
( 1998 - 2024 )