Article View: borland.public.cppbuilder.nativeapi
Article #6148Re: Opening up Web Browsers inside my App
From: Gav
Date: Mon, 06 Jun 2005 13:07
Date: Mon, 06 Jun 2005 13:07
51 lines
2548 bytes
2548 bytes
Apologies for appearing thick Gambit, but I am getting errors,
Improper use of typedef BOOL
Statement missing ; (on BOOL line)
Undefined symbol FindBrowser.
So I have to ask then, where do I put the example code below
and do I need to alter it in anyway ?
Thanks
Gav...
Earlier Gambit wrote :-
You have to loop through every running window, looking for the one that
belongs to the new process you just spawned. Use EnumWindows() and
GetWindowThreadProcessId() for that, using the process ID that
CreateProcess() returned in the PROCESS_INFORMATION structure. For example:
struct MyInfo
{
DWORD dwProcessId;
HWND hWnd;
};
BOOL CALLBACK FindBrowser(HWND hwnd, LPARAM lParam)
{
MyInfo *info = reinterpret_cast<MyInfo*>(lParam);
DWORD dwProcessId = 0;
::GetWindowThreadProcessId(hwnd, &dwProcessId);
if( dwProcessId == info->dwProcessId )
{
info->hWnd = hwnd;
return FALSE;
}
return TRUE;
}
if( ::CreateProcess(...) )
{
MyInfo info = {pi.dwProcessId, NULL};
::EnumWindows((WNDENUMPROC)FindBrowser,
reinterpret_cast<LPARAM>(&info));
if( info.hWnd != NULL )
// use info.hWnd as needed... <== Something like :-
::SetParent ( info.hWnd, PagesDlg->TabSheet2->Handle );
PagesDlg->Show();
}
Technical Details
Message-ID:
<42a44aa2$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news2.google.com!proxad.net!212.101.4.254.MISMATCH!solnet.ch!solnet.ch!newsfeed01.sul.t-online.de!t-online.de!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>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> Subject: Re: Opening up Web Browsers inside my App Date: Mon, 6 Jun 2005 21:07:45 +0800 Lines: 53 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: <42a44aa2$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1118063266 203.121.204.130 (6 Jun 2005 06:07:46 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news2.google.com!proxad.net!212.101.4.254.MISMATCH!solnet.ch!solnet.ch!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail