C# Code hangs after Pinvoke SendMessage -


i automating test procedures separate windows form application. using pinvoke communicate other application. in application, there button creates new pop window when clicked.

i communicating buttons , fields successfully. however, when clicking button code following sendmessage() not run. button clicked , window appears, following code not ran until manually close window.

here code:

    [dllimport("user32.dll")]     public static extern int sendmessage(intptr hwnd, int wmsg, intptr wparam, intptr lparam); 

.

    buttonhandle = findwindowex(parenthandle, new intptr(0), new intptr(0), windowtitle);     sendmessage(childhandle, bm_click, new intptr(0), "");     messagebox.show("this won't show until close window"); 

everything works fine, except whatever line of code comes after sendmessage() isn't ran until close new window created when button clicked.

can explain may going on here?

thanks!

sendmessage block until recipient of call has completed processing message.

you instead invoke postmessage allow program continue executing after dispatching message.


Comments

Popular posts from this blog

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -