La segunda idea no me vale porq no tiene ventana q buscar (pero gracias)
La primera he estado buscando y he encontrado esto:
Private Const STILL_ACTIVE = &H103
Private Const PROCESS_QUERY_INFORMATION = &H400
Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessID As Long) As Long
Private Declare Function GetExitCodeProcess Lib "kernel32" (ByVal hProcess As Long, lpExitCode As Long) As Long
Private Declare Sub ExitProcess Lib "kernel32" (ByVal uExitCode As Long)
Dim lngPid As Long, lngRc As Long
Public Sub SincMiProceso(ByVal ExeFile As String)
On Error GoTo Err_Sinc
lngPid = OpenProcess(PROCESS_QUERY_INFORMATION, False, Shell(ExeFile, vbNormalFocus))
Do
GetExitCodeProcess lngPid, lngRc
'' ExitProcess lngPid
DoEvents
Loop While lngRc = STILL_ACTIVE
Exit Sub
Err_Sinc:
MsgBox "Fallo sincronizando pgm '" & ExeFile & "'." & String(2, vbCrLf) _
& "(" & Err.Number & ") " & Err.Description, vbCritical, "Sincronizar"
End Sub
Private Sub Command1_Click()
SincMiProceso ("C:\windows\notepad.exe")
End Sub
Private Sub Command2_Click()
ExitProcess lngRc
End Sub
se supone q con ExitProcess lngRc cerraria dicha aplicacion pero lo q se cierra es el visual
ayudaaaaaaaaaaa
se os ocurre algo?