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

How to make a Hello world program, no VPF screen and close it on X 2

Status
Not open for further replies.

Kruno

Programmer
Aug 24, 2002
16
0
0

I want an application that will behave/look as it is C or Delphi program:
- no VFP screen or menu,
- in the the middle of my desktop, movable, nice...
- closable on "X" of title bar

When you want some little piece of work to demonstrate, it is hard to explain to non-VFP guys what is that flickering in your application, or VFP menu or screen behind...

One of the most frequent question in this forum is about application without VFP screen and menu. And closing our application is very anoying. Imagine that you can't leave Word, Excel or IE without "Cannot Quit VisualFoxPro" message.

So, here is my both things solution:


1. Make a new project (e.g.HELLO)

2. Create a PRG (set as main) with this code in it:
*************
DO form hello
READ events
*************
(save as HELLO.PRG)

3. Create new form with:
Autocenter .T.
Caption Hello world!
ShowWindow 2 - As Top-Level
QueryUnload Event CLEAR EVENTS
(save as HELLO.SCX)

4. Build as EXE

5. In the same folder make a CONFIG.FPW with:
screen=OFF

6. Run HELLO.EXE

Your form/exe will show up on the desktop
a) With no VFP menu or screen, no flickering
(if you use some BMP in form1.icon,
no one can recognize that it is VFP application - no fox head)

b) You can close it on X mark (and the process is gone)

I hope this will help.
Kruno Malovic
PLUS KOMP, e-mail:plus1@zg.tel.hr

 
You may want to post this as a FAQ... It's a good, simple explanation.
 
You may also want to add

the real method for NOT GETTING THE "Cannot Quit VisualFoxPro" message is to add:

ON SHUTDOWN quit && can also be anything else you want "cleanup code"

In your good simple example if you where to attempt an "end task" or Windows Shutdown with the app running you will still get "Cannot Quit Visual Foxpro" with the above ON SHUTDOWN and a cleanup procedure you can close open tables and have a graceful exit.

Steve Bowman
steve.bowman@ultraex.com

 
You could also skip running a form at all and just MessageBox("Hello World")
 
or
Wait Window 'Hello World'

:)

My 2 cents.

Ali Koumaiha
TeknoSoft Inc
Farmington Hills, Michigan
 
Wait Window wouldn't have the close box he required, and it wouldn't be moveable because the act of moving it would release it.
 
Also, you can include the 'config.fpw' file on your project for a cleaner app folder.
You can get rid of the fox head by specifying a custom icon on your project (project info->attach icon) and then including it on the project.



Gerardo Czajkowski
ltc.jpg
 
Kruno,

"no one can recognize that it is VFP application - no fox head".
When you run this application two files are created:
foxuser.dbf and foxuser.fpt so...

Best regards
Marius
 

Thanks all for contributions.

Machele,
There is no intention to hide VFP origin, but to get program behavior as in other languages. It is sad that we have to do tricks to get so simple things:
1.standalone form without File,Edit,Format built-in menu and VFP-screen (and no flickering)
2.closing the form on X.

SCREEN=OFF is the solution for 1 (100% no flickering). I think Rgbean's recent tip of ALLOWEXTERNAL in VFP8 makes sense to include CONFIG.WFP in the project.
Simple solution for 2 is CLEAR EVENTS in QueryUnload method.

The background:
A guy comming from .NET and Delphi is forced to use VFP. I can see he is not feel comfortable in VFP. It is hard to explain to him why we in VFP have not got some obvious things. These two were the first in the list.

Kruno
 
I agree,
Probably i understand something else.
I use VB before and i find this solution you write in this forum.
Good job
Best regards
Marius Frunza
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top