Home > Archive > VC Language > November 2005 > How to set focus to the window shown by the API ShowWindow(SW_SHOW)
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
How to set focus to the window shown by the API ShowWindow(SW_SHOW)
|
|
| Jigar Mehta 2005-11-27, 7:04 pm |
| Hi,
I am using ShowWindow(SW_HIDE) to hide my window when minimizing the application..
Now, when user clicks on the icon I am using code, ShowWindow(SW_SHOW) to
show my window back to the screen.. and it comes back.. But still the window
does not come on top.. it comes on the last z-order.. so, if that window
is the only window on my screen i am able to see the window.. of if another
window is smaller than mine winodw, i will be able to see the remaining portion
of my window.. my window is getting focused but other windows (after loosing
focus - in inactive state) shows up on the top..
So, what to do to get my winodw on top ?
=====
Regards,
Jigar Mehta
| |
| Igor Tandetnik 2005-11-27, 7:04 pm |
| "Jigar Mehta" <jigar.gemsystems@gmail.com> wrote in message
news:80a328c05f4b8c7c1c33bb405e2@msnews.microsoft.com
> I am using ShowWindow(SW_HIDE) to hide my window when minimizing the
> application.. Now, when user clicks on the icon I am using code,
> ShowWindow(SW_SHOW) to show my window back to the screen.. and it
> comes back.. But still the
> window does not come on top.. it comes on the last z-order..
Try BringWindowToTop
--
With best wishes,
Igor Tandetnik
With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925
| |
|
|
"Jigar Mehta"
> I am using ShowWindow(SW_HIDE) to hide my window when minimizing the
> application.. Now, when user clicks on the icon I am using code,
> ShowWindow(SW_SHOW)
>
> So, what to do to get my winodw on top ?
You may call SetForegroundWindow ...
But what icon ? in the taskbar ? ..
If that's the case then you have a system menu
so why not use :
WM_SYSCOMMAND and SC_MINIMIZE / SC_RESTORE
| |
| Jigar Mehta 2005-11-27, 7:04 pm |
| Hello Igor,
Yes.. It worked.. Thanx a lot.. Saved me from doing the R n D...
=====
Regards,
Jigar Mehta
> "Jigar Mehta" <jigar.gemsystems@gmail.com> wrote in message
> news:80a328c05f4b8c7c1c33bb405e2@msnews.microsoft.com
>
> Try BringWindowToTop
>
> With sufficient thrust, pigs fly just fine. However, this is not
> necessarily a good idea. It is hard to be sure where they are going to
> land, and it could be dangerous sitting under them as they fly
> overhead. -- RFC 1925
>
| |
| Jigar Mehta 2005-11-27, 7:04 pm |
| Hello,
Sorry.. it dint work... I tested it while not having any window opened..
when testing it with windows opened.. its the same thing i was having previouslly..
so, may be some other solution.. BringWindowToTop is not working...
=====
Regards,
Jigar Mehta
[color=darkred]
> Hello Igor,
>
> Yes.. It worked.. Thanx a lot.. Saved me from doing the R n D...
>
> =====
> Regards,
> Jigar Mehta
| |
| Jigar Mehta 2005-11-27, 7:04 pm |
| Hello ama,
Yes, for my purpose, SetForegroundWindow worked.. Thx..
And im minimizing the application icon to status bar.. Not in taskbar.. So,
while user clicks on the statusbar icon, it will restore the application
from the status tray to the taskbar area and should have focus.. which is
done now.. thx..
=====
Regards,
Jigar Mehta
> "Jigar Mehta"
>
> You may call SetForegroundWindow ...
>
> But what icon ? in the taskbar ? ..
>
> If that's the case then you have a system menu
> so why not use :
> WM_SYSCOMMAND and SC_MINIMIZE / SC_RESTORE
>
|
|
|
|
|