Z
zhaojianzhu
Unregistered / Unconfirmed
GUEST, unregistred user!
//服务程序部分<br>procedure TEService.ServiceStart(Sender: TService; var Started: Boolean);<br>begin<br> FHandle := CreateEvent(nil, false, False, 'myevent');<br> if FHandle = 0 then begin<br> raise exception.create('');<br> end;<br> end;<br><br>//界面程序代码<br>procedure TForm1.FormCreate(Sender: TObject);<br>begin<br> FHandle := CreateEvent(nil, false, False, PChar('myevent'));<br> if fhandle=0 then<br> showmessage(inttostr(getLastError));<br>end;<br><br>如果服务已经启动的情况下启动界面程序,CreateEvent的返回值是0 错误号是5。<br>但如果不启动服务,启动两个同样的界面程序一切正常。