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!

ERROR BUILDING .EXE 1

Status
Not open for further replies.
I think you tested the app and still have your menu up and running while you try to build.

When you build an EXE, menus (in the form of a table with file extensions mnx/mnt) are turned into PRGs (MPR file extension, mean Menu PRogram). This happens with any build, so already existing MPRs are overwritten. But that can't be done, when the menu is currently active. Just btw. build is using exactly what the menu item "Generate..." does when you design a menu, using the GenMenu tool.

So just restart VFP, build as first step and it'll work. It's always a good idea to restart VFP before building an EXE as all settings are at defaults and no classes, forms, menus, etc. are loaded into memory.

The only step maybe necessary before build is CD into a base path.

Bye, Olaf.



Olaf Doschke Software Engineering
 
Hi Olaf Doschke,

Already did that several times (unless im doing it wrong). Even my computer has been restarted. Then have done the following freshly

open foxpro
in command window, set the path

Code:
SET DEFAULT TO c:\tutorial\lesson5
SET PATH TO data;forms;reports;prgs;menus

then open the project
then build.

still having the that error. [sad]
that's all i did. Anything i missed? (removing my shortcuts.mpr will make the build to proceed)

also, just want to ask.. (food for thought), is there really such thing as corrupted program? meaning, since corrupted it cannot be fixed. need to restore. Or, corrupted in a sense that theres just an error somewhere but actually it can be fixed but comes out very hard to trace or will takes so long to fix. (this is nothing,. i just want to ask)
 
PRG is impossible to get corrupt unnoticeable, ie when you look into the PRG and the code is fine, that's it, there's no hidden portion. The other file of a PRG, the FRX is the compiled code and it's overwritten. (in case of menus MPR and MPX).

The error is not about the MPR being corrupt but irreplaceable. If it's not because it's running, then perhaps you made it readonly somehow (file attributes)? Or the MPX?

If removing an MPR helps, then that's at least a temporary solution. Is the MPR existing again after the build? Do you maybe have two menus named the same in different folders?

Besides that you should not need any SET PATH during build. It's just inviting to find files not belonging to the project, just with same name as something already really in the PJX.

You may get an essential detail when you start the debugger and have the debugouutput window open before you build. I think in this case it'ää just show it's trying to create the MPR when the build error pops up, so nothing you don't already know.

Bye, Olaf.

Olaf Doschke Software Engineering
 
If it's not because it's running, then perhaps you made it readonly somehow (file attributes)? Or the MPX?

- i will try to figure this out.

If removing an MPR helps, then that's at least a temporary solution. Is the MPR existing again after the build?

- i can't answer coz even though the build proceed, upon running the exe, this error shows "STANDARD" NOT DEFINE. maybe this is related to the code in my main.prg shown below
Code:
** setup the application environment
_screen.WindowState= 2
_screen.Caption= "Printshop Limited v1.0"
_screen.BackColor= RGB(125,128,128)
_screen.Picture = 'C:\TUTORIAL\LESSON5\Z. WALLPAPER\DOWNLOAD-DESKTOP-TIGREAL-FALLEN-GUARD-WALLPAPER.JPG'




ON SHUTDOWN DO cleanup IN MAIN.PRG
SET TALK OFF
SET DELETED ON
SET EXCLUSIVE OFF
SET DATE TO MDY
SET STATUS BAR ON


CLEAR
CLEAR ALL
CLOSE ALL

SET DEFAULT TO c:\tutorial\lesson5
SET PATH TO data;forms;reports;prgs;menus

** turn off the toolbar
HIDE WINDOW standard

** setup menus
DO MAINMENU.MPR
SET MARK OF BAR 10 OF _MVIEW TO .T.
** call login form

** start the READ EVENT
READ EVENT


** clean up
CLEAR
_screen.BackColor=RGB(255,255,255)
SET SYSMENU TO DEFAULT
SHOW WINDOW standard
ON SHUTDOWN


