Article View: borland.public.cppbuilder.nativeapi
Article #6089Re: Opening up Web Browsers inside my App
From: Gav
Date: Wed, 08 Jun 2005 12:35
Date: Wed, 08 Jun 2005 12:35
68 lines
3666 bytes
3666 bytes
"Remy Lebeau (TeamB)" wrote :-
> You are not passing the correct HANDLE parameter to WaitForInputIdle(),
> and
> you are only waiting for a fraction of a second overall. That is too
> short
> a time. Get rid of the Sleep() and use a much larger timeout on
> WaitForInputIdle(), or just use INFINITE. As for the HANDLE parameter to
> WaitForInputIdle(), you need to use the hProcess member of the
> PROCESS_INFORMATION structure.
Oops, ok done that.
>
>> INFINITE does not work.
>
> Of course not, because you are not passing a valid HANDLE to
> WaitForInputIdle() to begin with. Pass in the correct HANDLE, and then it
> will work.
Your confidence in my abilities is flattering :)
However I now have :-
void __fast TMDIChild1::ITimageClick(TObject *Sender)
{
char DefaultBrowser[MAX_PATH+1] = {0};
MDIChild2->GetDefaultBrowser(DefaultBrowser);
STARTUPINFO si = {sizeof(STARTUPINFO), 0};
PROCESS_INFORMATION pi = {0};
AnsiString CmdLine = (AnsiQuotedStr(DefaultBrowser, '"') + " " +
AnsiQuotedStr("http://www.minitutorials.com", '"'));
if( ::CreateProcess(NULL, CmdLine.c_str(), NULL, NULL, FALSE, 0,
NULL, NULL, &si, &pi) )
{
WaitForInputIdle(pi.hProcess, INFINITE);
::CloseHandle(pi.hThread);
::CloseHandle(pi.hProcess);
MyInfo info = {pi.dwProcessId, NULL};
::EnumWindows((WNDENUMPROC)FindBrowser,reinterpret_cast<LPARAM>(&info));
if( info.hWnd != NULL )
{
::SetParent ( info.hWnd, Form4->Handle );
Form4->Show();
}
}
}
This still does not work, the Internet Explorer window still opens up in a
new window of its own external to my app, have I still got it wrong,
something missing, or maybe a different approach is required. The code above
all gets executed in that all ifs get executed, it seems that the
WaitForInputIdle() is not working somehow.
I have tried other variations that I have seen in Borland Newsgroups and
other sites none of which worked for me.
I am still experimenting. I take it WaitForInputIdle() is the correct/best
way to go about this.?
Gav...
Technical Details
Message-ID:
<42a6e629$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!news-out.nntp.be!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mailReferences:
<422926aa$1@newsgroups.borland.com> <422c31bd$1@newsgroups.borland.com> <422c515c@newsgroups.borland.com> <422c5d8e$1@newsgroups.borland.com> <42a2f6aa$1@newsgroups.borland.com> <42a3910a$1@newsgroups.borland.com> <42a44aa2$1@newsgroups.borland.com> <42a4855c$1@newsgroups.borland.com> <42a588ed@newsgroups.borland.com> <42a5a49d@newsgroups.borland.com> <42a5bb59$1@newsgroups.borland.com> <42a5bdbf@newsgroups.borland.com> <42a5d4dd@newsgroups.borland.com> <42a62b57@newsgroups.borland.com> <42a63c20$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,91b603800ded4d32 X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Gav" <brightoncomputers@brightontown.com.au> Newsgroups: borland.public.cppbuilder.nativeapi References: <422926aa$1@newsgroups.borland.com> <422c31bd$1@newsgroups.borland.com> <422c515c@newsgroups.borland.com> <422c5d8e$1@newsgroups.borland.com> <42a2f6aa$1@newsgroups.borland.com> <42a3910a$1@newsgroups.borland.com> <42a44aa2$1@newsgroups.borland.com> <42a4855c$1@newsgroups.borland.com> <42a588ed@newsgroups.borland.com> <42a5a49d@newsgroups.borland.com> <42a5bb59$1@newsgroups.borland.com> <42a5bdbf@newsgroups.borland.com> <42a5d4dd@newsgroups.borland.com> <42a62b57@newsgroups.borland.com> <42a63c20$1@newsgroups.borland.com> Subject: Re: Opening up Web Browsers inside my App Date: Wed, 8 Jun 2005 20:35:55 +0800 Lines: 70 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2527 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527 X-RFC2646: Format=Flowed; Original NNTP-Posting-Host: 203.121.204.130 Message-ID: <42a6e629$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1118234153 203.121.204.130 (8 Jun 2005 05:35:53 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!news-out.nntp.be!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail