PRB: Application Wizard EXE or APP Gives Path or File Error (168058)
The information in this article applies to:
- Microsoft Visual FoxPro for Windows 5.0
- Microsoft Visual FoxPro for Windows 5.0a
This article was previously published under Q168058 SYMPTOMS
If an EXE or APP built from a project created by the Application Wizard is
run from a directory on a drive that does not contain the home directory of
the application project and source files, one or more of the following
errors will occur:
"Invalid path or file name"
"File "<path to app or exe>\<appname>.mpr" not found"
CAUSE
The application home directory is hard-coded into the project's main
program, and the wzApplication.DoMenu method contains a check for the
existence of the .MPR file, while the EXE or APP only contains the compiled
MPX code.
RESOLUTIONInvalid Path or File name- To alleviate the "Invalid path or file name" error, open the main
program in the project created by the Application Wizard. The main
program will have the same name as the project name and is located in
the "<application directory name>\Progs" directory. It will also appear
in bold in the Project Manager's Code tab under the Programs heading.
Replace the line:
CD "<path\directory containing app>"
with the following:
* Are we running from a PRG (FXP)? If so, strip off all after the
* last 2 "\" characters else strip all after the last "\" character
CD (SUBSTR(SYS(16,0),1,RAT('\',SYS(16,0), ;
IIF(".FXP"$SYS(16,0),2,1))-1))
- In the WZApplication.DoMenu method located in the class library
\VFP\wizards\appwiz.vcx, the following code is used to verify the
existence and then call menus used within the application:
LPARAMETERS tcFileName
LOCAL lcFileName
lcFileName=ALLTRIM(tcFileName)
IF EMPTY(lcFileName)
RETURN .F.
ENDIF
lcFileName=LOWER(FULLPATH(lcFileName))
IF NOT "."$lcFileName
lcFileName=lcFileName+".mpr"
ENDIF
IF NOT FILE(lcFileName)
this.FileNotFoundMsgBox(lcFileName)
RETURN .F.
ENDIF
DO (lcFileName)
File <path and mpr name> Not Found
To alleviate the "File <path and mpr name> not found" error, change the
line:
lcFileName=lcFileName+".mpr"
to:
* Since the lowest level program is an FXP, we are not in an APP or EXE,
* so it is OK to look for MPR since we know source code is available.
* Otherwise look for MPX contained in APP or EXE
lcFileName = lcFileName+ iif(".FXP"$sys(16,0),".mpr", ".mpx")
STATUS
Microsoft is researching this problem and will post new information here in
the Microsoft Knowledge Base as it becomes available.
Modification Type: | Major | Last Reviewed: | 8/20/1999 |
---|
Keywords: | KB168058 |
---|
|