Change Windows 7 Window Colour - c#

I've got a question but not sure if its possible. Is it possible to change the Windows 7 Window colour from .Net.
So this isn't the content of the window as that is easy i'm talking about the header title itself and allow the .Net app make the header transaperant like you can have in Window 7 and change the colour too etc.. Is there some sort of Window api that i can hook into to do this that anyone knows of.
The reason i want to do this is in Window you can obviously set your theme and window colours but i want my app to have all dialogs with the same sort of styling so i can change the window content but the window header i can't and if the user has set their window colour to a strange colour then it looks strange against my themed app.
Thanks for any help in advance.
Iffy.

i can't and if the user has set their window colour to a strange colour then it looks strange against my themed app.
That should be left up to the user, and you should not change settings that are explicitly set by the user for their operating system installation. This will drive more users away. If this is for your own personal use then it would be okay, but don't change a users Windows settings (of any kind).
If it really looks that bad, you should consider a custom skinned Window for your application only.

Yes, it's possible. This is a MSDN article describing it:
http://msdn.microsoft.com/en-us/library/bb688195%28VS.85%29.aspx
The code is in C++ but it should be easy to get it working in C#

Related

Changing taskbar button color on Windows

Multiple instances of the same application are running at the same time, and since each has multiple windows, it is not easy for the user to navigate between them. I help users by setting the titlebar color of different application instances to a different value. For example, all windows of the app instance started first will have red titlebar, all windows of the second instance will have a green one, etc.
It would also be useful to set the taskbar button color of app instances to the color I use for the titlebar. Is this possible? If not then I would be happy with a solution having similar differentiating effect, like setting the color of the text on the taskbar button, adding an overlay icon to it, etc.
The solution should work on Windows XP and later Windows versions. The language can be C/C++, C# or Delphi. Thank you very much in advance!
You cannot hope to achieve differently coloured taskbar buttons.
You could install your own shell and take complete control of the taskbar, but you can't expect your clients to do that.
You cannot expect to paint over the top of the Windows taskbar. The taskbar is animated. How are you going to keep up with that? How are you going to even know where the buttons are? I don't believe that there is a public API that will tell you that. I think you have to rule that idea out.
There is an API that allows you to change the colour of a taskbar button. It's the taskbar progress API added in Windows 7. You could use that to make your taskbar buttons yellow, green or red. I personally would not recommend that since the user will think you are showing progress.
The main options that are available to you are to change the window caption, and so the text that appears in the taskbar button. Or to change the icon.

Setting focus on control causes windows tool bar to appear

