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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

FoxPro 9.0 - Build .exe 1

Status
Not open for further replies.

MajklPan

Programmer
Jan 11, 2023
74
CZ
Hi,
I don't know how to correctly create the installation file of the project, because if I create only an exe file (see picture) and replace it in the project, it no longer works correctly.
1_neotor.png


How should I create an installation file so that the user can just install the program and it works?

I tried this procedure and it doesn't work, I just keep getting a pjx file (picture 2)
2_jjm6gv.png

In FoxPro, you can create an installation file using the "Setup Wizard" or "Save As" tool.

1.Launch the FoxPro program.
2.From the main menu, select "File" and then "Save As".
3.Choose "Setup" as the file type.
4.Enter a name for the installation file and the location where you want to save it.
5.Click on the "Save" button and then the "Setup Wizard" window will appear or the saving process will begin.
In the Setup Wizard, click on the "Next" button and select the files that you want to include in the installation file.
6.Click on the "Next" button and set up the installation options, such as the target folder or installation preferences.
7.Click on the "Next" button and create informational pages that will be displayed during the installation.
8. Click on the "Finish" button to create the installation file.
Note: It's important that you have write access to the location where you want to save the installation file.

This guide explains how to create an installation file in FoxPro that includes all necessary files, settings, and instructions for installation.

thank you for the advice
 
Forget about the Setup Wizard. It is out of date and never really worked well.

