From: iccsi on
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

From: Tom van Stiphout on
On Fri, 23 Apr 2010 06:02:41 -0700 (PDT), iccsi <inungh(a)gmail.com>
wrote:

The window handle of Access is Application.hWndAccessApp

-Tom.
Microsoft Access MVP


>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