Results 1 to 6 of 6

Thread: IE warning popup... how do I press yes? (automate this process)

  1. #1
    aryx
    Guest
    I've tried to disable all warning msges in IE. But i still get a warning message. This is a yes/no question, how can i make my program choose yes on that question. I can't seem to find any code on that subject.

    aryx

  2. #2
    Matthew Gates
    Guest
    You could find the hWnd of the button and send a message to click it, or you can use the SendKeys statement (use for both - in a timer).

  3. #3
    aryx
    Guest
    k, thnx, i'll go and look 4 some good... u don't know of a good source code on those calls btw?

    aryx

  4. #4
    Matthew Gates
    Guest
    Use the FindWindowEx and PostMessage API functions to do it.

    Here's an example of clicking the X Button (to close the application on the Calculator.


    Code:
    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
    
    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
    
    Const WM_CLOSE = &H10
    Const WM_DESTROY = &H2
    
    
    Private Sub Command1_Click()
    
        Dim hWin As Long
        hWin = FindWindowEx(0, 0, "SciCalc", "Calculator") ' retrieves window's handle
        If hWin <> 0 Then  ' If found then...
            PostMessage hWin, WM_CLOSE, 0, 0
            PostMessage hWin, WM_DESTROY, 0, 0
        Else
            MsgBox "Window Not found"
        End If
        
    End Sub

  5. #5
    egiggey
    Guest
    Hi I had the same problem and found the soution at Miicrosoft so try this
    the first thing you need to do is add a referance to Microsoft HTML Object Library (MSHTML.tlb)

    On your form you need to add this code
    Dim WithEvents objDoc As MSHTML.HTMLDocument
    dim WithEvents objWind As MSHTML.HTML.HTMLWindow2
    dim objEvent as CEvent As CEventObj

    then in the WebBrowser_Downloadcomplete event add the following code
    Private Sub WebBrowser1_DownloadComplete()

    Set objDoc = WebBrowser1.Document
    Set objWind = objDoc.parentWindow

    End Sub

    add an event handler as follows

    Private Sub objWind_onerror(ByVal description As String, ByVal URL As String, ByVal line As Long)


    Set objEvent = objWind.event
    objEvent.returnValue = True


    End Sub


    hope it helps

  6. #6
    aryx
    Guest
    thnx yall

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width