贴上源码,大家自己看吧,源码出自DFW的老贴子上面:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, WinProcs, ShellAPI;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
var
cmdStr
char;
StartupInfo: TStartupInfo;
ProcessInfo: TProcessInformation;
begin
cmdstr:=pchar('RunDLL32.exe Shell32.DLL,Control_RunDLL Intl.cpl,,4');
{建立进程并等待其结束}
fillchar(StartupInfo,sizeof(StartupInfo),0);
CreateProcess(nil,cmdstr,nil,nil,false,0,nil,nil,StartupInfo,ProcessInfo);
With ProcessInfo do
begin
CloseHandle(hThread);
WaitForSingleObject(hProcess, INFINITE);
CloseHandle(hProcess);
end;
end;
end.