P
panzichan
Unregistered / Unconfirmed
GUEST, unregistred user!
unit Unit1;<br><br>interface<br><br>uses<br> Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,<br> Dialogs;<br><br>type<br> TForm1 = class(TForm)<br> procedure FormCreate(Sender: TObject);<br> procedure FormDestroy(Sender: TObject);<br> private<br> { Private declarations }<br> atom:WORD;<br> public<br> { Public declarations }<br> end;<br><br>var<br> Form1: TForm1;<br><br>implementation<br><br>{$R *.dfm}<br><br>procedure TForm1.FormCreate(Sender: TObject);<br>begin<br> if GlobalFindAtom('myexe')=0 then<br> atom:=GlobalAddATom('myexe')<br> else<br> begin<br> showmessage('Program is running');<br> Halt;<br> end; <br>end;<br><br>procedure TForm1.FormDestroy(Sender: TObject);<br>begin<br> GlobalDeleteAtom(atom);<br>end;<br><br>end.<br> 不知各位注意了没有,如果按Alt+Ctrl+Del用任务管理器的进程杀掉,这程序由于没有悉放atom而不能再运行,<br>该如何解决呢???