Instead, use a dedicated installation program. The most popular such program (in the VFP world) is Inno Setup. Download a copy from their website (it's free). Then read the documentation on the site. It looks a bit daunting at first, but it works extremely well.

An alternative would be the version of InstallShield Express that comes with VFP 9.0. You can install it from the VFP CD. To a large extent, this version is tailored to work with VFP.

There's plenty of help on line for both programs, or come back here if you have any specific questions.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Cool, thanks for the advice and reply, I'll try to look into it.

I would also like to ask, if I run the program in FoxPro, it works as I need, but if I only create an exe file (as I stated in picture number 1), then everything I need in the program no longer works.

you don't know what it could be? It would be enough for me to just create an .exe file and run it.
I am sending the project in the attachment for a better idea.

In the picture "Add new record" and then the "back" button works in FoxPro, when the .exe file is created and run, the program no longer works.
Note: When starting, you need to choose the path to the "Cduseky_v1.2" file, which is also in the zip.
1_pmjubs.png

Thank you very much for your help, it is important for me to get it working properly and to be able to share it with colleagues.
 
 https://files.engineering.com/getfile.aspx?folder=d0d0790b-40e6-46f4-9a6a-1d82ccd6840b&file=GPT_tisk_sestav.zip
I do this because first I have to create the correct .exe file for it to work for me and then I can create the installation file.
Unfortunately, after creating the .exe file, everything doesn't work properly for me and I don't know why.
 
I'm sorry, but I can't tell you why your program doesn't work. I would have to actually run the program and try to reproduce the problem, but I don't have enough information to do that. I see that you have uploaded the project file. Other people here might be willing to download and to try to debug it, but I'm not prepared to do that.

Also, I think you have two separate problems here. Re the question of the Setup Wizard, InstallShield, etc. This is necessary if you want to distribute your program to other users (who do not have VFP installed). These users will need to have copies of several runtime components, all of which need to be installed in specific directories and some of which need to be registered. That is what the Setup program does.

But if you are running the EXE on your own computer (the one you use to develop the application), none of that is necessary, as all the required components will already be present.

But that is separate from the second problem. If I have understood this right, you are saying that the program works correctly if run from within the IDE, but not if run as a stand-alone EXE on the same machine. There are several possible reasons for that, but without either examining the code or reproducing the problem, I have now way of knowing which one applies in this case.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
It is OK. Anyway, thanks for the reply. [smile2]
Exactly as you write, the program works correctly if run from within the IDE, but not if run as a stand-alone EXE on the same machine.

I always create the .exe file the same way, but I can't figure out why it doesn't work properly as an .exe file when it works properly in the IDE. Most likely the problem is somewhere in the compilation of the file, but I've been sitting on it for two days and still can't figure it out.
2_zdganf.png
 
The differences an EXE can have over running the main program in the IDE are manifold and can have to do with pathing, wrong setting of inclusion vs exclusion from the EXE and many more things.

From what you say I assume you think there is a build problem, a compilation failure or anything like that that makes the EXE fail. No, all code can compile perfectly and as you have ticked "Display error" and don't get errors showing in the build process, the problem is not code failing to build a correct executable.

As Mike already said it's hard work to find out what's to be done, it takes debugging sessions that could need long time and nobody here can be asked to do that of not voluntarily having the time to get into it.

It can be important to SET DEFAULT into the directory of the pjx or some subdirectory depending on how the project source code is organized regaring includes and relative paths, that make compiling from the wrong directory fail. And that's just one of many problems you could get into. Is it actually your own or did you inherit this or is it source code from a customer needing an improvement. Is there any project documentation in that case?

Chriss
 
I understand, thank you for explaining, it just seemed to me that it couldn't be that difficult to solve, since when it works in the IDE, why doesn't the .exe file work even after compilation. I thought maybe I had to tick something or change something so that the .exe file behaves the same way as in the IDE.
Yes, the program was historically created by a colleague who no longer works with us and I am a complete novice in FOXPro, I program in C# and C++ and I am currently developing this program in another environment, but I need it to still work, so I am looking for a solution somewhere, who could help me with this and is still interested in these databases.
Thank you for your help
 
The simplest thing you could try is compile the project on the computer of your former collegue, because he might have copied some part of the VFP installation folder elsewhere. The form you show seems to be done with the form or even the application wizard of VFP and uses some classes from within the VFP installation folder - HOME().

And such things can be problematic as the installation folder usually is reeadonly and code you compile, especially with the recompile all option, would cause VFP to write into the system directory of program files, which is not allowed, usually.

IIRC in XP VFP was installed so that the users in the usergroup "computer main users" could write into HOME(), and that was before Windows UAC - user access control - was introduced.

There could be the root of your problem: No write access in HOME() and all subdirectories.

Chriss
 
It's been a long time since this program was created. I was wondering what could be placed in the "HOME" folder but I couldn't find anything that would be needed to compile.
How did you try it, did it also work in the IDE?
Thanks for the advice
 
I see. I also tried it as an administrator and also with no result. It is interesting that the other elements work, only this part does not work properly.
 
Could we just clarify one point:

On the machine(s) where the EXE doesn't work, is that always the same machine where it DOES work in the IDE? Or does the failure occur on some or all of the end-users' computers as well?

If it is the former case, it might be worth trying to build the program as an APP rather than an EXE. You would then run the APP from within the IDE (using either the DO command or from the Program menu). I'm not saying that would necessarily solve the problem, but it might help to narrow things down.

Unfortunately, that won't be an option on the end users' systems, as APPs always need the development environment.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Running as an admin doesn't solve the problem of write access, UAC still redirects. You need to give yourself write permission into the directory HOME() shows.

Chriss
 
Yes exactly. Same computer.
Anyway, I'll try elsewhere.

The end user installs this program, if I change something, I just copy the .exe file to them. They don't own FoxPro 9.0 so they wouldn't be able to open it.
 
That's not quite right. If they don't have FoxPro installed, they should still be able to run the EXE (assuming your setup program correctly installs the required runtime files). It is the APP which requires VFP to be installed.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Yes, it works for previous versions. I wouldn't look for the problem there, rather I still don't understand why the .exe file doesn't behave the same as in the IDE. I also create an .exe file for other applications that we use and I have no problem there.
 
I found out that probably only two buttons, which I described above in the picture, do not work for me and that is "Add new record" and the program stops working, so there is probably a problem somewhere.
 
Is error handling established? If a button doesn't work, does it really just do nothing, or is there a message? If you have no error handling (ON ERROR ...) you get system error handling, which tells an error, but not where it happens, and - inappropriately - gives the user "Ignore" as one of the buttons to react, which makes it seem unimportant.

Anything that's not working correctly must be reported and addressed, if you really have just no reaction from the buttons, neither an error message nor does anything the button usallly should do, then that's hard to analyze and fix.

Because pathing may be an issue, it helps to know if that's set the same in IDE and EXE. To detect that you could add a menu item or button which tells you the default path by doing MESSAGEBOX(Sys(5)+Sys(2003)).

Chriss
 
Introduction of errors, I did not find there.
When you press the button "New record" (picture, number 1 red), the button changes to "Save record" and next to "return" (picture, number 2 blue) at this moment the program in the .exe file no longer works. The program behaves as if it is still functional, it does not even stop responding, these two buttons do not respond, but they can be clicked. In the IDE this works.


3_enqa2m.png


I added the Messagebox to the source code, the path is always the same, both in the IDE and after creating the .exe file.
4_d5bnky.png

Code:
*I press the add button
ELSE	&& click on new "new"
	this.Picture=LOWER(cCestaProgramu)+"\images\uloz.bmp"
	this.ToolTipText="Save new record"
	MESSAGEBOX(SYS(5)+SYS(2003))
	this.parent.cmdEdit.Picture=LOWER(cCestaProgramu)+"\images\krokzpet.bmp"
	this.parent.cmdEdit.ToolTipText="Vrátit záznam"
	RecPoz=RECNO()
	APPEND BLANK					&& we will add a record
	thisform.grid1.SetFocus 
	*thisform.grid1.Refresh 
	*thisform.Refresh()
*	RecPoz=RECNO()
	thisform.Tlacitka.SetAll ("enabled",.F.,"Commandbutton")
	this.parent.cmdEdit.Enabled=.T.
	this.Enabled= .T.
	thisform.combo1.Enabled=.T.
	thisform.combo2.Enabled=.F.
	thisform.command1.Enabled=.F.
	thisform.command2.Enabled=.F.
	thisform.command3.Enabled=.F.
	thisform.combo1.SetFocus	&& sets the cursor to the first field to be filled
	thisform.SetAll ("enabled",.F.,"Textbox")
ENDIF
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top