Creating Desktop Toolbar : Can I change the default bounds of Windows 7?

22-degrees

Well-known member
Joined
Feb 11, 2012
Messages
156
Location
South East Ireland
Programming Experience
1-3
As the title states, I am making a toolbar which will sit neatly at the top of my screen just as the Windows taskbar does at the bottom of the screen.

Is there a way I can change the default y-boundary in Windows 7 so that my bar is always visible and never blocking any existing windows?

Alternatively, I would be willing to try an auto-hide toolbar so that when the y-value of the mouse position is = 0 then the toolbar will appear/show.. If anyone could suggest a keyword that I might use to narrow down my search as to how I would achieve such a feature, I would be grateful.

Thanks.
 
Maybe I don't understand your question correctly, but you want to adjust the z-order of your form, so that it stays on top of other windows?
 
Maybe I don't understand your question correctly, but you want to adjust the z-order of your form, so that it stays on top of other windows?

so that my bar is always visible and never blocking any existing windows?

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
 
Have you tried the SetWindowPos api?

I also made a toolbar once, making it on top of other winows. But making it reside in front did cause some unwanted issues. For instance, if your win 7 taskbar is set to autohide, then it won't automatically pop up again when moving your mouse at the bottom of the screen. But you might have better luck with that than I had :)
 
Last edited:
TaskBar is never hidden for me.. slows me down

Sheet!.. SetWindowPos looks a bit scary for someone of my experience but I will have to look into it, thanks for the keyword..

Just, before I go looking myself.. How exactly would the logic of SWP be?

For the record: (i'm using Dual Screen with 1280 x 1024 Res (1280 x 993 excluding the taskbar) ) - (Toolbar (TB) height is 37, TB y-loc is 0)

Psuedo-Code:

VB.NET:
If any-window (who's x-loc is < 1280) has a y-loc < 37 then


      if said window's height < (993 - 37) then

           re-locate to new point(current X-loc, 37)

      elseif said window's height > (993 - 37) then

           re-locate to new point(current X-loc, 37) AND resize to (current width, y=(993 - 37))

      end if


end if

Is it as straight-forward as this with SWP or am I looking at a slight headache?
 
Last edited:
I guess you want the toolbar to be centered at the top of your main desktop?

Me.Location = New Point((Screen.PrimaryScreen.WorkingArea.Width / 2) - Me.Width / 2, 0)

As for the api, I used this library by Chris Wright. Why re-invent the wheel, right? :)

Cjwdev.WindowsApi.NativeWindow.MakeWindowTopMost(Me.Handle)
 
Last edited:
He doesn't want the window topmost, he wants an AppBar class application. To do this you need to register your application as an appbar through API.

Probably one Advil and a look at this (in C#, but comes as a comprehensive tutorial, shouldn't be hard to rewrite in VB) and this (pretty much the same thing, but in VB and no explanations whatsoever...). Essentially you can make a class that inherits from form, have it register as appbar and apply settings, etc. Then you make your app's main form inherit from this class and build it like a normal app. Pretty straightforward apart from the API play.
 
Last edited:
Never heard of this AppBar class before. Interesting.. But I guess from a visual point of view, this is most suitable for applications docked to the sides of the screen, and not at the top...
 
Top, bottom, right, left, it really does not matter, what matters is the code to tell the operating system to treat the form as an appbar (i.e. Making Windows understand how other applications should interact with your form, like preventing icons from getting hidden under your bar, other forms from maximizing over it, etc...). If you want your bar to be 40 pixels high docked at the top and spanning all screens, it's all up to you, the picture only shows examples.
 
I mean, it would look weird if the windows does not maximize to the top of the screen :tongue: it certainly isn't common, I have never seen it anyway.. I don't think it is good design, but that is just my humble opinion :)
 
It's exactly the same behavior as the Windows taskbar. Is some cases you might want to have a ticker or toolbar shown at all times if it serves a purpose
 
I mean, it would look weird if the windows does not maximize to the top of the screen :tongue: it certainly isn't common, I have never seen it anyway.. I don't think it is good design, but that is just my humble opinion :)

Don't tell Apple that. :excitement:
 
Thanks Herman, Looks like I have what I need.

_powerade_, regarding looking weird and not being a good design, I think widescreen is an abomination.. Even with the taskbar on the bottom and my toolbar on the top, I still have a more pleasant and useful looking screen than that of a widescreen monitor. :)
 
Now that I have had my beautysleep, I see that I might have overreacted a little about my design point ;).

But anyway, I'm glad you got your help. Good luck on your project :)
 
Back
Top