Jump to content

Autoit "send" And User32 "postmessage"


Recommended Posts

Hi Experts,

Let's say I code the following

[here some code to start Internet explorer with a site and place the cursor into an input field]

Send ("abcdefghij")

[here some code to get the handle for Internet explorer]

DllCall("user32.dll", "int", "PostMessage", "hwnd", -->Handle for IE <---, "int", $WM_KEYDOWN, "int", $VK_RETURN, "long",0)

I noticed that PostMessage sends the RETURN KEY, before Send ("abcdefghij") is finished printing.

For instance even though only "abcd" is visible/printed, the RETURN key is sent already (and cuts off the rest of the string).

If I insert a sleep (500) between Send and PostMessage the whole abcdefghij string is printed.

What is the technical explanation for this?

PS I know of course that Send ("abcdefghij{ENTER}") would be better and simpler :-)

Link to comment
Share on other sites

Thanks for your reply.

Just to clarify. The question is not how to automate IE or how to use COM and so on.

I am just wondering, why "PostMessage" sends characters, before "Send" is even finished. I thought that PostMessage and Send would send Characters into the same queue (using FIFO), but apparently not.

Cheers, Dave

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...