-
-
你知道更简洁的创建桌面快捷键的程序吗? ^_^
-
发表于:
2007-5-26 15:24
6479
-
Delphi 7:
{ Function: create a desktop shortcut to your application }
{ make sure you add these units in the uses clause. }
uses ShellAPI, ComObj, ComCtrls, Shlobj, ActiveX;
procedure CreateShortCut;
var
psl : IShellLink;
ppf : IPersistFile;
ws : WideString;
wss : array[0..MAX_PATH] of AnsiChar;
begin
psl := CreateComObject(CLSID_ShellLink) as IShellLink;
ppf := psl as IPersistFile;
if Assigned( psl ) then
try
psl.SetPath( PChar( ParamStr( 0 ) ) );
psl.SetWorkingDirectory( PChar( ExtractFilePath( Application.ExeName ) ) );
psl.SetShowCmd( SW_SHOWNORMAL );
psl.SetDescription( PChar( 'Your app name' ) );
GetEnvironmentVariable( PChar('USERPROFILE'), wss, sizeof(wss) - 1 );
ws := wss + '\Desktop\Your app name.lnk';
ppf.Save( PWChar( ws ), False );
finally
end;
end;
[注意]传递专业知识、拓宽行业人脉——看雪讲师团队等你加入!