postmessage to kill mdn application



I use following code to get Windows Handle and PostMessage API to kill
my application.

The KillProcess kill the the main form of the application, but not MS
Access application.

What should I change to kill MS Access application?

Your help is great appreciated,

Private Declare Function apiGetWindow Lib "user32" _
Alias "GetWindow" _
(ByVal hwnd As Long, _
ByVal wCmd As Long) _
As Long

Private Declare Function PostMessage Lib "user32" Alias "PostMessageA"
(ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam
As Any) As Long

Private Const WM_CLOSE = &H10

Public Function KillProcess(hwnd As Long) As Long
KillProcess = PostMessage(hwnd, WM_CLOSE, 0, 0)
End Function

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question