NT还是Windows98取得当前操作平台......
begin
SetArguments(Pchar(Parameter));
SetPath(Pchar(FileName));
SetWorkingDirectory(Pchar(ExtractFilePath(FileName)));
end;
MyReg := TRegIniFile.Create(
"Software\MicroSoft\Windows\CurrentVersion\Explorer");
if ((FolderNo $#@60; 0) or (FolderNo $#@62; 2)) then
FolderNo := 0;
Directory := MyReg.ReadString("Shell Folders", Folder[FolderNo],"");
//CreateDir(Directory);
WFileName := Directory + "\" + LinkName + ".lnk";
MyPFile.Save(PWChar(WFileName),False);
MyReg.Free;
end;
例如:在桌面、开始菜单、程序菜单中添加计算器的快捷方式: SetLink(0, "c:\windows\calc.exe", "", "计算器");
SetLink(1, "c:\windows\calc.exe", "", "计算器");
SetLink(2, "c:\windows\calc.exe", "", "计算器");
5.一个利用系统时间产生随机数的程序 function Myrandom(Num: Integer): integer;
var
T: _SystemTime;
X: integer;
I: integer;
begin
Result := 0
If Num = 0 then Exit;;
GetSystemTime(T);
X := Trunc(T.wMilliseconds/10) * T.wSecond * 1231;
X := X + random(1);
if X $#@60; 0 then X := -X;
X := Random(X);
X := X mod num;
for I := 0 to X do
X := Random(Num);
Result := X;
end;
查看本文来源