Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

EXE cannot open file

Status
Not open for further replies.

TheGov

IS-IT--Management
Jan 25, 2002
18
GB
I hve just compiled my first project, and when I run the EXE, I get an error 'cannot open file', and my main form does not open. The exe runs ok from vfp, so I can't use the debugger to find out which file it can't open. I have both of the required .dll files in the WINNT/System32 folder, and all project files are on my local hard drive in the same folders as when the app was developed. I have checked that all data paths are correct, and I have even tried changing all file references to the full path. It is not a very big app, with only a couple forms a tables.

Any one have any ideas?

Pete
 
Hi Mike,

That was a quick response!

My main prog only sets a whole load of environment variables, loads the main form with DO FORM, does READ EVENTS and has a Procedure for shutdown.

Pete
 
TheGov

Does your main form have anything in the load or the init that is trying to access a file (or a table), that is either not in the path, or that the user's access is restricted?
Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first or check this link
 
Pete,
It sounds like you are just trying to run the .EXE from a shortcut on the development system, therefore I won't ask the regular "Did you use the Setup Wizard (VFP 5/6) or ISE (VFP 7.0) to create the setup files for .EXE on this workstation?" question.

Did you include any of your data files in the Project, so they are now readonly?

Alternately, did you forget to include any classes in the project?

Rick
 
Mike,

The main form only has one very simple option group, and only 2 buttons are enabled (this is phase one of an ongoing development). One button sets a global variable and then loads another form, the other one exits. It is not a rights issue, this is running on my development workstation, of which I am the administrator, and besides, the exe works when I open it up from within vfp.

Rick,

I left the included files/classes at whatever the default is, and I understood it does not include tables as default. Besides, the program does not get as far as opening tables, it doesn't even open the main form with just option buttons on it.

Pete

 
I left the included files/classes at whatever the default is, and I understood it does not include tables as default. Besides, the program does not get as far as opening tables, it doesn't even open the main form with just option buttons on it.

Still sounds like Rick suggests, something is being compiled in the exe that shouldn't.
Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first or check this link
 
Pete,
In the Dev Environment where the application works, do:
?FULLPATH(SET("default"))
?SET("path")
Then make sure you use these same values for DEFAULT and PATH in the CONFIG.FPW you point the shortcut at. Note: There are a number of SET values that are different between the Dev Env and the Runitme. It's always a good idea to set them explicitly to what you expect them to be in the main program and in any forms you run with private data sessions.

Rick
 
Also, check your setting of "SET EXCLUSIVE". If EXCLUSIVE is on, you won't be able to open the file. Make sure that the path to the data is included when the EXE is run.
 
Some generic things to try:

1. Use the wizard and build a network deployment. Make sure you have in your directory everything that the wizard includes.

2. Because of the rising number of nasty viruses that have come on the scene a number of virus checkers have begun flagging certain directories as "system" directories (windows, system32 etc.). Oddly enough this includes the directories defined by your windows temp environment variable. When foxpro launches it immediately tries to create temporary work files. I think the order is whatever is in the config.fpw first, start in directory second and location defined in temp variable third. Foxpro will note whether a directory is a system directory as Microsoft says "by design" it will not create a file there. If it cannot generate the work files. It will generate the message you describe.

something to try:

-create an icon on your desktop
-point the target at your executable
-point the startin at the directory where all
your stuff is
-check to make sure your startin directory is
not flagged as a system directory
you can use explorer or the attrib (directory name) dos command
- if the system attribute is set you can change it through dos by typing attrib <directory> -s

good luck
 
Thanks for all your help.

Armed with all this advice and large amounts of coffee, I found the problem at 2:00am!

Having followed the instructions in Microsoft's Visual Foxpro 6.0 Programmer's guide for compiling an application, I used shift OK in the options screen, and copied the results to my main prog to set up all the environment variables. 2 of these variables were pointing to directories in MSDN that didn't exist!

I should have known that Microsoft would not know how to use their own software!

Pete
 
TheGov,
I am also encountering the same pronlem which you had faced.
Caould you kindly tell me the steps in detail how you have fixed the problem?
I need it urgently.
Thanks in advance.

Francit
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top