I am using the user32 SendMessage dll command to transmit commands to a windows application.
[DllImport("user32.dll")]
private static extern IntPtr SendMessage(IntPtr hWnd, uint msg, IntPtr wParam, IntPtr lParam);
One of those commands cause the application to display a modal box accepting input.
My question is: Why does my application’s code execution halt until the modal box of the other application is being closed?
Is there a way to continue the execution of my application’s code without getting disturbed by the pauses caused when sending a message using the user32.dll?
SendMessage will block until the recipient of the call has completed processing the message.
You could instead use PostMessage which will allow your program to continue executing immediately after dispatching the message.