Thanks for the code, I'm currently using firstinstance.prg and that seems to be ok.
Kev
>I found this somewhere (don't remember where). It's small and works great. Basically, set the caption of _screen in your app and check for it:
>
>IF CheckWin('My Application')
> MESSAGEBOX('Application is already running.'+CHR(13);
> +'Please check your taskbar for the app'+CHR(13);
> +'and click on its button to maximize it.' ,48,'Application is already running!')
> RETURN .F.
>ENDIF
>*--Remember to set the caption in your app AFTER you check for it using checkwin
>*--or it will see itself running and checkwin will return positive
>_screen.caption="My Application"
>
>FUNCTION CheckWin
>* Routine which sees if an application is active by looking for its
>* Window title
>* expC1 Window title
>PARAMETER tcTitle
>DECLARE INTEGER FindWindow in Win32API as FindWindow STRING, STRING
>RETURN IIF(FindWindow(0,tcTitle)>0,.T.,.F.)
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only