views:

147

answers:

1

Hello.

First of all, i know there is a similarly phrased question in SO, but it hasn't been answered properly, and most of the discussion around it fell unto the "you shouldn't be doing that".

So lets start by the basics. Why this is needed.

I work on a company that handed out a few dozen tablet netbooks to our workers. As you know, netbooks have a comparatively lower resolution, and screen real estate is very, very important.

When we rotate the netbooks into tablet mode, we use them for writing, and portrait mode is much more comfortable for that. The thing is, when the screen is rotated, the taskbar stays on the same relative edge as on landscape. If it was at the bottom, it stays at the bottom on portrait. But since we already use it on the left edge on landscape, we end up with the taskbar taking up a very noticeable percentage of the available screen.

I have already the structure in place for listening to resolution changes event, and its working properly, but all the samples i've seen regarding passing messages to the taskbar window ultimately fail to move it. It's like its being forcefully ignored.

Is there any way to achieve this? I'm currently using c#, but that is not a definite requirement, i can easily achieve the conversion from c++ or vb, and p/invokes are not scary.

The operating system is windows 7.

[Edit: I have already tried SHAppBarMessage, with SETPOS, it doesn't work on windows 7. I have tried MoveWindow and SetWindowPos pinvokes, also don't work on windows 7 on the taskbar. For other windows it works just fine. And i am sure i have the right handle, because if i use ShowWindow pinvoke to hide it, it really hides, although i can't reclaim the unused space for anything else. These methods did work on XP, that is why its so frustrating.]

Thank you very much for your time, Joao Correia

A: 

Have you tried FindWindow() with Shell_TrayWnd as the class, and then use SetWindowPos to mvoe the window?

Not sure how Windows would take this though.

There's also specific API to do with the AppBar's (what the taskbar is), check out:

http://bytes.com/topic/c-sharp/answers/247701-moving-windows-takbar

Lloyd
Yes, i have tried FindWindow and the argument you suggest, thats what gets ignored by the system. If i use it on any other window, it works. The taskbar ignores it. As for the link suggested, i have tried that exact code. It works on XP, but fails on 7, hence my need for this question.
Joao Correia
Ahh I see, that's interesting.
Lloyd