Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6565295
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T14:04:36+00:00 2026-05-25T14:04:36+00:00

Is there a way to have a desktop vb application take control of an

  • 0

Is there a way to have a desktop vb application take control of an already open browser window? For example, have it mouse click certain coordinates in the window or check if the window contains certain elements.

I’ve looked at using Microsoft Internet Controls(shdocvw) and MSHTML(IHTMLDocument2) but I am struggling on how to access elements of the browser window (e.g. body.innnerHTML).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T14:04:37+00:00Added an answer on May 25, 2026 at 2:04 pm

    Add References to Microsoft HTML Object Library and Microsoft Internet Controls

    Option Explicit On
    
    Public Class Form1
    
       'Functions used to set cursor location and mouse clicks
       Public Declare Auto Function SetCursorPos Lib "User32.dll" (ByVal X As Integer, ByVal Y As Integer) As Long
       Public Declare Sub mouse_event Lib "user32" Alias "mouse_event" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)
       Public Declare Auto Function ShowWindow Lib "user32" (ByVal _
       hwnd As Long, ByVal nCmdShow As Long) As Long
    
       'Constants used for cursor and mouse functions, and to maximize window
       Public Const SW_MAXIMIZE = 3
       Public Const MOUSEEVENTF_LEFTDOWN = &H2 ' left button down
       Public Const MOUSEEVENTF_LEFTUP = &H4 ' left button up
       Public Const MOUSEEVENTF_RIGHTDOWN = &H8 ' right button down
       Public Const MOUSEEVENTF_RIGHTUP = &H10 ' right button up    
    
       Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
          'retrieve all the open instances of IE
          Dim shellWindows = New SHDocVw.ShellWindowsClass()
          Dim htmlInput As mshtml.HTMLInputElement
          'for each instance of IE
          For Each ie As SHDocVw.InternetExplorer In shellWindows
             'If the title of the IE window matches the designated title
             If ie.Document.title = "Page Title" Then
                'retrieve the control with the designated field id
                htmlInput = ie.Document.getElementById("fieldID")
                'if the control's inner html matches the designated text
                If htmlInput.innerHTML = "innerHTML" Then
                   'show the IE window maximized and with focus
                   ShowWindow(ie.HWND, SW_MAXIMIZE)
                   'move the cursor to the designated x,y coordinates
                   SetCursorPos(xCoord, yCoord)
                   'left mouse click down and up
                   mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0)
                   mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0)
                   'send the designated keyboard command
                   My.Computer.Keyboard.SendKeys("keyboardCommand")
                End If
             End If
          Next
       End Sub
    End Class
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a way to have an animated loading screen for my iPhone application
Is there any way to have to tabcontrol take the size of the largest
I have a Silverlight 4 desktop application which I control using a touchscreen (on
I have a eXpressApp Framework (XAF) desktop application. The main window contains Navigation pane
I have a desktop application (forms) with a tab control, I assign a tab
Is there a way to have setup/teardown code automagically run before/after each test? Something
Is there a way to have a template specialization based on a range of
Is there a way to have ASP classic cdonts email, have an file attached
Is there a way to have hanging operators when indenting with tabs in Vim?
Is there a way to have rails print out a number with commas in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.