Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Is the application already running
Message
 
To
09/10/2002 04:24:09
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00709151
Message ID:
00709152
Views:
30
Try this function. You must pass part or whole caption of Your application as a parameter.


FUNCTION IsRunning(cCaption)
LOCAL hNext, cText
DECLARE INTEGER GetActiveWindow IN Win32API
DECLARE INTEGER GetWindow IN Win32API INTEGER hWnd, INTEGER nType
DECLARE INTEGER GetWindowText IN Win32API INTEGER hWnd, STRING @cText, INTEGER nType
hNext = GetActiveWindow()
DO WHILE hNext # 0
cText = REPLICATE(CHR(0), 80)
GetWindowText(hNext, @cText, 80)
IF UPPER(cCaption) $ cText
RETURN .t.
ENDIF
hNext = GetWindow(hNext, 2)
ENDDO

RETURN .f.
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform