I am trying to write an application that appears beneath all other windows, and does not move in front of windows unless it is clicked. When clicked, I plan on having it move to the front as usual. I am unsure of how to keep a window on the bottom of all the other forms. Any suggestions?
There are 10 kinds of people in the world: those who understand binary, and those who don't. | | Luc 284 Sunday, October 04, 2009 11:34 PM | I don't think there's an easy way to do that. You can make a form topmost but there's no bottommost. You can use the SetWindowPos API function to move the form to the bottom of the stacking order. You could then subclass and move it back there whenever it was activated. See this discussion: http://www.vbforums.com/showthread.php?t=34098 You could also use a Timer to push the form back to the bottom occasionally. Not as nice a solution but a lot easier. possibly for your app, it would be enough to just move it to the back once. If the user clicks on it or selects it with Alt-Tab, etc. then it should pop to the top. You could include some sort of button or something to let the user push it back to the bottom. Note that it still won't sit behind the desktop icons and such. Rod Rod Stephens, Visual Basic MVP Visual Basic 2008 Programmer's Reference http://www.amazon.com/exec/obidos/ASIN/0470182628/vbhelper/
- Marked As Answer byHarry ZhuMSFT, ModeratorMonday, October 12, 2009 7:44 AM
-
| | Rod Stephens Tuesday, October 06, 2009 2:21 PM | "....When clicked, I plan on having it move to the front as usual."
If the form is below everything, how is someone supposed to be able to click on it? Mark the best replies as answers. "Fooling computers since 1971." | | Rudedog2 Sunday, October 04, 2009 11:42 PM | I'm assuming that theres at least some space that isn't taken up by the other applications that would allow me to click on it. The application would fill the entire desktop. Do you see any of your desktop currently? If so, that's where you would see my program and be able to click on it.
There are 10 kinds of people in the world: those who understand binary, and those who don't. | | Luc 284 Monday, October 05, 2009 1:58 AM | No, my desktop is typically not visible, but the Taskbar is almost always visible.
Just in case you have not noticed, the requirement that you are describing is the default behavior for clicking on the Taskbar.
Let the user click on the application's icon in the Taskbar. That will bring it to the top.
Mark the best replies as answers. "Fooling computers since 1971." | | Rudedog2 Tuesday, October 06, 2009 12:22 PM | I don't think there's an easy way to do that. You can make a form topmost but there's no bottommost. You can use the SetWindowPos API function to move the form to the bottom of the stacking order. You could then subclass and move it back there whenever it was activated. See this discussion: http://www.vbforums.com/showthread.php?t=34098 You could also use a Timer to push the form back to the bottom occasionally. Not as nice a solution but a lot easier. possibly for your app, it would be enough to just move it to the back once. If the user clicks on it or selects it with Alt-Tab, etc. then it should pop to the top. You could include some sort of button or something to let the user push it back to the bottom. Note that it still won't sit behind the desktop icons and such. Rod Rod Stephens, Visual Basic MVP Visual Basic 2008 Programmer's Reference http://www.amazon.com/exec/obidos/ASIN/0470182628/vbhelper/
- Marked As Answer byHarry ZhuMSFT, ModeratorMonday, October 12, 2009 7:44 AM
-
| | Rod Stephens Tuesday, October 06, 2009 2:21 PM | @Rudedog2, I am aware that clicking on the icon in the taskbar brings an application to the top (assuming ShowInTaskbar is set to true, which is not the case in my application), but the functionality of moving to the front is not really what I am asking about. I need to know how to keep a window at the bottom. Essentially, I am creating a new desktop (although it has many more features than the desktop - I am not simply changing the background image). One of these features is an equivalent functionality to "Show Desktop" simply by clicking on the form.
@Rod Stephens, thank you, I will look at the documentation for SetWindowPos as well to see if it will work.
There are 10 kinds of people in the world: those who understand binary, and those who don't. | | Luc 284 Tuesday, October 06, 2009 6:54 PM | I have an idea on how to solve your problem, but it could be far too easily abused by those with malicious intent.
Let's work on idea #2. So where does the taskbar fit into all of this? Windows used to have a "Show Desktop" icon, but it appears to have been abandoned around the release of Office 2003.
I ask this because your entire question is based upon a loose assumption that part of the desktop will be visible. A scenario that you have apparently dismissed as a non-issue.
Why not simply add an icon to the TaskBar? Or is that hidden by your application, too?
You seem to be re-inventing the user's desktop with your own application. Sounds quite ominous to me.
Happy Coding.
Rudy =8^D
Mark the best replies as answers. "Fooling computers since 1971." | | Rudedog2 Tuesday, October 06, 2009 7:43 PM | Firstly, the "Show Desktop" button is still available in Vista, and this will minimize my program as it should. Secondly, yes, I am creating a sort of "replacement desktop", but no, it will not hide the taskbar. It will also not appear in the taskbar. The purpose is not to create a new show desktop icon, so it is not really that important whether or not there is any of the desktop visible. The only reason I mention it at all is because I want my program to come to the front as normal when it is clicked, and not to immediately pull itself to the back. I already have a theory as to how to do this anyway.
My entire question is not based upon the assumption that part of the desktop will be visible. This is simply a possible scenario which I am planning for, but it is by no means critical to the main function of my application. All I need is to be able to bring my application behind all others whenever needed, and I believe that Rod's suggestion will allow me to do that.
There are 10 kinds of people in the world: those who understand binary, and those who don't. | | Luc 284 Tuesday, October 06, 2009 11:52 PM |
|