Click here to Skip to main content
15,889,909 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I am facing one issue with HTML programming with VB 6.0. I have created one automate program to fill a web form on the internet with Visual Basic 6.0.
For example observer below code.

Step 1: Create one Standard EXE project.

Step 2: Add reference to "Microsoft HTML Object Library" - You can add this from \windows\system32\mshtml.tlb

Step 3: Add reference to "Microsoft Internet Controls" - You can add this from \windows\system32\ieframe.dll.

Copy and Paste Below code in form1.

Private Sub Form_Load()

Dim IE As SHDocVw.InternetExplorer
Set IE = Nothing
Set IE = CreateObject("InternetExplorer.Application")

IE.Navigate "www.google.com"

Do While IE.Busy
    DoEvents
    DoEvents
Loop

IE.Visible = True

Dim HtmEle As HTMLHtmlElement
DoEvents
DoEvents
IE.Document.getElementById("q").Value = "text"
DoEvents
DoEvents

Set HtmEle = IE.Document.getElementById("btng")
If Not HtmEle Is Nothing Then
    MsgBox "HtmEle Object set." & vbCrLf & "Now it will click on Google Search button."
    HtmEle.Click
End If

End

End Sub


Now instead of doing this click on Google Search button I want to do Right Click on that button. I tried to do it with mouse_event API it would solve my issue. But it gets failed when I resize the IE or move IE. I think I will require X,Y co-ordinate of that htmele.

Is there any way from that I can do right click on that htmele?
If I can get X,Y co-ordinate of htmEle in screen that would be also very helpful.

Thanks in advance.
Posted

1 solution

Create a ContextMenu object and attach it to the control you want to have a context menu. - a context menu is a right click menu..


example:http://www.elguille.info/NET/csharp/beta2/notifyiconCS.ht[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900