本文整理自网络,侵删。
procedure TForm1.FormCreate(Sender: TObject); var errno:integer; hmutex:hwnd; begin hmutex:=createmutex(nil,false,pchar(application.Title)); errno:=getlasterror; if errno=error_already_exists then begin ShowMessage(‘程序已经在运行了’); Application.Terminate; end; end;
相关阅读 >>
winapi 字符及字符串函数(1): charlower - 字符或字符串转小写
Delphi 直接将html字符串读入webbrowser中
更多相关阅读请进入《Delphi》频道 >>