INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

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.

Jobs

When clicking on the exe of the project created by VFP9, it does not have the focus

When clicking on the exe of the project created by VFP9, it does not have the focus

When clicking on the exe of the project created by VFP9, it does not have the focus

(OP)
When clicking on the exe of the project created by VFP9, it does not have the focus

Good afternoon, fellow colleagues.

My problem is this:

On the desktop of windows 10, I have the shortcut to my program (which was generated in vfp9), but if I click the mouse or select and give "enter", it opens normally, but the focus does not go to my program, the focus is on the shortcut on the windows desktop.

My program relies on a form, disabling the vfp window.

Has anyone had this problem and could you help me?

thank you all in advance.

RE: When clicking on the exe of the project created by VFP9, it does not have the focus

What is the shortcut starting? Do you build an EXE or is it a shortcut tot a PJX or PRG?

Bye, Olaf.

RE: When clicking on the exe of the project created by VFP9, it does not have the focus

(OP)
hi

shotcurt to exe

the exe file is created in vfp 9 sp2

RE: When clicking on the exe of the project created by VFP9, it does not have the focus

I never experienced an EXE not getting focus at its start. Are you seeing anything from your EXE? If you didn't turn _SCREEN off that will likely have focus, as it is the top level form of the EXE, but what you report is the focus stays on the shortcut. I don't see how that would happen.

Bye, Olaf.

RE: When clicking on the exe of the project created by VFP9, it does not have the focus

At the start of your main program, do this:

CODE -->

DECLARE INTEGER BringWindowToTop IN user32;
    INTEGER hWindow

BringWindowToTop(_SCREEN.Hwnd) 

If you don't have a main program, do it in the Init event of your main form.

If your application does not show _SCREEN (that is, if it has a top-level form), then pass the form's Hwnd instead of _SCREEN's.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads

RE: When clicking on the exe of the project created by VFP9, it does not have the focus

That would perhaps solve it, but shouldn't be necessary.

Did you change shortcut properties to start the EXE minimized?

Bye, Olaf.

RE: When clicking on the exe of the project created by VFP9, it does not have the focus

(OP)
I tried using
"BringWindowToTop (_SCREEN.Hwnd)" and also BringWindowToTop (thisform.Hwnd) in form init

but in both cases it remained the same.

RE: When clicking on the exe of the project created by VFP9, it does not have the focus

(OP)
my shotcurt is in normal mode

RE: When clicking on the exe of the project created by VFP9, it does not have the focus

I see in your main program you are declaring SetForegroundWindow() and SetActiveWindow(). Are you calling these functions from within your form? (I can't open the form because it has dependencies.) If so, why are you doing so? Could those calls be changing the Z-order of the form or the outer window?

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads

RE: When clicking on the exe of the project created by VFP9, it does not have the focus

Can you just add a MESSSAGEBOX("Test") right in front of the DO FORM you expect to run?

Bye, Olaf.

RE: When clicking on the exe of the project created by VFP9, it does not have the focus

(OP)
Sorry for the inconsistency.
I've been trying all the alternatives and I ended up polluting the source
this system comes from vfp5 and is in vfp9 to about 10 years.
but have always had this problem.

RE: When clicking on the exe of the project created by VFP9, it does not have the focus

(OP)
I have removed all the function calls to put the screen in the front that I put, and it continues the same way.

RE: When clicking on the exe of the project created by VFP9, it does not have the focus

Is it possible that you have the AlwaysOnBottom property set to .T. This is a property of your form, and also of _SCREEN. It's very unlikely that it will be set to .T., but I can't think of anything else just now.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads

RE: When clicking on the exe of the project created by VFP9, it does not have the focus

(OP)
Dear friends of VFP

I found my problem.

in my config.fp I had put the option screen = off
And being this way the "order Z" was not inserted with my project / exe

What I did was put in config.fp screen = on (or simply remove the screen = off),
put before "form meuform"
A DEACTIVATE WINDOW "Microsoft Visual FoxPro"
and an ACTIVATE WINDOW myform
soon after the "form meuform"


I am very grateful for the support of all those who have helped me in this matter, and I am available to assist you if you need me.

RE: When clicking on the exe of the project created by VFP9, it does not have the focus

When this works, your own form just needs to be a top level form and you can add back SCREEN=OFF. It's the better option, as this works without any flicker of showing the _screen for a short instant.

Edit: This means setting the ShowWindow property to 2 (as top level form).

What might contribute to the form not getting focus is the start of the app takes long, before you start the form. Since an EXE process can take long and run formless, I don't think Windows (the OS) waits forever to give focus to the first fomr started. On the other side any form starting up will get focus and become the active window on the desktop.

Bye, Olaf.

RE: When clicking on the exe of the project created by VFP9, it does not have the focus

Yes, I agree with Olaf's last point. I often use SCREEN = OFF. It shouldn't be a problem.

But good to hear that you solved it. Thanks for letting us know.

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!

Resources

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