PostMessage(hWnd, WM_QUIT, 0, 0)
Hi,
I have a VB.NET project. At one line of code I am getting a messagebox automatically giving some error information. I tried whatever I could to get to the root cause of the problem but I couldn't. The messagebox is not hampering any functionality and my application works fine after I close the message box. So I decided to suppress this message box. And I did this successfully usingBackgroundworkerthread and Windows API calls likeFindWindow andPostMessage.
The only problem I am facing now is after the message box is closed my application gets hanged. It is not the problem of thread because I tried closing message box with external application also. But still same thing happens. Do I need to do something else so my original application from which message box pops up can receive the control once the message box is closed?
Below given is the code causing the problem:
Private
DeclareFunction FindWindowLib"user32"Alias"FindWindowA" (ByVal lpClassNameAsString,ByVal lpWindowNameAsString)As IntPtrPrivateDeclareFunction PostMessageLib"user32"Alias"PostMessageA" (ByVal hwndAs IntPtr,ByVal wMsgAsUInteger,ByVal wParamAs IntPtr,ByVal lParamAs IntPtr)AsBooleanPrivateConst WM_QUIT = &H12Dim
sTitleAsStringDim iHwndAsLongDim ihTaskAsLongDim iReturnAsLongsTitle =
"MessageBox"iHwnd = FindWindow(
Nothing, sTitle)iReturn = PostMessage(iHwnd, WM_QUIT, IntPtr.Zero, IntPtr.Zero)

