Question : Click Context Menu, opened by mshtml.IHTMLElement

Hello Experts,
 I am trying to control the functionality of another application, using VB.Net code.
The application I am trying to control uses a InternetExplorerServer, I am clicking a link, that opens a context menu. I would like to click one of the options using my code.
My main problem as I see it is, that when I click the mshtml.IHTMLElement (link), the context menu is displayed, but my application freezs untill I click one of the options.


In short, the problems:
1. hangs after click. Is there any way to click the link without having to wait.
2. do the actuall choice in the menu.

ta
Code Snippet:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
Dim ret As mshtml.IHTMLDocument2
Dim link As mshtml.IHTMLElement
For i = 1 To ret.links.length
                    link = ret.links.item(i)
                    If link.toString.StartsWith("this is my link") Then Exit For
Next
 
'this generates an error but still works (?) On Error Resume Next so all ok
link.click()
'hangs here untill I manually press one of the itms in the context menu that popup from this link.click()
'if it wouldn't hang I would press on of the items
hWnd = FindWindow("#32768", "") 'find the hwnd of the menu
Dim lnglParam As String = (Cursor.Position.Y * &H10000) + Cursor.Position.X
'Not sure about this ...
SendMessage(hWnd, WM_LBUTTONDOWN, 1&, lnglParam)
SendMessage(hWnd, WM_LBUTTONUP, 1&, lnglParam)

Answer : Click Context Menu, opened by mshtml.IHTMLElement

My understanding is that Context Menu would be a popup page opened

If it is an opened popup page, following link will tell you how to get the infromation from that page and will let you click that link on the context menu

http://www.experts-exchange.com/Programming/Languages/.NET/Visual_Basic.NET/Q_22992480.html
Random Solutions  
 
programming4us programming4us