Sys(2340)

This function, added in VFP 7, is useful only for Visual FoxPro COM servers that are run as Windows NT services. It allows your server to intercept the logoff message sent by Windows, and specifies whether to ignore the message and continue running, or to shut down.

Usage

cValue = SYS( 2340, nOption ) 

Parameter

Value

Meaning

nOption

Omitted

Return the current value.

0

Respond to a logoff message by shutting down.

1

Ignore logoff messages and continue running.

cValue

Character

A character representation of the numeric value passed to the function.


The average developer isn't likely to use this function. If you write a COM object that then runs as an NT service, you can determine whether your COM object shuts down when a user logs off—meaning that it responds to the WM_QUERYENDSESSION and WM_ENDSESSION messages. Of course, if a shutdown message is received, your service will have to shut down—it's hard to keep running on a computer that isn't.If you are a developer attempting to write your own Windows NT service in VFP, this function is not the panacea that makes it work. Yes, we're sure. And no, we really don't have any idea how to make your VFP program an NT service—we've never successfully written one (but most of us haven't tried, either). We'd love to point you to a good resource, but we haven't found any documentation on making your VFP program an NT service, though you might try looking for articles in the usual VFP hangouts on the Internet.

Example

* To ignore the WM_QUERYENDSESSION and WM_ENDSESSION messages,
* issue the following:
cValue = SYS(2340, 1)

See Also

Build DLL, Build MTDLL, Sys() Functions


Back to Table of Contents

Copyright © 2002-2018 by Tamar E. Granor, Ted Roche, Doug Hennig, and Della Martin. Click for license .