LIST DATABASE

Sys(2335)

This function gives us the ability to turn off the dialog boxes that hang our EXE servers, so that we can trap problems with the error handler instead.

Usage

nSetting = SYS(2335 [, nNewSetting ] )

Parameter

Value

Meaning

nNewSetting

Omitted

Returns the current setting of SYS(2335), in VFP runtime only. In the development environment, returns the empty string.

0

Unattended mode. If a dialog attempts to force your EXE into a modal condition, an error (number 2031, "User Interface operation not allowed at this time") is generated instead.

1

Normal mode. This is the default, where dialogs can interrupt the operation of your application.

nSetting

Empty String

Returned in development mode.

"0" or "1"

Returns the current mode of the EXE—not the previous mode, but the mode after the SYS() function has been executed.


Ted once wrote a Remote Automation server, and had lots of problems trying to figure out why the process kept hanging after some modifications to the code. It turned out, if you watched the task bar while starting the server, a task named "Open" would appear, but there was no way to activate that task, no way to bring it forward, nothing to do but halt the task. Finally, after some detailed code review, the line SET HELP TO was found, which of course does not set help off, but rather tries to set help to the FoxHelp file. Since this was a production machine with no such file, a friendly FoxPro locate dialog would appear. However, since this was a Remote Automation server, it had no interface. Hang city.

SYS(2335) allows us to avoid all that trouble. If you are developing COM EXEs and want to make sure they don't attempt to create a dialog, hanging your server, set SYS(2335) as soon as possible in the code that starts your server.

SYS(2335) reports that a DLL starts out in mode 1, but that is incorrect. An attempt to start a dialog within an in-process DLL always fires an error 2031. We think SYS(2335) should report that you are in unattended mode. Instead, you need to check both this function and the StartMode property to determine if your application has started as an EXE or DLL.


Example

lnOldMode = SYS(2335)  && preserve the old mode lnNewMode = SYS(2335,0)  && and set it as desired.

See Also

Error Event, On Error, StartMode


View Updates

Copyright © 2002 by Tamar E. Granor, Ted Roche, Doug Hennig, and Della Martin. All Rights Reserved.



Hacker's Guide to Visual FoxPro 7. 0
Hackers Guide to Visual FoxPro 7.0
ISBN: 1930919220
EAN: 2147483647
Year: 2001
Pages: 899

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net