I run a check to see if my application is already running and if it is I warn the user with a MessageDlg and then Close() the application.
Immediately after clicking the 'OK' button in the dialog I get an External: SIGSEGV' exception.
procedure TMainForm.FormCreate(Sender: TObject);
begin
if (WindowsProcIsRunning('myApplication.exe') > 1) then
begin
if (MessageDlg('Cannot run application more than once on a machine.'+sLineBreak+sLineBreak+'Exiting...',mtWarning,[mbOK],0) = mrOK) then Close();
end;
What is the correct way to close the application from FormCreate? (Or can I actually close the application before the main form is created?)
Thanks,
FM