eric33
April 24th, 1999, 10:38 AM
I want to integrate in my MFC application a shortcut to a web site and another to a mail box.
I never implement internet functions in a MFC application (VC6).
Could somemone help me for the first steps ?
Eddie Shipman
April 26th, 1999, 04:02 PM
You can use the open verb of ShellExecute to get the default browser to open
with the URL passed. I personally use the ShellExecuteEx with Delphi to do
the same. Here is the code, simple to convert to MFC.
procedure TForm1.BrowseTo(sURL, sBrowser, sDir :String);
begin
ZeroMemory(@sei, sizeof(sei));
with sei do
begin
cbSize := SizeOf(sei);
fMask := SEE_MASK_NOCLOSEPROCESS;
Wnd := Form1.Handle;
lpVerb := 'open';
// Need to see if sBrowser empty, if so, pass url to lpFile parameter
// If sBrowser is empty, it will use the default browser with the URL passed.
if sBrowser <> #0 then
lpFile := PChar(sBrowser)
else
lpFile := PChar(sURL);
lpParameters := PChar(sURL);
lpDirectory := PChar(sDir);
nShow := SW_SHOWNORMAL;
end;
ShellExecuteEX(@sei);
end;
procedure TForm1.btnBrowseToClick(Sender: TObject);
begin
BrowseTo('http://www.informant.com/undu/index.htm', 'netscape.exe',
'"C:\Program Files\Netscape\Navigator\Program\"');
end;