I use the following snip of code in the project.dpf at startup to detect
multiple instances. I isn't super smart but it works and is simple - what
more could you ask for other than to rap it into a function like JustOne32.
Maurice Butler
Like Magic Ltd
var
hwndPrev:hwnd;
begin
Application.Initialize;
Application.Title := 'Jetline 2000';
//ensure single instance application
hwndPrev := FindWindow('TfrmStatus','Jetline 2000 Status');
if ( hwndPrev <> 0)
//found previous instance
and (FindWindow('TPropertyInspector','Object Inspector') = 0) then //not
in delphi
begin
ShowWindow(hwndPrev,SW_RESTORE);
SetForegroundWindow(hwndPrev);
Application.Terminate;
end
else
begin
Application.CreateForm(TdmExceptionTrap, dmExceptionTrap);
....rest of form creation etc goes here
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz