Article View: borland.public.cppbuilder.internet.web
Article #1220Sending a TAB/RETURN key to an External Browser
From: Mitch McInelly
Date: Thu, 01 Sep 2005 17:50
Date: Thu, 01 Sep 2005 17:50
58 lines
2832 bytes
2832 bytes
Hi Friends,
I'm trying to open an external browser and automatically enter a username,
TAB to get to the next field, then password, then RETURN (for the submit
button). My problem is that the TAB and RETURN's aren't firing like I think
should.
I am already doing this using DOM and an imbedded TCppWebBrowser componenet,
but for certain functions I need to open an complely separate external web
browser.
SHELLEXECUTEINFO execinfo;
memset(&execinfo,0,sizeof(execinfo));
execinfo.cbSize = sizeof(execinfo);
execinfo.lpVerb = "open";
execinfo.lpFile = "Iexplore.exe";
execinfo.lpParameters = "https://eagent.farmersinsurance.com"; //
Or whatever
execinfo.fMask = SEE_MASK_NOCLOSEPROCESS;
ShellExecuteEx(&execinfo); //Launches Browser
LPCTSTR str = "username";
INPUT inp[2];
memset(inp,0,sizeof(INPUT));
inp[0].type = INPUT_KEYBOARD;
inp[0].ki.dwFlags = KEYEVENTF_UNICODE;
inp[1] = inp[0];
inp[1].ki.dwFlags |= KEYEVENTF_KEYUP;
for(LPCTSTR p=str; *p; p++)
{inp[0].ki.wScan = inp[1].ki.wScan = *p;
SendInput(2,inp,sizeof(INPUT));}
str=LPCSTR(char(8)); // trying to send a TAB here to get to next field -
gets access violations
for(LPCTSTR p=str; *p; p++)
{inp[0].ki.wScan = inp[1].ki.wScan = *p;
SendInput(2,inp,sizeof(INPUT));}
str = "password";
for(LPCTSTR p=str; *p; p++)
{inp[0].ki.wScan = inp[1].ki.wScan = *p;
SendInput(2,inp,sizeof(INPUT));}
str=LPCSTR(VK_RETURN?); // trying to send a RETURN here to get to submit
for(LPCTSTR p=str; *p; p++)
{inp[0].ki.wScan = inp[1].ki.wScan = *p;
SendInput(2,inp,sizeof(INPUT));}
Thanks for the look.
Mitch McInelly
Technical Details
Message-ID:
<43173f1c$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!feeder2.on.meganewsservers.com!meganewsservers.com!textfeed1.on.meganewsservers.com!38.119.100.83.MISMATCH!news-out.nntp.be!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: feeec,920e6afa2e1b6230,start X-Google-Attributes: gidfeeec,public X-Google-Language: ENGLISH,ASCII-7-bit Reply-To: "Mitch McInelly" <mitch@agencysoftware.com> From: "Mitch McInelly" <mitch@agencysoftware.com> Newsgroups: borland.public.cppbuilder.internet.web Subject: Sending a TAB/RETURN key to an External Browser Date: Thu, 1 Sep 2005 10:50:06 -0700 Lines: 60 Organization: Agency Software, Inc. X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-RFC2646: Format=Flowed; Original NNTP-Posting-Host: 207.88.115.45 Message-ID: <43173f1c$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1125596956 207.88.115.45 (1 Sep 2005 10:49:16 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!feeder2.on.meganewsservers.com!meganewsservers.com!textfeed1.on.meganewsservers.com!38.119.100.83.MISMATCH!news-out.nntp.be!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail