unit shellcreate;interfaceuses
Windows, Forms, ole2, SysUtils, ShellUtl;type
Tshellcreatef = class(TForm)
function ToQuest(instring:string):string;
procedure CreateShortcut(Target , LinkName, Description, Working:string);
procedure CreateCmdLineShortcuts;
procedure FormShow(Sender: TObject); private
{ Private declarations }
public
{ Public declarations }
end;var
shellcreatef: Tshellcreatef;implementation{$R *.DFM}procedure Tshellcreatef.CreateShortcut(Target , LinkName, Description, Working:string);
begin
CoInitialize( pointer(0) );
CreateLink(Target,LinkName,Description, Working);
end;
procedure Tshellcreatef.CreateCmdLineShortcuts;
//Target, LinkName, Description;
var temp,t1,t2,t3,t4:string;
begin
temp:=CmdLine;
temp:=copy(temp,2,length(temp)-1);
temp:=copy(temp,pos('"',temp)+1 ,length(temp));t1:=toQuest(temp); // t1 is the first bit
temp:=copy(temp,length(t1)+2,length(temp)-length(t1)); // get the rest
t1:=trim(t1); // trim t1
t2:=toQuest(temp); // t2 is the second bit
temp:=copy(temp,length(t2)+2,length(temp)-length(t2)); // get the rest
t2:=trim(t2); // trim t2
t3:=toQuest(temp); // t3 is the third bit
temp:=copy(temp,length(t3)+2,length(temp)-length(t3)); // get the rest
t3:=trim(t3); // trim t3
t4:=trim(temp); // t4 is the trimmed left-over
if not((t1='') and (t2='') and (t3='')) then CreateShortcut(t1,t2,t3,t4);
end;function Tshellcreatef.ToQuest(instring:string):string;
var temp:string;
i:integer;
begin
i:=pos('?',instring);
if i>0 then result:=copy(instring,0,i-1) else result:='';
end;//CreateShortcuts(CmdLine);procedure Tshellcreatef.FormShow(Sender: TObject);
begin
CreateCmdLineShortcuts;
Close;
end;end.
Windows, Forms, ole2, SysUtils, ShellUtl;type
Tshellcreatef = class(TForm)
function ToQuest(instring:string):string;
procedure CreateShortcut(Target , LinkName, Description, Working:string);
procedure CreateCmdLineShortcuts;
procedure FormShow(Sender: TObject); private
{ Private declarations }
public
{ Public declarations }
end;var
shellcreatef: Tshellcreatef;implementation{$R *.DFM}procedure Tshellcreatef.CreateShortcut(Target , LinkName, Description, Working:string);
begin
CoInitialize( pointer(0) );
CreateLink(Target,LinkName,Description, Working);
end;
procedure Tshellcreatef.CreateCmdLineShortcuts;
//Target, LinkName, Description;
var temp,t1,t2,t3,t4:string;
begin
temp:=CmdLine;
temp:=copy(temp,2,length(temp)-1);
temp:=copy(temp,pos('"',temp)+1 ,length(temp));t1:=toQuest(temp); // t1 is the first bit
temp:=copy(temp,length(t1)+2,length(temp)-length(t1)); // get the rest
t1:=trim(t1); // trim t1
t2:=toQuest(temp); // t2 is the second bit
temp:=copy(temp,length(t2)+2,length(temp)-length(t2)); // get the rest
t2:=trim(t2); // trim t2
t3:=toQuest(temp); // t3 is the third bit
temp:=copy(temp,length(t3)+2,length(temp)-length(t3)); // get the rest
t3:=trim(t3); // trim t3
t4:=trim(temp); // t4 is the trimmed left-over
if not((t1='') and (t2='') and (t3='')) then CreateShortcut(t1,t2,t3,t4);
end;function Tshellcreatef.ToQuest(instring:string):string;
var temp:string;
i:integer;
begin
i:=pos('?',instring);
if i>0 then result:=copy(instring,0,i-1) else result:='';
end;//CreateShortcuts(CmdLine);procedure Tshellcreatef.FormShow(Sender: TObject);
begin
CreateCmdLineShortcuts;
Close;
end;end.
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货