PROCEDURE Cleanup
	CLEAR EVENTS	&& stop event processing
	
	** close all open forms before exiting
	FOR x=1 TO _screen.formcount
		_screen.forms(_screen.formcount).release()
	NEXT x
	
ENDPROC

Do you maybe have two menus named the same in different folders?

- no i don't
 
Do you maybe have two menus named the same in different folders?

FOUND IT!!!! my bad!!!

though its not in different folder, i put that shortcut.mpr under PROGRAM and the other one is under MENUS

Though not exactly, you give me the idea how to the error works and found it!!

last i need to resolve is the last error. after exe build.

"STANDARD" not define

is it because of the
HIDE WINDOW STANDARD
SHOW WINDOW STANDARD?
 
Don't know what line errors? Have some error handling at least

Code:
ON ERROR MESSSAGEBOX(Textmerge("<<ERROR()>> <<MESSAGE()>> <<LINENO()>>"))

It is likely SHOW WINDOW standard, what else refers to something "standard"?

Also look into the help topic "SHOW WINDOW".

I bet you meant DO FORM standard.scx. Because SHOW WINDOW needs a defined window, that has to come before showing it or it has to be a predefined window. And some predefined windows only exist in the IDE, not at runtimne. The standard toolbar isn't available in an EXE.

Bye, Olaf

Olaf Doschke Software Engineering
 
I just follow the code from youtube tutorial. He doesnt proceed upto building exe but i follow exacly what he puts.


But i try to remove
HIDE WINDOW STANDARD and
SHOW WINDOW STANDARD

then my exe works perfectly :)

Thanks pal.. i learned a lot.
 
Watched part of this part of the tutorual. This is really an error, as you see for yourself. I guess he'll also remove this code about the standard toolbar in a later part of the tutorial, as he'll also experience that toolbar doesn't exist in the runtime. So it might be worth going along the whole series or look for downloads of the sources final version.

When you don't include config.fpw with an option about SCREEN the runtime also shows the _SCREEN window (the main window of the VFP IDE), but a) without any toolbar and without the sysmenu, as those are all about the IDE and IDE features not allowed to redistribute (see redist.txt in the VFP Home folder). You only can get a menu similar to the sysmenu at runtime when you use the Quick Menu in the menu designer. And there some menu items also don't work at runtime as they start tools of the IDE not present in the runtime DLL.

Bye, Olaf.

Olaf Doschke Software Engineering
 
Hi Olaf Doschke,

where should i place my code here?
Code:
ON ERROR MESSSAGEBOX(Textmerge("<<ERROR()>> <<MESSAGE()>> <<LINENO()>>"))

should this comes after or before my codes?




 
Given that the purpose of the message box is to help you diagnose a specific error during development, you should execute the ON ERROR immediately before you run the build or execute the resulting EXE or APP file. And be sure to cancel it afterwards by issuing ON ERROR by itself.

Dan said you should do it as early as possible in your main program. That would be true for a general error-handler that you want to be in place the whole time to help you deal with errors in a live system. In that case, the ON ERROR command should call a routine that logs the error in some way, notifies the user that an error has occurred, and closes down gracefully. That's definitely something you should be doing, but it's not directly related to the use of ON ERROR that Olaf suggested.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
The topic has a whole white paper about error handling, if not even two, see
This was just meant as a quick "hack" to see the line of error. Of course, it has to come first, it instructs FoxPro what to do in case an error happens, it's not aftermath code checking whether errors happened, so first, not last. If you simply look up ON ERROR in the help you'll see that.

Bye, Olaf.

Olaf Doschke Software Engineering
 
Please Note - Spelling Mistake, MESSSAGEBOX should be Messagebox

CODE ON ERROR MESSSAGEBOX(Textmerge("<<ERROR()>> <<MESSAGE()>> <<LINENO()>>"))

Should be:-

CODE ON ERROR MESSAGEBOX(Textmerge("<<ERROR()>> <<MESSAGE()>> <<LINENO()>>"))

Regards,

David.

Recreational user of VFP.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top