Results 1 to 6 of 6

Thread: [RESOLVED] WebBrowser Context Menu halts my program...

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Sep 2013
    Posts
    190

    Resolved [RESOLVED] WebBrowser Context Menu halts my program...

    Using the following code:

    Code:
    CreateObject("WScript.Shell").SendKeys "+{F10}", True
    to open the context menu after I've gotten the focus on a link on the page. Once that is done, my program simply stops. It's like popping up that context menu sends my program into a hidden loop, not allowing the rest of the code to perform. Any ideas?

  2. #2
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: WebBrowser Context Menu halts my program...

    Not sure why you are using scripting control vs VB's SendKeys. With VB (assuming scripting control also), that 2nd parameter of True tells VB to wait for the reply (synchronous). Try changing to False
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Sep 2013
    Posts
    190

    Re: WebBrowser Context Menu halts my program...

    The original SendKeys doesn't work in Windows 7. Using it gives a runtime error 70: "Permission denied".
    Changing it to False does nothing.

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Sep 2013
    Posts
    190

    Re: WebBrowser Context Menu halts my program...

    I've also tried DoEvents to see if that will clear it, but it just sits there as before.

  5. #5
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: WebBrowser Context Menu halts my program...

    Well, you can always try the SendInput API. There are many examples on the web and likely in this forum.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Sep 2013
    Posts
    190

    Re: WebBrowser Context Menu halts my program...

    Though this doesn't solve the original issue, I figured out how to obtain the information I needed without having to use the WebBrowser control's context menu.

    Code:
    WebBrowser1.Document.ActiveElement.OuterText
    ...gets the link's text that has the focus.

    Code:
    WebBrowser1.Document.ActiveElement.OuterHtml
    ...gets the actual link.

Tags for this Thread

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