When I set focus on a text box, on a forms load event in Windows Mobile 5.0, the Windows tool bar appears even though my form is maximized.
When I do not set the focus on the text box the form opens maximized. I do not want the windows tool bar appearing.
How do I prevent this from happening?
TThe start bar in WinMo is actually not part of your app - it is a separate process managed by the Shell and it really wants to always be on top. Trying to get your app above it goes against the design goals of WinMo (though it's a common thing to want to do).
I'd recommend doing some searching and reading on "kiosk mode" to garner what knowledge you can from others who have been down this road, but what you're seeing is that the StartBar is getting set topmost.
Raffaelle Limosani has a pretty decent blog entry that covers kiosk mode, so it's a good place to start (take a look at the other blogs he links to as well).
The toolbar at the top is actually a separate window, and it has a habit of appearing when not wanted over top of a full-screen ("kiosk" mode) app. For example, if you ShowDialog a second full-screen window from the first, the Start window flickers up for a split second before going away.
The only way I ever found of dealing with it was to hack into the API and actually make the Start window hidden while my application was open. This is a big potential problem, because if your app crashes without making the Start window visible again, it will stay invisible until you reset the device (or run you app again successfully).
I'd advice against doing this unless you absolutely have to. As ctacke points out, this would be an example of an app not playing nicely with Windows Mobile.

Disable themed Window Border

In Windows XP's CMD, the Luna border isn't applied to it. alt text http://wedowebstuff.info/uploads/1272861285CMDNotThemed%5D.png
Is it possible to do it in a similar way in Visual C# Winforms, for an application? I just wonder how it's done, of course I am not going to force any of my applications to not use the beautiful XP/Aero theme :P
Thanks.
edit: Adding a note to this after many months. The Luna border isn't applied to CMD due to the fact that it is technically a 16-bit (old) application, so it does not use the standard Windows theming system (nor windowing, as demonstrated by the fact that it cannot be maximized). Applications like this are common in 32-bit windows (16-bit apps were removed in x64 Windows builds), for example, sysedit. The fact that it has a properly themed window border (but note, not the inside controls) in Vista/7, is due to the fact that Aero/Desktop Window Manager (DWM) overrides all window borders and renders them. If we switch to the Basic/Classic theme, that inconsistency continues.
The x64 cmd.exe doesn't have this problem. :)
I don't know how to modify the border, but on a side note, I do know how you can control the appearance of controls. As far as I know (I am a Linux programmer so I have limited knowledge in this field), without XPCommonControls enabled, you will have "old-style" controls, but with it, you will have "nice" buttons that are styled with the system style settings.

How to put a C# programm (ex WPF or WF or with Mono) under desctop Icons (like a wallpaper)?

How to put a C# programm (ex WPF or WF) under desctop Icons (like a wallpaper)?
I want my Old Good XP Active Desktop made by a some open source C# programm on my Win 7!)
Something like this - Fences .
They have there "windows" appearing underneath icons. I do not want to manage Icons - just put my window under them... BTW any one knows about such operations in other OS’s (Mac etc)?
And I DO NOT WANT TO MANAGE ALL THE ICONS ON MY OWN LIKE bumptop
I think it is quite possible, try this:
Find handle to window with the class "Progman".
Create some window in your application (or, perhaps, in some separate application, you will see the purpose later) and turn off its borders.
Set the parent of the newly created window to desktop handle.
Set the parent of "Progman" window you have found previousely to the window you created.
Desktop will be put on a window owned by your application and it will be possible to manipulate it in the way you want (namely, put something under it).
Also, do not forget to restore desktop's parent when application owning it is closed.
Look for FindWindow, GetClassName and SetParent at http://www.pinvoke.net/
Short answer is you can't really do it (in managed C# anyway). If it's possible, you would need to use Interop, and you'd likely be calling something that Windows doesn't offer as an API.
... although... as Ole Jak mentioned, Stardock looks to be doing it somehow...
The desktop is its own contained item. The same process handles the icons and the wallpaper "behind" those icons.
You are allowed to change the wallpaper to a different image, and you used to be able to create an Active Desktop where HTML content would be displayed, but this was discontinued in Vista.
What are you actually trying to do? Maybe there's another way to achieve a similar result?
There was DreamScene for vista. You could put a video as explorer background. I dont know if you could run a C# program to output the background video.

C# Set Window Behind Desktop Icons

Assume i have an empty form 100px by 100px at 0,0 coordinates on the screen. It has no border style. Is there any way to have this positioned BEHIND the desktop icons?
I would assume this would involve the process Progman because thats what contains the desktop icons. But no matter what i try... getting window handles and changing parents etc, i cant seem to get the window to appear behind the icons.
Any ideas?
Essentially you want to draw on the desktop wallpaper. The desktop hierarchy looks like this:
"Program Manager" Progman
"" SHELLDLL_DefView
"FolderView" SysListView32
It's the SysListView32 that actually draws the desktop icons, so that's what you have to hook. And you can't just stick your form on top of it; you have to grab a WindowDC to that handle and draw on the DC.
It can be done - it has been done, but you're going to be using a lot of interop. Forget about doing this with a traditional Winforms Form. I don't think I've even seen it done in C#, although somebody did it in python, if that helps. I'm not a python coder myself, but the code is pretty short and easy to understand.
There is a solution to this problem, at least for Windows 8. I postet it in form of an article on CodeProject, so you can read about it here:
http://www.codeproject.com/Articles/856020/Draw-behind-Desktop-Icons-in-Windows
This works for simple drawing, windows forms, wpf, directx, etc. The solution presented in that article is only for Windows 8.
Google-fu led me to this MSDN forum question:
http://social.msdn.microsoft.com/Forums/en/winformsdesigner/thread/c61d0705-d9ec-436a-b0a6-6ffa0ecec0cc
And this is a blog post regard the major pitfalls with using GetDesktopWindow() or dealing with the desktop handle (as per your other question: C# Position Window On Desktop)
http://blogs.msdn.com/oldnewthing/archive/2004/02/24/79212.aspx
You also don't want to pass GetDesktopWindow() as your hwndParent. If you create a child window whose parent is GetDesktopWindow(), your window is now glued to the desktop window. If your window then calls something like MessageBox(), well that's a modal dialog, and then the rules above kick in and the desktop gets disabled and the machine is toast.
Anyway, I suspect that it probably CAN be done, but whether you should is another question.

Categories

Resources