Results 1 to 3 of 3

Thread: Detecting mouse clicks in Internet Explorer

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2001
    Location
    Pennsylvania
    Posts
    2
    I'm stuck. I would like to detect the right mouse click in IE and be able to activate certain selections on the popup menu that appears as a result of the right-click. Anyone have any suggestions or code I could use to accomplish this? Any help is appreciated.

    -Haze

  2. #2
    New Member
    Join Date
    Sep 2000
    Location
    Vancouver,Canada
    Posts
    6

    Smile

    enter GetAsyncKeyState at codehound.com for samples. It is an api call that detects the mouse button. You can pass it VK_RBUTTON. Then you can use GetCursor

    'in a timer
    If GetAsyncKeyState(VK_RBUTTON) Then

    Dim pt As POINTAPI
    Dim hwndNow as Long

    retVal = GetCursorPos(pt)
    hwndNow = WindowFromPoint(pt.x, pt.y)

    to determine the handle using WindowFromPoint api call. Then get the class name of that handle using GetClassName and check for "Internet Explorer_Server" (this is the class name for IE's browser object).

    Dim sText as string
    retVal = GetClassName(hwndNow, sText, 255)

    Select Case sText
    Case "Internet Explorer_Server"
    SendKeys "%V" 'Alt+V to view source
    End Select

    End If

    If the class name matches the coordinates under the cursor, you definitely have IE. You can then use SendKeys to activate any context menu with a shortcut key.

    Hope this helps.

    Rob

  3. #3
    Matthew Gates
    Guest
    Originally posted by eformx
    You can pass it VK_RBUTTON.

    Why don't you just use Vb's Right Mouse Button constant?

    vbRightButton

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