CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 9 of 9
  1. #1
    Join Date
    Jan 2000
    Posts
    14

    Webbrowser Mouse Event

    Hi all,

    Do You know how to detect mouse click or not on webbrowser control? Or how to simulate mouse click? Any idea is appreciated. Thanks.

    NiteStone


  2. #2
    Join Date
    May 1999
    Posts
    3,332

    Re: Webbrowser Mouse Event

    to trap the click event on an HTML document that resides in a Web browser control, try this

    option Explicit
    private withevents d as HTMLDocument

    private Sub Command1_Click()
    w.Navigate "http://yourURLgoeshere"
    End Sub

    private Function d_onclick() as Boolean
    MsgBox "clicked"
    End Function

    private Sub w_NavigateComplete2(byval pDisp as _
    Object, URL as Variant)
    set d = w.Document
    End Sub





    This might break in many cases, e.g. framesets.

    to simulate a mouseclick, try the mouse_event API or SendInput.



  3. #3
    Join Date
    Jan 2000
    Posts
    14

    Re: Webbrowser Mouse Event

    Thanks for the reply. I have tried it and got an error: user-defined type not defined" on HTMLDocument. I am using VB5. Is HTMLDocument only available in VB6?

    NiteStone


  4. #4
    Join Date
    May 1999
    Posts
    3,332

    Re: Webbrowser Mouse Event

    no, it's not.
    You need to add a reference to your vb project "Microsoft HTML Object Library"


  5. #5
    Join Date
    Jan 2000
    Posts
    14

    Re: Webbrowser Mouse Event

    Thanks again for the reply. Truelly appreciate this.

    I have looked "reference" under project manu yet unable to find "Microsoft HTML object library". Please tell me where to find it?

    NiteStone


  6. #6
    Join Date
    May 1999
    Posts
    3,332

    Re: Webbrowser Mouse Event

    see if you can find an MSHTML.TLB in your system32 directory. Add that to the references.
    Do you have access to IE 4 or 5? AFAIK that Typelib comes with IE.


  7. #7
    Join Date
    Jan 2000
    Posts
    14

    Re: Webbrowser Mouse Event

    Yeah, I have found the library file and added to the project. The codes works great. Thanks million times!!

    NiteStone

    I used IE4. Not update to IE5 yet.


  8. #8
    Guest

    Re: Webbrowser Mouse Event

    What is W

    Is it a HTMLwindow?



  9. #9
    Join Date
    May 1999
    Posts
    3,332

    Re: Webbrowser Mouse Event

    No, "w" is the name of the WebBrowser Control that I placed on the form.


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

Featured