×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Can you create an .exe file from created form?
2

Can you create an .exe file from created form?

Can you create an .exe file from created form?

(OP)
Hi everyone, im doing a little project, i designed a form using form designer.. is it possible to create an exe file out of it? If so, please teach me how… thanks in advance…

RE: Can you create an .exe file from created form?

An EXE needs a project to build and a main file. This should be a prg with DO YOURFORM.SCX at least.

Chriss

RE: Can you create an .exe file from created form?

As Chris says, you need to add the form to a project.

The usual approach would be for the project to also contain a program (a PRG file), and for that program to launch the form. However, it is also possible for the project to contain the form and nothing else. In that case, set the form to "Main" (right-click on it within the project, and tick "Set Main"; the name of the form will turn bold). You can then buidl the project to create an EXE.

If you do that, be sure to make the form modal (set its WindowType to 1). Otherwise, the form will simply flash on the screen and then immediately disappear and terminate the program.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads

RE: Can you create an .exe file from created form?

Edited:
I see only an unfortunate way how that works, Mike. With the _SCREEN visible.
Because the form has to be modal as you don't want a PRG that could have a READ EVENTS. The form can't be top level, or setting it modal does not work.

So you need to set the form to be in screen or in top level form and when you add a config with SCREEN=OFF or set _SCREEN.visible=.f. in your form code (load or init), then the form disappears.

I only see this working with another top level form or screen and since that's surely not what you want, you better have a main.prg as usual.

Chriss

RE: Can you create an .exe file from created form?

(OP)
Oh.... I see..... Thanks Chriss and Mike....

RE: Can you create an .exe file from created form?

Okay, I figured out a way, but this is not what I'd ever recommend to do:

Form init:

CODE

_screen.visible=.f.
This.Show()
Read Events 

Form queryunload:

CODE

Clear Events 

And ShowWindow set to 2, which means as top level form.

Then this works without a PRG, but you never return from init, the whole time the form runs, an event hasn't finished. READ EVENTS allows any further events to happen, but it's not natural to do this. It doesn't feel good, as you have to actually call the Show() method, which is happening after init, usually, but not in a case you stop init from exiting by READ EVENTS.

As you have to use a top level form anyway, and that's never modal, I'd also just have a PRG that can initialize several things and then READ EVENTS. It's also much easier to extend.

Chriss

RE: Can you create an .exe file from created form?

Chris, you've made some good points, and I don't disagree with any of them. But I wouldn't want Mandy to be over-worried about top-level forms. If she just has a modal form in the project, and nothing else, then it should work fine. It's true that the outer VFP window will also be visible, but she hasn't said that she has a problem with that.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close