Article View: borland.public.cppbuilder.internet.web
Article #1221Re: Sending a TAB/RETURN key to an External Browser
From: Mitch McInelly
Date: Thu, 01 Sep 2005 19:39
Date: Thu, 01 Sep 2005 19:39
67 lines
3070 bytes
3070 bytes
Never mind. I figured it out. Needed to use
keybd_event(VK_TAB,NULL,NULL,NULL);
"Mitch McInelly" <mitch@agencysoftware.com> wrote in message
news:43173f1c$1@newsgroups.borland.com...
> 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:
<431758be@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!newsread.com!newsstand.newsread.com!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mailReferences:
<43173f1c$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: feeec,920e6afa2e1b6230 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 References: <43173f1c$1@newsgroups.borland.com> Subject: Re: Sending a TAB/RETURN key to an External Browser Date: Thu, 1 Sep 2005 12:39:24 -0700 Lines: 69 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; Response NNTP-Posting-Host: 207.88.115.45 Message-ID: <431758be@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1125603518 207.88.115.45 (1 Sep 2005 12:38:38 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!newsread.com!newsstand.newsread.com!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail