Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

GroZZleR

FindWindow / SendMessage

This topic is 5223 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


Link to post
Share on other sites
Advertisement
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 =)

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
Tried commenting out the WM_CHAR and tried changing it to WM_SYSKEYDOWN and WM_SYSKEYUP.

Still no luck =/ This is really iritating.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!