You can automate just about any page if you know the names of the HTML elements.
This sample opens IE and navigates to gmail.com and attampts to log in.
Add references to
Microsoft HTML Object Library (mshtml)
Microsoft Internet Controls (AxSHDocVw)
using SHDocVw;
private void button1_Click(object sender, System.EventArgs e)
{
Object o = null;
Object URL = "www.gmail.com";
mshtml.HTMLDocumentClass doc;
InternetExplorer ie = new InternetExplorer();
ie.Visible = true;
ie.Navigate2(ref URL, ref o, ref o, ref o, ref o);
while (ie.ReadyState != SHDocVw.tagREADYSTATE.READ
{
Application.DoEvents();
System.Threading.Thread.Sl
}
// get the document
doc = (mshtml.HTMLDocumentClass)
//Console.WriteLine(doc.bo
// username
// <INPUT class="gaia le val" id=Email size=18 name=Email>
mshtml.HTMLInputElementCla
el.value = "me@gmail.com";
// password
// <INPUT class="gaia le val" id=Passwd type=password size=18 value="" name=Passwd autocomplete="off">
el = (mshtml.HTMLInputElementCl
el.value = "mypassword";
// <INPUT class="gaia le button" type=submit value="Sign in" name=null>
// click submit (search for it first)
foreach ( mshtml.HTMLInputElementCla
{
if ( inp.type == "submit" )
{
inp.click();
break;
}
}
}
Main Topics
Browse All Topics





by: mnasmanPosted on 2005-10-04 at 11:23:25ID: 15016396
try Gmail Agent API s/gmailapi /
/useritems /webaccoun t.asp /dotnet/GM ailReader. asp
http://johnvey.com/feature
also look at these articles
http://www.codeproject.com
http://www.codeproject.com