allie109
asked on
open IE
Hi all,
is there anybody know how I can add a button that can allow me to open an IE window ?
thanks a lot ;)
is there anybody know how I can add a button that can allow me to open an IE window ?
thanks a lot ;)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
uses shellapi;
Procedure open_IE(IE_address: String);
Begin
ShellExecute(0,'open',IE_a ddress,nil ,nil,SW_SH OW);
end;
{you can replace SW_SHOW with
SW_HIDE,SW_SHOW,SW_MINIZE, SW_MAXIMIZ ED,SW_SHOW NORMAL}
//call the procedure
ex:
procedure TForm1.Button1Click(Sender : TObject);
begin
open_IE('http://www.yahoo.com');
end;
hope it helped ...
Procedure open_IE(IE_address: String);
Begin
ShellExecute(0,'open',IE_a
end;
{you can replace SW_SHOW with
SW_HIDE,SW_SHOW,SW_MINIZE,
//call the procedure
ex:
procedure TForm1.Button1Click(Sender
begin
open_IE('http://www.yahoo.com');
end;
hope it helped ...
if you just want internet explorer then:
//at the top:
uses shellApi;
shellExecute(0, 'open', PChar('iexplore.exe'), nil, nil, SW_SHOWNORMAL);
//at the top:
uses shellApi;
shellExecute(0, 'open', PChar('iexplore.exe'), nil, nil, SW_SHOWNORMAL);
No comment has been added to this question in more than 21 days, so it is now classified as abandoned..
I will leave the following recommendation for this question in the Cleanup topic area:
Accept: Ferruccio68
Any objections should be posted here in the next 4 days. After that time, the question will be closed.
Karamja (Alan)
EE Cleanup Volunteer
I will leave the following recommendation for this question in the Cleanup topic area:
Accept: Ferruccio68
Any objections should be posted here in the next 4 days. After that time, the question will be closed.
Karamja (Alan)
EE Cleanup Volunteer
uses
ShellAPI, Registry;
procedure OpenURL(Url: string);
var
ts: string;
begin
with TRegistry.Create do
try
rootkey := HKEY_CLASSES_ROOT;
OpenKey('\htmlfile\shell\o
try
ts := ReadString('');
except
ts := '';
end;
CloseKey;
finally
Free;
end;
if ts = '' then Exit;
// remove quotes and commandline parameters
ts := Copy(ts, Pos('"', ts) + 1, Length(ts));
ts := Copy(ts, 1, Pos('"', ts) - 1);
ShellExecute(0, 'open', PChar(ts), PChar(url), nil, SW_SHOW);
end;
procedure TForm1.Button1Click(Sender
begin
OpenURL('http://www.hushpage.com);
end;
{2.}
{*************************
{ From: http://community.borland.com/article/0,1410,16858,00.html }
uses
DdeMan,
{$IFDEF WIN32}
Registry; {We will get it from the registry}
{$ELSE}
IniFiles; {We will get it from the win.ini file}
{$ENDIF}
{$IFNDEF WIN32}
const
MAX_PATH = 144;
{$ENDIF}
function GetProgramAssociation(Ext:
var
{$IFDEF WIN32}
reg: TRegistry;
s: string;
{$ELSE}
WinIni: TIniFile;
WinIniFileName: array[0..MAX_PATH] of Char;
s: string;
{$ENDIF}
begin
{$IFDEF WIN32}
s := '';
reg := TRegistry.Create;
reg.RootKey := HKEY_CLASSES_ROOT;
if reg.OpenKey('.' + ext + '\shell\open\command',
False) <> False then
begin
{The open command has been found}
s := reg.ReadString('');
reg.CloseKey;
end
else
begin
{perhaps thier is a system file pointer}
if reg.OpenKey('.' + ext,
False) <> False then
begin
s := reg.ReadString('');
reg.CloseKey;
if s <> '' then
begin
{A system file pointer was found}
if reg.OpenKey(s + '\shell\open\command',
False) <> False then
{The open command has been found}
s := reg.ReadString('');
reg.CloseKey;
end;
end;
end;
{Delete any command line, quotes and spaces}
if Pos('%', s) > 0 then
Delete(s, Pos('%', s), Length(s));
if ((Length(s) > 0) and
(s[1] = '"')) then
Delete(s, 1, 1);
if ((Length(s) > 0) and
(Pos('"', s) > 0)) then
Delete(s, Pos('"', s), Length(s));
while ((Length(s) > 0) and
(s[Length(s)] = #32)) do
Delete(s, Length(s), 1);
{$ELSE}
GetWindowsDirectory(WinIni
StrCat(WinIniFileName, '\win.ini');
WinIni := TIniFile.Create(WinIniFile
s := WinIni.ReadString('Extensi
WinIni.Free;
{Delete any command line}
if Pos(' ^', s) > 0 then
Delete(s, Pos(' ^', s), Length(s));
{$ENDIF}
Result := s;
end;
procedure StartNewBrowserWindow(URL:
var
DDEConv: TDDEClientConv;
URLFired: bool;
App: string;
UpApp: string;
p: array[0..MAX_PATH] of Char;
begin
UrlFired := False;
App := GetProgramAssociation('HTM
UpApp := Uppercase(App);
Delete(App, Pos('.EXE', UpAPP), Length(App));
if Pos('NETSCAPE.EXE',
UpApp) > 0 then
begin
DDEConv := TDDEClientConv.Create(nil)
DDEConv.ServiceApplication
if DDEConv.SetLink('NETSCAPE'
if DDEConv.RequestData(URL + ',,0x0,0x0') <> nil then
if DDEConv.SetLink('NETSCAPE'
URLFired := DDEConv.RequestData('0xFFF
DDEConv.Free;
end
else if Pos('IEXPLORE.EXE',
UpApp) > 0 then
begin
DDEConv := TDDEClientConv.Create(nil)
DDEConv.ServiceApplication
if DDEConv.SetLink('iexplore'
if DDEConv.RequestData(URL + ',,0') <> nil then
if DDEConv.SetLink('iexplore'
URLFired := DDEConv.RequestData('0,0')
DDEConv.Free;
end;
if UrlFired = False then
WinExec(StrPCopy(@p, URL), SW_SHOWNORMAL);
end;
procedure TForm1.Button1Click(Sender
begin
StartNewBrowserWindow('http://www.borland.com');
StartNewBrowserWindow('http://www.yahoo.com');
end;
**************************
or simply
uses
ShellApi;
{....}
procedure TForm1.Button1Click(Sender
begin
ShellExecute(Handle,
'open',
'http://www.www.hushpage.com',
nil,
nil,
SW_SHOW);
end;