Go The Power Senior Administrator, Windows Update Expert, Contributor Staff member Joined Mar 5, 2012 Posts 6,292 Location Adelaide, South Australia Jan 25, 2014 #1 Hi guys, I have created Little toolbar inside Powershell to use at work, I have worked out how to make the Toolbar stay on top of all other windows. But I was wondering if it was possible to make this toolbar "Dock" to the top of screen. Ideally what I would like is my toolbar is to be sitting at the top of the screen and other windows re-size around it. Is there a way to make it so windows automatically arrange around it? that way if a window is maximized it will fit between my toolbar at the top and the start menu at the bottom? I have done alot of looking on google but haven't had much luck. The closest thing I have been able to find it this, but is for C: C# does Shell, Part 3 - CodeProject thank you
Hi guys, I have created Little toolbar inside Powershell to use at work, I have worked out how to make the Toolbar stay on top of all other windows. But I was wondering if it was possible to make this toolbar "Dock" to the top of screen. Ideally what I would like is my toolbar is to be sitting at the top of the screen and other windows re-size around it. Is there a way to make it so windows automatically arrange around it? that way if a window is maximized it will fit between my toolbar at the top and the start menu at the bottom? I have done alot of looking on google but haven't had much luck. The closest thing I have been able to find it this, but is for C: C# does Shell, Part 3 - CodeProject thank you
AceInfinity Emeritus, Contributor Joined Feb 21, 2012 Posts 1,728 Location Canada Jan 25, 2014 #2 Ideally what I would like is my toolbar is to be sitting at the top of the screen and other windows re-size around it. Click to expand... First part is easy, set the startup position, and get the screen width divided by 2, and subtract the width of the toolbar divided by 2 to center it, Y will be 0 obviously. As for making other windows resize around it, you'll have to P/Invoke MoveWindow() (Documentation). There are no native .NET stuff provided within the BCL that allow you to interact with other process' in this way. Why bother though if you have it configured so that this toolbar always stays on top of all other windows? The other thing you'd need is to P/Invoke the EnumWindows() function to get a handle to each top level Window: Documentation If you want this to be an immovable toolbar, you'll have to override a few things to prevent the user from dragging the form around. Last edited: Jan 25, 2014
Ideally what I would like is my toolbar is to be sitting at the top of the screen and other windows re-size around it. Click to expand... First part is easy, set the startup position, and get the screen width divided by 2, and subtract the width of the toolbar divided by 2 to center it, Y will be 0 obviously. As for making other windows resize around it, you'll have to P/Invoke MoveWindow() (Documentation). There are no native .NET stuff provided within the BCL that allow you to interact with other process' in this way. Why bother though if you have it configured so that this toolbar always stays on top of all other windows? The other thing you'd need is to P/Invoke the EnumWindows() function to get a handle to each top level Window: Documentation If you want this to be an immovable toolbar, you'll have to override a few things to prevent the user from dragging the form around.
Go The Power Senior Administrator, Windows Update Expert, Contributor Staff member Joined Mar 5, 2012 Posts 6,292 Location Adelaide, South Australia Jan 25, 2014 #3 Thanks for the reply. I will have a look at this when I get to work I currently have it ontop of all windows, but if I open up a program that is maximized it cuts of all the top of the window that is maximized. Then to have to close the window you have to move the tool bar to click on close thanks again
Thanks for the reply. I will have a look at this when I get to work I currently have it ontop of all windows, but if I open up a program that is maximized it cuts of all the top of the window that is maximized. Then to have to close the window you have to move the tool bar to click on close thanks again
AceInfinity Emeritus, Contributor Joined Feb 21, 2012 Posts 1,728 Location Canada Jan 25, 2014 #4 Go The Power said: Thanks for the reply. I will have a look at this when I get to work I currently have it ontop of all windows, but if I open up a program that is maximized it cuts of all the top of the window that is maximized. Then to have to close the window you have to move the tool bar to click on close thanks again Click to expand... Then unless you have a timer that utilizes the methods I've explained above, you'd probably have to provide a low level hook which would complicate things by a large amount.
Go The Power said: Thanks for the reply. I will have a look at this when I get to work I currently have it ontop of all windows, but if I open up a program that is maximized it cuts of all the top of the window that is maximized. Then to have to close the window you have to move the tool bar to click on close thanks again Click to expand... Then unless you have a timer that utilizes the methods I've explained above, you'd probably have to provide a low level hook which would complicate things by a large amount.
Go The Power Senior Administrator, Windows Update Expert, Contributor Staff member Joined Mar 5, 2012 Posts 6,292 Location Adelaide, South Australia Jan 26, 2014 #5 Thanks heaps. I will read into it
niemiro Senior Administrator, Windows Update Expert Staff member Joined Mar 2, 2012 Posts 8,772 Location District 12 Jan 26, 2014 #6 Go The Power said: Thanks for the reply. I will have a look at this when I get to work I currently have it ontop of all windows, but if I open up a program that is maximized it cuts of all the top of the window that is maximized. Then to have to close the window you have to move the tool bar to click on close thanks again Click to expand... Could you not shorten your toolbar to leave a little gap on the right hand side for the minimize/maximise/close buttons?
Go The Power said: Thanks for the reply. I will have a look at this when I get to work I currently have it ontop of all windows, but if I open up a program that is maximized it cuts of all the top of the window that is maximized. Then to have to close the window you have to move the tool bar to click on close thanks again Click to expand... Could you not shorten your toolbar to leave a little gap on the right hand side for the minimize/maximise/close buttons?
Go The Power Senior Administrator, Windows Update Expert, Contributor Staff member Joined Mar 5, 2012 Posts 6,292 Location Adelaide, South Australia Jan 26, 2014 #7 niemiro said: Go The Power said: Thanks for the reply. I will have a look at this when I get to work I currently have it ontop of all windows, but if I open up a program that is maximized it cuts of all the top of the window that is maximized. Then to have to close the window you have to move the tool bar to click on close thanks again Click to expand... Could you not shorten your toolbar to leave a little gap on the right hand side for the minimize/maximise/close buttons? Click to expand... That would be an easier way of doing it. I use the toolbar for remote connections to users machine, if when a command is run to open MSTSC for example, might be easier if i can tell powershell to open the MSTSC session on the Secondary Monitor.
niemiro said: Go The Power said: Thanks for the reply. I will have a look at this when I get to work I currently have it ontop of all windows, but if I open up a program that is maximized it cuts of all the top of the window that is maximized. Then to have to close the window you have to move the tool bar to click on close thanks again Click to expand... Could you not shorten your toolbar to leave a little gap on the right hand side for the minimize/maximise/close buttons? Click to expand... That would be an easier way of doing it. I use the toolbar for remote connections to users machine, if when a command is run to open MSTSC for example, might be easier if i can tell powershell to open the MSTSC session on the Secondary Monitor.
AceInfinity Emeritus, Contributor Joined Feb 21, 2012 Posts 1,728 Location Canada Jan 26, 2014 #8 I would take on niemiro's suggestion and expand the toolbar to as wide as you need it depending on what exists on that toolbar. The math behind determining the width shouldn't be difficult..
I would take on niemiro's suggestion and expand the toolbar to as wide as you need it depending on what exists on that toolbar. The math behind determining the width shouldn't be difficult..
AceInfinity Emeritus, Contributor Joined Feb 21, 2012 Posts 1,728 Location Canada Jan 28, 2014 #9 How are you doing on this? Is this issue all sorted? I probably won't help with the low level hook because it would require similar concepts of a malicious intent, but if you have further questions you know where to ask them :).
How are you doing on this? Is this issue all sorted? I probably won't help with the low level hook because it would require similar concepts of a malicious intent, but if you have further questions you know where to ask them :).