Microsoft KB Archive/133358

{| = PRB:Feature Not Available Error If EXE Uses Macro Substitution =
 * width="100%"|

ID: Q133358

2.50 2.50a 2.50b 2.60 2.60a MS-DOS

kbprb The information in this article applies to:
 * Microsoft FoxPro for MS-DOS, versions 2.5, 2.5a, 2.5b, 2.6, 2.6a

SYMPTOMS
When running a stand-alone EXE (regular or extended) and executing a line of code that uses macro substitution to reference a command verb, a "Feature Not Available" error is encountered.

CAUSE
When FoxPro creates a stand-alone executable file, the project files are scanned for FoxPro commands. The interpretations for these commands are then built into the executable. However, if macro substitution is used to directly reference a command verb, FoxPro does not evaluate the literal text stored to the variable as a FoxPro command. Thus, the interpretation for that command verb is not built into a FoxPro stand-alone executable.

RESOLUTION
Here are four techniques you can use to avoid the problem:

 Use macro substitution in a command expression instead of in a line of code. If you use macro substitution in an expression, there is no reference to the command verb, so the "Feature Not Available" error is avoided. -or- Use a macro-substituted reference to a command verb if there is a non-macro substituted reference to that command verb within the project. -or- Within a dummy program that never gets called (or within a dummy procedure that never gets called within an existing program), include a non-macro substituted reference to the subject command verb. -or- Use this last-resort technique. It is extreme and should be reserved for use by a developer who is unable to determine which command verb is resulting in a conflict. Incorporate the Prowords.fxd document (located in the FoxPro root directory) into the Project as a Program. This contains a reference to all of the FoxPro command verbs, so it will cause the size of the stand-alone .EXE file to grow beyond what it might otherwise be. It is strongly suggested that this option be avoided if at all possible. If you use this technique, note that during the Build EXE process, you'll see many errors associated with the Prowords.fxd file; ignore them.

See examples for the first two of these techniques are shows in the "More Information" section of this article.

STATUS
This behavior is by design.

MORE INFORMATION
It is possible to avoid problems associated with the use of macro- substituted references to command verbs without taking any direct action to avoid it. But, in these cases, one of the following has occurred:

 The developer has used a non-Macro-Substituted reference to that command at some place within their Project. -or- While building the .EXE file, the compiler incorporates command translations in blocks (or clusters). In other words, when you build an .EXE file that contains a SET command, the block that contains the' translation for the SET command is added to the .EXE file. But this block also contains the translation for other commands. So, if you happen to add a macro-substituted reference to a command that has already had its translation built in when the translation for the SET command was build in, then no problem is encountered. This is the one scenario where a "Feature Not Available" error can be avoided for a particular command verb even though a non-macro-substituted reference to it does not exist.

Steps to Reproduce Behavior
The following example uses the SET command to demonstrate this behavior:

1. Create a program (for the sake of example, call it Test) that contains

this code:

a="SET " && The space between SET and the closing quote is needed b="COLOR TO GR+/R" &a&b            && "a" is the command verb, "b" is the command clause CLEAR WAIT 2. Add the Test program to a new project and build a stand-alone .EXE file. 3. Run the .EXE file independent of FoxPro to see the "Feature Not

Available" error display.

Example Resolution - Using an Expression
This example demonstrates how to use macro substitution in a command expression instead of in a line of code. If you use macro substitution in an expression, there is no reference to the command verb, so the "Feature Not Available" error is avoided.

1. Modify the Test program so that it contains this code:

b="COLOR TO GR+/R" SET &b          && The command verb SET is not macro substituted CLEAR WAIT 2. Save the changes to the Project, rebuild the .EXE file, and run it  independent of FoxPro. In this case, you are still using macro substitution to reference a portion of the command expression, but not the SET command verb. You should see the screen background color change to red, and the wait message pen color appear as yellow. Because the SET command verb has not been macro- substituted, the translation is built into the .EXE file.

Example Resolution - Reference that Command Verb Elsewhere in the Code
This example shows that you can use a macro-substituted reference to a command verb if there is a non-macro-substituted reference to that command verb within the project.

1. Modify the Test program so that it contains this code:

SET TALK OFF a="SET "  && The space between SET and the closing quote is needed b="COLOR TO GR+/R" &a&b CLEAR WAIT 2. Save the changes to the Project, rebuild the .EXE file, and run it  independent of FoxPro. 3. Again, you have used a non-Macro-Substituted reference to the SET command, so the translation is built into the .EXE files. Additional reference words: FoxDos 2.50 2.50a 2.50b 2.60 2.60a KBCategory: kbprb KBSubcategory: FxprgMacrosub Keywords         : kbcode FxprgMacrosub Version          : 2.50 2.50a 2.50b 2.60 2.60a Platform         : MS-DOS
 * }