Skip to main content
GameDev.net gamedev.net
🔒 Locked

FindWindow / SendMessage

Started by GroZZleR Feb 29, 2004 at 8:52 PM 3 replies 1k views
Original Post
GroZZleR
GroZZleR
Hey all, I''ve got a handle to a window and I''m trying to send messages to it. It works, for the most part. I''m trying to send messages to a Magic Online window, so I don''t have to keep tabbing out to update my post. You type in your posting (usually what you''re selling or buying) into a text box. Then when you press enter, it sends your message. If you press the up arrow key, it''ll use your last sent message instead. It accepts keyboard input like ''A'', and ''B'' but when I send VK_RETURN or VK_UP it doesn''t do anything. Infact, when I send VK_UP instead of getting my last message, an ampersand (&) is shown in the textbox. Any ideas?
			SendMessage(hMagicWindow, WM_CHAR, ''A'', 7);
			Sleep(250);
			SendMessage(hMagicWindow, WM_CHAR, ''B'', 7);
			Sleep(250);
			SendMessage(hMagicWindow, WM_CHAR, VK_RETURN, 7);
			Sleep(250);

The handle is valid, as I see A and B in the textbox, but it fails to send the message when it comes time for VK_RETURN. Any ideas?
GroZZleR
GroZZleR
Alright, half-assedly got it working.

I''ve changed from WM_CHAR to WM_KEYDOWN and WM_KEYUP for the VK_UP arrow key. However, its still not accepting the VK_RETURN. Its almost like it doesn''t accept the message, even with a pretty mammoth sleep delay in there.

Any ideas? I know its pretty vague, but I''m reaching here =)
GroZZleR
GroZZleR
Heres some more information:

I''ve checked it out using Spy++, and now I''m really confused.

When I hit enter, into the textbox (with text already in there), I get these 3 messages:

WM_KEYDOWN nVirtKey VK_RETURN cRepeat 1 ....
WM_CHAR chCharCode (13) cRepeat 1 ....
WM_KEYUP nVirtKey VK_RETURN cRepeat 1 ....

I''ve altered my program thusly:

PostMessage(hMagicWindow, WM_KEYDOWN, VK_UP, 6);
Sleep(10);
PostMessage(hMagicWindow, WM_KEYUP, VK_UP, 6);
Sleep(1000);
PostMessage(hMagicWindow, WM_KEYDOWN, VK_RETURN, 6);
Sleep(10);
PostMessage(hMagicWindow, WM_CHAR, char(13), 6);
Sleep(10);
PostMessage(hMagicWindow, WM_KEYUP, VK_RETURN, 6);


Still not return key is sent =/ Anyone have any clues?
fractoid
fractoid
Send a WM_SYSKEY message? Virtual key codes like VK_RETURN and VK_ESCAPE aren''t mapped to WM_CHAR messages, so maybe sending WM_CHAR messages containing them confuses things?
GroZZleR
GroZZleR
Tried commenting out the WM_CHAR and tried changing it to WM_SYSKEYDOWN and WM_SYSKEYUP.

Still no luck =/ This is really iritating.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.