我们可以用
ShellExecute(handle, nil,pchar('http://www.sohu.com/'), nil, Nnil, SW_SHOWNORMAL);
打开IE浏览器,浏览的页面是搜狐的主页,我想问的是,怎么样子实现如下的功能:
var
http:string;
begin
http:=Edit1.Text;//当然Edit1.Text是一个有效的网址
ShellExecute(handle, nil,pchar(http), nil, Nnil, SW_SHOWNORMAL);
end;
这样子,我们只能是更新IE浏览器的页面的内容,而不能是新开一个IE浏览器的窗口,请问怎么样才能实现不更新原来的页面窗口,新开一个,随着Edit1.Text的变化,新开的窗口就多一个,即使Edit1.Text重复出现,我也新开一个IE浏览器窗口。谢谢高手,希望能帮我解决这个问题。
ShellExecute(handle, nil,pchar('http://www.sohu.com/'), nil, Nnil, SW_SHOWNORMAL);
打开IE浏览器,浏览的页面是搜狐的主页,我想问的是,怎么样子实现如下的功能:
var
http:string;
begin
http:=Edit1.Text;//当然Edit1.Text是一个有效的网址
ShellExecute(handle, nil,pchar(http), nil, Nnil, SW_SHOWNORMAL);
end;
这样子,我们只能是更新IE浏览器的页面的内容,而不能是新开一个IE浏览器的窗口,请问怎么样才能实现不更新原来的页面窗口,新开一个,随着Edit1.Text的变化,新开的窗口就多一个,即使Edit1.Text重复出现,我也新开一个IE浏览器窗口。谢谢高手,希望能帮我解决这个问题。
ShellExecute(handle,'open','Explorer','Your www URL',nil,SW_SHOW);
即可。
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 : string) : string;
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(WinIniFileName, sizeof(WinIniFileName));
StrCat(WinIniFileName, '\win.ini');
WinIni := TIniFile.Create(WinIniFileName);
s := WinIni.ReadString('Extensions',
ext,
'');
WinIni.Free;
{Delete any command line}
if Pos(' ^', s) > 0 then
Delete(s, Pos(' ^', s), length(s));
{$ENDIF}
result := s;
end;procedure StartNewBrowserWindow(URL : string);
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 := App;
if DDEConv.SetLink('NETSCAPE' , 'WWW_OpenURL') then
if DDEConv.RequestData(URL +
',,0x0,0x0') <> nil then
if DDEConv.SetLink('NETSCAPE', 'WWW_Activate') then
URLFired := DDEConv.RequestData('0xFFFFFFFF,0x0') <> nil;
DDEConv.Free;
end else
if Pos('IEXPLORE.EXE',
UpApp) > 0 then begin
DDEConv:=TDDEClientConv.Create(nil);
DDEConv.ServiceApplication := App;
if DDEConv.SetLink('iexplore', 'WWW_OpenURL') then
if DDEConv.RequestData(URL + ',,0') <> nil then
if DDEConv.SetLink('iexplore', 'WWW_Activate') then
URLFired := DDEConv.RequestData('0,0') <> nil;
DDEConv.Free;
end;
if UrlFired = false then
WinExec(StrPCopy(@p, URL), SW_SHOWNORMAL);
end;procedure TForm1.Button1Click(Sender: TObject);
begin
StartNewBrowserWindow('http://www.borland.com');
StartNewBrowserWindow('http://www.yahoo.com');
end;