Tuesday, 15 November 2011
Home »
Tips and Trick Delphi
» Tricks kill process our own programs, in addition to using the Terminate command on Delphi
Tricks kill process our own programs, in addition to using the Terminate command on Delphi
To Share | 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.
No comments:
Post a Comment