Enables or disables modal states for distributable Visual FoxPro .exe automation servers.
Parameters
- 0
-
Enables unattended mode. When unattended mode is enabled, a Visual FoxPro error is generated whenever a modal state occurs. Your .exe automation server can trap for these errors with an ON ERROR routine.
- 1
-
(Default) Disables unattended mode. Modal states, which require user intervention, can occur. Unattended mode is disabled at startup.
Return Value
Remarks
Example
The following example allows you to run several test cases to show the results of SYS(2335) settings in an application that invokes modal user interface elements.
| | Copy Code |
|---|
CLEAR
SET SAFETY OFF
DIMENSION aTestCase[3]
aTestCase[1]="TestMessageBox"
aTestCase[2]="LocateFileDialog"
aTestCase[3]="SafetyDialog"
TEXT TO cstr TEXTMERGE
PROCEDURE Temp(UIMode as string,cTestCase as string)
* command line parms are strings
SYS(2335,VAL(UIMode)) && allow or disallow UI
SET SAFETY OFF
TRY
_screen.Caption="UIMode = "+UIMode+" "+cTestCase+" Startmode="+TRANSFORM(_vfp.StartMode)
DO CASE
CASE cTestCase="<<aTestCase[1]>>"
MESSAGEBOX("UI is allowed. UIMode = "+UIMode,0, cTestCase)
CASE cTestCase="<<aTestCase[2]>>"
*Try this scenario which will bring up a dialog
SELECT * FROM NonExistFile
CASE cTestCase="<<aTestCase[3]>>"
*Cause "Overwrite existing file dialog to appear"
SET SAFETY ON
CREATE TABLE temp (name c(10),data m)
CREATE TABLE temp (name c(10),data m) && Create table again to cause Overwrite dialog?
OTHERWISE
MESSAGEBOX("Unknown test case. UIMode = "+UIMode+" "+cTestCase)
ENDCASE
CATCH TO oEx
SYS(2335,1) && Allow UI
MESSAGEBOX("Err caught UIMode = "+UIMode+":"+oEx.Message + " " +oEx.details,48,"Exception "+cTestCase)
ENDTRY
ENDTEXT
STRTOFILE(cstr,"temp.prg")
BUILD PROJECT temp FROM temp
BUILD EXE temp FROM temp
FOR nTestCase=1 TO ALEN(aTestCase)
FOR uiMode=1 TO 0 STEP -1
?"UIMode=",uiMode,aTestCase[nTestCase]
cCmd="temp "+TRANSFORM(uiMode)+" "+aTestCase[nTestCase]
! &cCmd
ENDFOR
EXIT && comment this to run the other test cases
ENDFOR
|
See Also