473,401 Members | 2,127 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,401 software developers and data experts.

SHDocVw & MSHTML dom - Popup menu problem

I'm trying to automate an action in Internet Explorer.... I'm trying
to click an image that open a popup menu. The html code of the iimage
look like like <img blabla..OnClick="ShowMenu()"/>

I can click the image but my application is "sleeping" until I
manually click an item in the popup menu.

My code :

//--------------------------------//
using mshtml;
using SHDocVw;
...
SHDocVw.InternetExplorer ie = new SHDocVw.InternetExplorerClass();
SHDocVw.IWebBrowserApp ObjBrowser = (SHDocVw.IWebBrowserApp)ie;
ObjBrowser.Visible = true;
object noValue = System.Reflection.Missing.Value;
object noValue1 = System.Reflection.Missing.Value;
ie.Navigate("http://www.blabla.com", ref noValue, ref noValue, ref
noValue, ref noValue);
System.Threading.Thread.Sleep(1000);
WaitForReadyState(); not included in this example
HTMLImgClass Image =
(HTMLImgClass)ie.document.getElementById("MyImageI d");
Image.click(); // a PopupMenu is displayed after clicking the
object
MessageBox.Show("This message box is displayed only after manually
select an item in the popupmenu")
//--------------------------------//

Question 1 - Is there any way to have the messagebox displayed
immediatly after clicking the image...what is missing? look like my
click is waiting for something...

Question 2 - Is there any way to access to this popup menu ?what
kind of object it is??

Question 3 - Why this popup menu is not the in the HTML page? When
doing a view source i cant see anything about this popup menu, no
ShowMenu definition or javascript function/include...

Thanks for your help...

Apr 9 '07 #1
5 8019
Still need help :( ... At least I need to be able to do the
Image.click(); without having my c# application completely suspended
until a selection is done in the popupmenu


Apr 9 '07 #2
It's hard to say what is going on. Without seeing the Javascript code
for ShowMenu, it's impossible to say what exactly is going on.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"SQACSharp" <ls*********@hotmail.comwrote in message
news:11**********************@p77g2000hsh.googlegr oups.com...
Still need help :( ... At least I need to be able to do the
Image.click(); without having my c# application completely suspended
until a selection is done in the popupmenu


Apr 9 '07 #3
On 9 avr, 16:45, "Nicholas Paldino [.NET/C# MVP]"
<m...@spam.guard.caspershouse.comwrote:
It's hard to say what is going on. Without seeing the Javascript code
for ShowMenu, it's impossible to say what exactly is going on.
We can assume that the javascript function return the hand to the
caller only after a selection is made in the popupmenu.

I suppose we will get the same result if the javascript function was
"WaitUntilForever" with code like "do while(true) //infinitive loop

Here is the javascript code for ShowMenu :

function ModalPopUp(items,xpos,ypos) {
alert('Custom Controls are not Installed.');
return false;
popupHeight = items.length * 17 + 32;
popupWidth = 0;
for (i=0; i<items.length; i++) {
stringWidth = 5.5 * items[i].length;
if (stringWidth popupWidth) {
popupWidth = stringWidth;
}
}

popupWidth = Math.floor(popupWidth+25);

if (event) {
top.ActiveEvent = event;
}

if (!xpos) {
try {
xpos = top.ActiveEvent.screenX;
} catch (ee) { xpos=1; }
}
if (!ypos) {
try {
ypos = top.ActiveEvent.screenY;
} catch (ee) { ypos=1; }
}

return window.showModalDialog(top.BASE_HREF + '/blablabla/
modalmenu.html',items,
'dialogTop:'+ypos+'px;dialogLeft:'+xpos+
'px;dialogHeight:'+popupHeight+'px;dialogWidth:'+p opupWidth
+'px;help:no;status:no;scroll:no;title:no');
}

function ShowMenu(menuName,xpos,ypos) {
try {
if (xpos && ypos) {
paramtext = "xpos,ypos";
} else {
paramtext = '';
}
eval(menuName + ".PopUp("+paramtext+")");
} catch (e) {
eval("val = ModalPopUp(" + menuName +
"Items.toArray(),xpos,ypos);");

if (val>0) {
try {
eval(menuName + "_Click(val)");
} catch (e1) {}
}
}
}
Is it possible to access and interract with a window.showModalDialog
with DOM or something else???

thanks!

Apr 9 '07 #4
i'm completely stock with this... is there any trick or a workaround
to select an item in this menu or at least being able to continue to
the next line of code?? When doing image.click() i will get the
control in my code only after a selection is made in the menu...

I really need help on this...

thanks

Apr 10 '07 #5
Still need help to solve this problem..... :(
Apr 13 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Denny Rue | last post by:
How does one recognize that a popup window (like "File Download" or a redirect) has occurred when using the InternetExplorer object in a Windows form and VB .Net? And then respond accordingly? ...
0
by: Csaba Gabor | last post by:
I've got a PHP server side script (PHP 5.1 / Apache 2.0.53 / Win XP Pro, SP 2 / administrator and sole user of machine) which I'd like to have do either one of the following two things: $ie=new...
3
by: Wiktor Zychla | last post by:
I have a problem I cannot solve. My application hosts IE activex control. I follow the standard procedure: I just aximp shdocvw.dll. Note that this gives you two files: axshdocvw.dll and...
3
by: Zürcher See | last post by:
I've wrote an application that use internet explorer to download some html page, to get the document I use the Microsoft.mshtml library. mshtml.IHTMLDocument3...
4
by: Lars-Erik Aabech | last post by:
Hi! I've been walking in extacy since reading the article about test automation with IE in the latest MSDN mag. (http://msdn.microsoft.com/msdnmag/issues/05/10/TestRun/default.aspx) After a...
0
by: Giuseppe | last post by:
Hi I've this problem Inside a winform application I've put a "webbrowser" control I've tried to catch the oncontextmenu event of the loaded HTML document with the following approach 1) In...
0
by: Fab | last post by:
Hi, In a VS 2003 project, i use the Microsoft Web Browser (shdocvw32.dll). So in the References tab of the Solution Explorer i have : AxSHDocVw SHDocVw Microsoft.mshtml When i copy the...
3
by: David | last post by:
I would like to use a AxSHDocVw.WebBroswer control in a Windows service- is this possible without creating a form? I added the reference I usually use to add this object in a Windows Application...
0
by: =?Utf-8?B?bXQ=?= | last post by:
I am writing a browser toolstrip bar that sits in IE. How do I set a cookie in the browser for a specific domain before the user navigates to that domain. I only have access to IE as an...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.