code:
Interop.Call("User32", "SendMessageW", hWnd, 0x10, 0, 0);
actually SendMessageW will force the close command to be executed immidiately, for the mainwindow that might work, but using PostMessageW just puts the close command at the end of the line...
Use instead:
code:
Interop.Call("User32", "PostMessageW", hWnd, 0x10, 0, 0);
if you want to play it safe.