Microsoft KB Archive/105837
How to Use XCMDs and XFCNs in FoxPro for Macintosh
The information in this article applies to:
In FoxPro for Macintosh, you can load and call external commands (XCMDs) and external functions (XFCNs) by using the following command, which has been added to the FoxPro language to support the use of these external code resources:
SET XCMDFILE TO <filename>
To use XCMDs and XFCNs in FoxBASE+ for the Macintosh, you have to put XCMDs and XFCNs in the resource fork of the FOXUSER file, issue the SET RESOURCE TO <file> command, and then load and call the command or function.
To take advantage of XCMDs and XFCNs in your FoxPro for Macintosh applications, do the following:
1. Use a resource editor such as ResEdit to copy resources of type XCMD and
XFCN into the resource fork of the FoxPro application or the FoxPro resource file. ResEdit is available through the Apple Programmer's and Developers Association (APDA).
2. In the Command window, issue the following sequence of commands to
execute an XCMD. For the purposes of this article, assume an XCMD by the name of "XDISK" exists in the resource fork of the FoxPro for Macintosh application file. This hypothetical XCMD takes two parameters and returns a character expression that is the result of the command. * save the old XCMDFILE to a memory variable oldXCMDFile = SET("XCMDFILE",1) SET XCMDFILE TO "Apps:\FoxPro\MyResource" LOAD "XDISK" CALL "XDISK" WITH "ejec",1 TO ejectstatus && eject disk in drive 1 ? ejectstatus && print the value returned from the command noerr * return the name of the disk in drive 1 CALL "XDISK" WITH "name",1 TO namestatus * print the return value, which is the disk name or an error code ? namestatus My Hard Drive
Additional reference words: FoxMac 2.50b KBCategory: kbprg KBSubcategory:
Last Reviewed: May 17, 1996