[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

MSHTML Area Map Click C# preferred

Posted on 2006-05-19
4
Medium Priority
?
791 Views
Last Modified: 2012-05-05
Sorry for the duplication but this question wasn't showing up in the 'Awaiting Answer' section.

Very simple .. Not for me but maybe for you.  I'm loose with my points.  Quick answers get sizable amounts.

Here is what I have:  I have a winform, browser control, 2 buttons.  One button logs in using button1_Click().  button2_Click() needs to do the following after I've logged in.

This is what I want:
I want to click on this areamap (programmatically).  I don't want to do a 'mousemove' type thing.  This is difficult for me because there is no standard Map/Area HTML.   I'm thinking I need to use the IHTMLAreaElement or something but don't know how to get to the href attribute.  This is what I have to work with.

<IMG height=140 alt="" src="images/somepic.gif" width=358 useMap=#somemap border=0>
<MAP name=somemap>
<AREA shape=RECT target=_blank alt="" coords=120,96,242,122 href="somelink.html">
</MAP>

=================================

By the way I'm logging in just fine to the previous page with code like this if anyone can use it:

private void button1_Click(object sender, System.EventArgs e) {
    try {
          IHTMLInputElement IhElementEmail;
          IHTMLInputElement IhElementPassword;
          IhElementEmail = (IHTMLInputElement)htmlDoc.getElementById("emailid");
          IhElementEmail.value = "";
          IhElementEmail.value = "someusername";
          IhElementPassword = (IHTMLInputElement)htmlDoc.getElementById("password");
          IhElementPassword.value = "";
          IhElementPassword.value = "somepassword";
          htmlDoc.parentWindow.execScript("void(signinuser());", "javascript");
    } catch(Exception exc) {
          MessageBox.Show("button1_Click: "+exc.Message);
    }
}
0
Comment
Question by:famoso
  • 3
4 Comments
 
LVL 10

Accepted Solution

by:
prakash_prk earned 2000 total points
ID: 16724321

try this code to get the href attribute of AREA tag
------------------------------------------------------------------------------------------------
mshtml.IHTMLDocument3 document = (mshtml.IHTMLDocument3) axWebBrowser1.Document;
mshtml.IHTMLElementCollection collection = (mshtml.IHTMLElementCollection) document.getElementsByTagName("AREA");
mshtml.IHTMLAreaElement areaElement = (mshtml.IHTMLAreaElement)collection.item(System.Reflection.Missing.Value, 0);
------------------------------------------------------------------------------------------------
regards
prakash
0
 

Author Comment

by:famoso
ID: 16729002
Thank you.  I will give it a try Monday.
0
 

Author Comment

by:famoso
ID: 16734092
Now how would I preform a programmatic click on that Area coordinates?
0
 

Author Comment

by:famoso
ID: 16734112
Or does the click need to be performed on the image that the map is associated with?
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Screencast - Getting to Know the Pipeline
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question