Click here to Skip to main content
14,298,167 members
Rate this:
Please Sign up or sign in to vote.
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.

<pre><br />
Private Sub Form_Load()<br />
<br />
Dim IE As SHDocVw.InternetExplorer<br />
Set IE = Nothing<br />
Set IE = CreateObject("InternetExplorer.Application")<br />
<br />
IE.Navigate "www.google.com"<br />
<br />
Do While IE.Busy<br />
    DoEvents<br />
    DoEvents<br />
Loop<br />
<br />
IE.Visible = True<br />
<br />
Dim HtmEle As HTMLHtmlElement<br />
DoEvents<br />
DoEvents<br />
IE.Document.getElementById("q").Value = "text"<br />
DoEvents<br />
DoEvents<br />
<br />
Set HtmEle = IE.Document.getElementById("btng")<br />
If Not HtmEle Is Nothing Then<br />
    MsgBox "HtmEle Object set." & vbCrLf & "Now it will click on Google Search button."<br />
    HtmEle.Click<br />
End If<br />
<br />
End<br />
<br />
End Sub<br />
</pre>


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

Rate this:
Please Sign up or sign in to vote.

Solution 1

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[^]
   

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




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100