PDA

View Full Version : باز کردن سایت



Mask
سه شنبه 16 تیر 1388, 20:56 عصر
با سلام به دوستان
من با دستور زیر آدرس یه سایت رو تو edit1.txt می نوسیم و اون سایت رو باز می کنم.
حالا یه مشکل وقتی با دستور زیر یه سایت رو باز کردم و اگه آدرس سایت رو از edit1.txt عوض کردم میره و تو همون بروزر باز شده از قبل و می خاد سایت جدید رو باز کنه.
من می خام یه صفحه بروزر جدید باز کنه و به قبلی کار نداشته باشه .
باید چیکار کنم.

ShellExecute(Handle,'Open',pchar(Edit1.Text),nil,n il,SW_SHOWNORMAL);

Mask
پنج شنبه 18 تیر 1388, 18:10 عصر
دست دوستان درد نکنه.
هیچکی جوابمو نداد اما من کدش رو پیدا کردم میزارم تگه کسی خاست استفاده کنه!!!!

unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls,registry,shellapi;
type
TForm1 = class(TForm)
Button1: TButton;
Edit1: TEdit;
Edit2: TEdit;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure OpenURL(Url: string);
var
ts: string;
begin
with TRegistry.Create do
try
rootkey := HKEY_CLASSES_ROOT;
OpenKey('\htmlfile\shell\open\command', False);
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: TObject);
begin
OpenURL(Edit1.Text);
OpenURL(Edit2.Text);
end;

end.