How to Use XCMDs and XFCNs in FoxPro for Macintosh

Last reviewed: May 17, 1996
Article ID: Q105837
The information in this article applies to:
  • Microsoft FoxPro for Macintosh, version 2.5b

SUMMARY

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>

MORE INFORMATION

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:


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: May 17, 1996
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.