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!

Why does my application jus flashes and closes when I start it.

Tips -N- Tricks

Why does my application jus flashes and closes when I start it.

by  Mike Gagnon  Posted    (Edited  )
When creating an application (executable), unless you are using a top-level form, you need to stop the application from closing, and have it wait for the user's input. I order to achieve this, you need to use a main program (a program that is "set to main", in the project manager). You actually only need two lines of code to start an application (other lines would be setting the paths for the data, setting the date style, setting global variables etc.).
[ol][li]If you are using a menu with your application, you can use the following in your main program:
DO myMenu.mpr
READ EVENTS && The application will stop here and wait.[/li]
[li]If you are using a main form instead of a menu, the same principle applies.
Do form myMainform.scx
READ EVENTS[/LI]
[LI]When it coes time to close the application, you needs to use CLEAR EVENTS, either in the QueryUnload of you main form, or in the exit of your menu.[/li][/ol]
This is a simplified version of a main program, but it will eliminate the problem of the application "just flashing" and closing on startup.

Mike Gagnon
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top