Article View: borland.public.cppbuilder.nativeapi
Article #6152Re: Opening up Web Browsers inside my App
From: Remy Lebeau (TeamB)
Date: Mon, 06 Jun 2005 17:18
Date: Mon, 06 Jun 2005 17:18
58 lines
2800 bytes
2800 bytes
"Gav" <brightoncomputers@brightontown.com.au> wrote in message
news:42a44aa2$1@newsgroups.borland.com...
> Improper use of typedef BOOL
> Statement missing ; (on BOOL line)
>
> Undefined symbol FindBrowser.
The code I gave you is a standalone function, and needs to be used as such.
It sounds like you probably put the code inside your ITimageClick() code
directly, which you cannot do. It should be more like this instead:
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;
}
void __fastcall 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) )
{
::CloseHandle(pi.hThread);
::CloseHandle(pi.hProcess);
MyInfo info = {pi.dwProcessId, NULL};
::EnumWindows((WNDENUMPROC)FindBrowser,
reinterpret_cast<LPARAM>(&info));
if( info.hWnd != NULL )
// use info.hWnd as needed...
}
}
Gambit
Technical Details
Message-ID:
<42a4855c$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!newshub.sdsu.edu!logbridge.uoregon.edu!newsfeeds.ihug.co.nz!ihug.co.nz!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>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,91b603800ded4d32 X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com> 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> Subject: Re: Opening up Web Browsers inside my App Date: Mon, 6 Jun 2005 10:18:54 -0700 Lines: 60 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1409 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409 NNTP-Posting-Host: 68.69.17.41 Message-ID: <42a4855c$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1118078300 68.69.17.41 (6 Jun 2005 10:18:20 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!newshub.sdsu.edu!logbridge.uoregon.edu!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail