1

源程序下载
1：如何添加桌面的快捷
在Uses里面，添加ShlObj, ActiveX, ComObj这三个单元，就可以了，在这个例子里面，添加的是计算器的快捷方式。
procedure TForm1.Button1Click(Sender: TObject);
var
tmpObject : IUnknown;
tmpSLink : IShellLink;
tmpPFile : IPersistFile;
PIDL : PItemIDList;
StartupDirectory : array[0..MAX_PATH] of Char;
StartupFilename : String;
LinkFilename : WideString;
begin
StartupFilename := 'c:\windows\Calc.exe';
tmpObject := CreateComObject(CLSID_ShellLink);
tmpSLink := tmpObject as IShellLink;
tmpPFile := tmpObject as IPersistFile;
tmpSLink.SetPath(pChar(StartupFilename));
tmpSLink.SetWorkingDirectory(pChar(ExtractFilePath(StartupFilename)));
SHGetSpecialFolderLocation(0,
CSIDL_DESKTOPDIRECTORY,
PIDL);
SHGetPathFromIDList(PIDL, StartupDirectory);
LinkFilename := StartupDirectory + '\计算器.lnk';
tmpPFile.Save(pWChar(LinkFilename),FALSE);
end;
2：写一个在Winx、WinNT通用的“隐身程序”
再program里面添加一个Windows单元，同时定义一个ExtendedStyle : Integer，把Application.Initialize;和 Application.CreateForm(TForm1, Form1);之间加上下面两句话ExtendedStyle := GetWindowLong(Application.Handle, GWL_EXSTYLE);SetWindowLong(Application.Handle, GWL_EXSTYLE, ExtendedStyle OR WS_EX_TOOLWINDOW
AND NOT WS_EX_APPWINDOW);就能让你的程序隐身。
3：屏蔽系统键
下面两句话就可以屏蔽系统键
SystemParametersInfo(SPI_SETFASTTASKSWITCH, 1, @tmp, 0); //屏蔽 Alt-Tab
SystemParametersInfo(SPI_SCREENSAVERRUNNING, 1, @tmp, 0); //屏蔽 Ctrl-Alt-Del
下面两句话就又可以打开系统键
SystemParametersInfo(SPI_SETFASTTASKSWITCH, 0, @tmp, 0); //打开 Alt-Tab
SystemParametersInfo(SPI_SCREENSAVERRUNNING, 0, @tmp, 0); //打开 Ctrl-Alt-Del
源程序下载