Laendro, fijate si podes adaptar este code:
PD: si encontraste el mensaje directo pasame el code, saludos
Código [Seleccionar]
Option Explicit
Private Declare Function GetForegroundWindow Lib "user32" () As Long
Private Declare Function FindWindow _
Lib "user32" _
Alias "FindWindowA" _
(ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long
Private Declare Function GetWindowRect Lib "user32" _
(ByVal Hwnd As Long, lpRect As RECT) As Long
Private Type RECT
left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Declare Function SetCursorPos Lib "user32" _
(ByVal X As Long, ByVal Y As Long) As Long
Private Declare Sub mouse_event Lib "user32" _
(ByVal dwFlags As Long, ByVal dx As Long, _
ByVal dy As Long, ByVal cButtons As Long, _
ByVal dwExtraInfo As Long)
Private Const MOUSEEVENTF_LEFTDOWN = &H2
Private Const MOUSEEVENTF_LEFTUP = &H4
Private Const MOUSEEVENTF_RIGHTDOWN = &H8
Private Const MOUSEEVENTF_RIGHTUP = &H10
Dim Hndl As String _
Private Sub Form_Load()
Shell "notepad", vbNormalFocus
Timer1.Interval = 50
End Sub
Private Sub Timer1_Timer()
Dim TR As RECT
Dim left_notepad As Integer
Dim left_contexo As Integer
Hndl = FindWindow("notepad", vbNullString)
If Hndl <> 0 Then
If Hndl = GetForegroundWindow() Then
Call GetWindowRect(Hndl, TR)
left_notepad = TR.left
Hndl = FindWindow("#32768", vbNullString)
If Hndl = 65562 Then
Me.Caption = "menu de notepad cerrado"
Else
Call GetWindowRect(Hndl, TR)
left_contexo = TR.left
Me.Caption = "Left " & left_contexo - left_notepad
End If
End If
Else
Me.Caption = "notepad cerrado"
End If
End Sub
PD: si encontraste el mensaje directo pasame el code, saludos