ror thank u for u help. the only problem is not that that my timer2 is not doing it job !! It does not click exist confirmation &Yes button !!!i be happy if u tell me what i am doing wrong.Thanks
VB Code:
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _ (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Private Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" ( _ ByVal hwnd As Long, _ ByVal wMsg As Long, _ ByVal wParam As Long, _ ByVal lParam As Long) As Long Private Declare Function SendMessageByString Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As String) As Long Private Declare Function SendMessageLong& Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long Const WM_COMMAND = &H111 Private iTime As Integer Private Const WM_CLOSE As Long = &H10 Private Const WM_KEYDOWN = &H100 Private Const WM_KEYUP = &H101 Private Const VK_SPACE = &H20 Private Sub Command2_Click() Dim window As Long window = FindWindow("SEINFELD_SUPERMAN", vbNullString) PostMessage window, WM_COMMAND, 32831, 0 End Sub Private Sub Timer1_Timer() [B]Dim x As Long, editx As Long ====> this block does not get executed at all! Dim button As Long x = FindWindow("#32770", "Exit?") button = FindWindowEx(x, 0&, "Button", "&Yes") Call SendMessageLong(button, WM_KEYDOWN, VK_SPACE, 0&) Call SendMessageLong(button, WM_KEYUP, VK_SPACE, 0&)[/B] End Sub Private Sub Command1_Click() Timer2.Interval = 1000 Timer2.Enabled = True [B] Timer1.Enabled = True[/B] End Sub Private Sub Timer2_Timer() iTime = iTime + 1 Debug.Print iTime If iTime >= 20 Then Debug.Print "END!" [B] Command2_Click[/B] Timer2.Interval = 0 Timer2.Enabled = False End If End Sub




Reply With Quote