caje,
Se estiver usando o acrobat reader isso deve funcionar:
Option Explicit
Private Const WM_CLOSE = &H10
Private Const INFINITE = &HFFFFFFFF
Private Declare Function apiPostMessage _
Lib "user32" Alias "PostMessageA" _
(ByVal Hwnd As Long, _
ByVal wMsg As Long, _
ByVal wParam As Long, _
lParam As Any) _
As Long
Private Declare Function apiFindWindow _
Lib "user32" Alias "FindWindowA" _
(ByVal lpClassname As String, _
ByVal lpWindowName As String) _
As Long
Private Declare Function apiWaitForSingleObject _
Lib "kernel32" Alias "WaitForSingleObject" _
(ByVal hHandle As Long, _
ByVal dwMilliseconds As Long) _
As Long
Private Declare Function apiIsWindow _
Lib "user32" Alias "IsWindow" _
(ByVal Hwnd As Long) _
As Long
Private Declare Function apiGetWindowThreadProcessId _
Lib "user32" Alias "GetWindowThreadProcessId" _
(ByVal Hwnd As Long, _
lpdwProcessID As Long) _
As Long
Function fCloseApp(lpClassname As String) As Boolean
Dim lngRet As Long, Hwnd As Long, pID As Long
Hwnd = apiFindWindow(lpClassname, vbNullString)
If (Hwnd) Then
lngRet = apiPostMessage(Hwnd, WM_CLOSE, 0, ByVal 0&)
Call apiGetWindowThreadProcessId(Hwnd, pID)
Call apiWaitForSingleObject(pID, INFINITE)
fCloseApp = Not (apiIsWindow(Hwnd) = 0)
End If
End Function
Sub Exemplo()
fCloseApp ("AcrobatSDIWindow")
End Sub
Click em se a resposta foi util!
Postado : 11/04/2014 8:12 pm