485
edits
mNo edit summary |
|||
Line 77: | Line 77: | ||
// If so, it activates the running application and closes this one. | // If so, it activates the running application and closes this one. | ||
Procedure DoCheckProgramActive | Procedure DoCheckProgramActive | ||
String sTitle | |||
Handle hWnd | |||
Integer iVoid | |||
Register_Object Main | |||
Get Label of Main to sTitle | |||
Move (FindWindow("",sTitle)) to hWnd | |||
If (hWnd) Begin | |||
Send Stop_Box (sTitle + " Already is Running and Can only be Started Once.") "Error:" | |||
Move (ShowWindow(hWnd,SW_MAXIMIZE)) to iVoid // 9 =SW_RESTORE SW_NORMAL | |||
Move (SetForegroundWindow(hWnd)) to iVoid | |||
Abort | |||
End | |||
End_Procedure // DoCheckProgramActive | |||
// End_Construct_Object | |||
Procedure End_Construct_Object | |||
Send DoCheckProgramActive | |||
Forward Send End_Construct_Object | |||
End_Procedure // End_Construct_Object | |||
End_class | |||
The FindWindow technique is also discussed in the book "Mastering Visual DataFlex" from Starzen. | |||