Hi,
In order to prevent a from from running twice I am using the following code. It works perfectly but what I need is how to make this started form active knowing its name?
llRetVal = .T.
i = 0
lcWindName = WCHILD("",0) && The "" must be a NULL or empty string
* Loop through all open forms, and see if we have any that have the same
* name as the one you want to open. (It exists in INIT() but is not yet
* available.)
DO WHILE !EMPTY(lcWindName)
IF lcWindName = UPPER(this.name)
i = i + 1
IF i > 1
llRetVal = .F.
EXIT
ENDIF
ENDIF
lcWindName = WCHILD("",1) && The "" must be a NULL or empty string
ENDDO
IF !llRetVal
MESSAGEBOX("Form Already Started")
???? Here I should set WindowState to 0 if this form was minimized???? How?
???? and I should Activate this form if not active???? How?
RETURN llRetVal && will return .F. preventing the form from re-running.
ENDIF
* continue loading the form as it is the first time.
Please help.
Khalil Shaddad (Lebanon)