If you pass to this function a not defined FormName, run-time error occurs.h_windows.prg wrote:Code: Select all
*-----------------------------------------------------------------------------* Function GetFormHandle (FormName) *-----------------------------------------------------------------------------* Local mVar , i mVar := '_' + FormName i:=&mVar if i == 0 Return 0 endif Return ( _HMG_SYSDATA [ 67 ] [ &mVar ] )
You can to avoid run-time error by a little improving the function. For example:
Code: Select all
Function GetFormHandle (FormName)
LOCAL mVar := '_' + FormName
IF (Type(mVar) == "N") .and. (&mVar > 0)
RETURN ( _HMG_SYSDATA [ 67 ] [ &mVar ] )
ENDIF
RETURN 0
GetWindowType(FormName)
GetFormName(FormName)
GetFormToolTipHandle(FormName)
GetMenuToolTipHandle(FormName)
GetFormIndex(FormName)
GetControlIndex(ControlName, ParentForm)
GetControlName(ControlName, ParentForm)
GetControlHandle(ControlName, ParentForm)
GetControlContainerHandle(ControlName, ParentForm)
GetControlParentHandle(ControlName, ParentForm)
GetControlId(ControlName, ParentForm)
GetControlType(ControlName, ParentForm)
GetControlValue(ControlName, ParentForm)
GetControlPageMap(ControlName, ParentForm)
_GetControlRow(ControlName, ParentForm)
_GetControlCol(ControlName, ParentForm)
_GetControlWidth(ControlName, ParentForm)
_GetControlHeight(ControlName, ParentForm)
_GetControlObject(ControlName, ParentForm)
_PlayPlayer(ControlName, ParentForm)
_StopPlayer(ControlName, ParentForm)
_ClosePlayer(ControlName, ParentForm)
_DestroyPlayer(ControlName, ParentForm)
_EjectPlayer(ControlName, ParentForm)
...