FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Focus to my application (resolved!)
Posts: 44
Joined: Tue Nov 21, 2006 04:07 PM
Focus to my application (resolved!)
Posted: Mon Feb 23, 2015 04:29 PM

Hello!

I need to give focus to my application when it happens a condition.

I'm using a function called by the Timer to verify this condition.

I've tried the ShowWindow () functions and SetForegroundWindow () but without obtaining the desired result.

Any suggestions?

Thank you

Posts: 3358
Joined: Fri Oct 07, 2005 08:20 PM
Re: Focus to my application
Posted: Mon Feb 23, 2015 05:03 PM
ip_ram:

Pls try with this code

Code (fw): Select all Collapse
    LOCAL hWnd := FindWindow( 0, "Yor application's title")

    IF hWnd != 0
        ShowWindow( hWnd, 1)
        QUIT
    ENDIF


Regards
SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
Posts: 44
Joined: Tue Nov 21, 2006 04:07 PM
Re: Focus to my application
Posted: Mon Feb 23, 2015 05:30 PM

Armando,

Unfortunately this way did not work. I already tried that.

There are two situations: when the user switches the application with other and when the user minimizes the application.

And in this case (minimize), I can not give focus in the application.

I'll keep searching ...

Thanks!

Rodrigo Melo

Posts: 1515
Joined: Thu Oct 30, 2008 02:37 PM
Re: Focus to my application
Posted: Mon Feb 23, 2015 05:50 PM
Posts: 3358
Joined: Fri Oct 07, 2005 08:20 PM
Re: Focus to my application
Posted: Mon Feb 23, 2015 06:20 PM
Rodrigo:

It Works here.

In the code

FindWindow( 0, "Yor application's title")

It must be the exactly main window's title, and in the top of MAIN prg,
here is a sample code for the minimize situation

Code (fw): Select all Collapse
FUNCTION MAIN()
    LOCAL hWnd := FindWindow( 0, "Your application's title")
        ....
        ....
    IF hWnd != 0
        ShowWindow( hWnd, 1)
        QUIT
    ENDIF


Regards
SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
Posts: 44
Joined: Tue Nov 21, 2006 04:07 PM
Re: Focus to my application
Posted: Mon Feb 23, 2015 07:03 PM

Armando,

My fault... Now is working:

hWnd := FindWindow (0, oWnd:cTitle () )

ShowWindow( hWnd, 9) // is diplayed even if minimized

Tks!

Rodrigo Melo

Posts: 3358
Joined: Fri Oct 07, 2005 08:20 PM
Re: Focus to my application (resolved!)
Posted: Mon Feb 23, 2015 10:56 PM

Rodrigo:

Cool !.

Regards

SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero

Continue the discussion