I am trying to ensure that only one instance of an application will
run. I have using the uDHSOneInstanceApp utility by Clément Dos.
While the utility indeed prevents multiple instances of the app, it
does not restore the current instance or make it the active app. A
code snippet follows. Any idea why the calls to API don't work?
FMutex := CreateMutex (nil, FALSE, FAppTitle );
if WaitForSingleObject (FMutex, 0) = wait_TimeOut then begin
// Found another instance
SetWindowText(Application.Handle,''); // We must not found this
one again ;)
// Retrieving handle of the first instance;
hRunningApp := FindWindow(nil,FAppTitle);
if hRunningApp<>0 then begin
//***FOLLOWING CODE DOES NOT SEEM TO WORK - Window not
restored or set to focus
if IsIconic(hRunningApp) then
// First instance is minimized.. Restore it
ShowWindow(hRunningApp,SW_RESTORE);
BringWindowToTop(hRunningApp);
SetForegroundWindow(hRunningApp);
end;
------------------------ Yahoo! Groups Sponsor --------------------~-->
<font face=arial size=-1><a
href="http://us.ard.yahoo.com/SIG=12hhnl1sg/M=362335.6886445.7839731.1510227/D=groups/S=1705115362:TM/Y=YAHOO/EXP=1124379149/A=2894361/R=0/SIG=13jmebhbo/*http://www.networkforgood.org/topics/education/digitaldivide/?source=YAHOO&cmpgn=GRP&RTP=http://groups.yahoo.com/">In
low income neighborhoods, 84% do not own computers. At Network for Good, help
bridge the Digital Divide!</a>.</font>
--------------------------------------------------------------------~->
-----------------------------------------------------
Home page: http://groups.yahoo.com/group/delphi-en/
To unsubscribe: [EMAIL PROTECTED]
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/delphi-en/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/