http://www.csdn.net/expert/topic/799/799541.xml?temp=.3593714
打开网页
ShellExecute(Handle,'open',Pchar('http://www.sohu.com'),nil,nil,SW_SHOW);
打开网页
ShellExecute(Handle,'open',Pchar('http://www.sohu.com'),nil,nil,SW_SHOW);
vs:=myinifile.ReadString('ABC','a1',缺省值);
OpenUrl(vs);
Filename:=ExtractFilePath(Paramstr(0))+'xxxx.ini';//xxxx.ini为你存储的文件
myinifile:=TiniFile.create(filename);
I: Integer;
begin
with TStringList.Create do
try
LoadFromFile('Ini.ini');
for I := 0 to Count - 1 do
if Values['a' + IntToStr(I)] <> '' then
OpenURL(Values['a' + IntToStr(I)])
else
Break;
finally
Free;
end;
end;
如果不是Ini文件的格式,是纯下面的格式的话,就不需要if语句来判断,直接用OpenURL函数即可。
a1=http://www.163.com
a2=http://www.skycn.com
a3=http://www.169.net
a4=……
……=……
ShellExecute(Handle,'open',Pchar('http://www.sohu.com'),nil,nil,SW_SHOW);由于文件关联,你也许不用指定handle为ie,具体查msdn吧!
[ABC]
URLCount=...
a1=http://www.163.com
a2=http://www.skycn.com
a3=http://www.169.net
a4=……
……=……
这样不就结了?
你看看注册表,有好多记录最近访问文件菜单得键值,都用这种方法!
vs:=myinifile.ReadString('ABC','a1',缺省值);
OpenUrl(vs);
ShellExecute(Handle,'open',Pchar('http://www.sohu.com'),nil,nil,SW_MAXIMIZE);
就行了