Focus to my application (resolved!)

Focus to my application (resolved!)

Postby ip_ram » Mon Feb 23, 2015 4: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
Last edited by ip_ram on Mon Feb 23, 2015 7:40 pm, edited 1 time in total.
User avatar
ip_ram
 
Posts: 43
Joined: Tue Nov 21, 2006 4:07 pm
Location: Brazil / MG / Belo Horizonte

Re: Focus to my application

Postby Armando » Mon Feb 23, 2015 5:03 pm

ip_ram:

Pls try with this code

Code: Select all  Expand view

    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
User avatar
Armando
 
Posts: 3076
Joined: Fri Oct 07, 2005 8:20 pm
Location: Toluca, México

Re: Focus to my application

Postby ip_ram » Mon Feb 23, 2015 5: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
User avatar
ip_ram
 
Posts: 43
Joined: Tue Nov 21, 2006 4:07 pm
Location: Brazil / MG / Belo Horizonte

Re: Focus to my application

Postby hmpaquito » Mon Feb 23, 2015 5:50 pm

hmpaquito
 
Posts: 1482
Joined: Thu Oct 30, 2008 2:37 pm

Re: Focus to my application

Postby Armando » Mon Feb 23, 2015 6: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: Select all  Expand view

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
User avatar
Armando
 
Posts: 3076
Joined: Fri Oct 07, 2005 8:20 pm
Location: Toluca, México

Re: Focus to my application

Postby ip_ram » Mon Feb 23, 2015 7:03 pm

Armando,

My fault... Now is working:

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

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

Tks!

Rodrigo Melo
User avatar
ip_ram
 
Posts: 43
Joined: Tue Nov 21, 2006 4:07 pm
Location: Brazil / MG / Belo Horizonte

Re: Focus to my application (resolved!)

Postby Armando » 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
User avatar
Armando
 
Posts: 3076
Joined: Fri Oct 07, 2005 8:20 pm
Location: Toluca, México


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 43 guests