--> Tricks kill process our own programs, in addition to using the Terminate command on Delphi | Delphi Tips Trick

For Newbie

Tuesday 15 November 2011

Tricks kill process our own programs, in addition to using the Terminate command on Delphi

| Tuesday 15 November 2011

Declaration procedure:
KillSelf procedure;
var
   hProc: THandle;
   nExitC, cPID: DWORD;
begin
   cPID: = GetCurrentProcessID;
   hProc: = OpenProcess (PROCESS_QUERY_INFORMATION or PROCESS_TERMINATE, False, cPID);
   GetExitCodeProcess (hProc, nExitC);
   TerminateProcess (hProc, nExitC);
   CloseHandle (hProc);
end;

Example of implementation:
procedure TForm1.Button1Click (Sender: TObject);
begin
   KillSelf;
end;

This way I have ever used when an application error message appears when in close, which is fitted out nampilin report using QuickReport. I was so desperate not find the cause of error, finally in this way that I use.

Related Posts

No comments: