I've got an app running maximized in a borderless window and need access to the windows taskbar on a given user event.
How would I bring the taskbar in foreground in .NET while running maximized?
Also an hint with regards to how to make it reliably go away wouldn't hurt! :)
EDIT: please note that I don't want the taskbar always on, I want it popping up on foreground just on a given user event, and then I want it to go away at will!
Um, don't run fullscreen? Maybe run maximized? Fullscreen app with taskbar is not a standard UI pattern.
What you could try doing is run maximized without the UI chrome (borderless window). Would let the taskbar in on the fun while still looking like a fullscreen app.
Interestingly enough, your desired solution seems to be the problem that caused this question. See my answer there. You may have to experiment a little with setting the FormBorderStyle and WindowState properties in a certain order, and try to minimize disturbance for the user.
Related
how can I start Firefox as hidden application in my C# application?
The ProcessStartInfo.CreateNoWindow property only applies to console mode apps. A regular GUI app requires a window to be functional. It is supposed to observe the ProcessStartInfo.WindowStyle property but not all GUI apps are well behaved, particularly when you ask for ProcessWindowStyle.Hidden. Which presents a user interface problem, can't get the window activated when it is hidden.
A minimized window is usually the best you can get, with a taskbar button.
I think. You are asking how to run a program without displaying in Task manager. ?? if its true, then You Can Set ShowInTaskBar Property to false of that Form. if not then can u explain what "Hidden Mode" means ? so that it is easy to solve the problem
Form.ShowInTaskBar=false;
http://msdn.microsoft.com/en-us/library/system.windows.forms.form.showintaskbar.aspx
I've built a C# app that I want to start just in the notification area. The icon appears when it is run, and it does not appear in the task bar (due to ShowInTaskbar = false & WindowState = Minimized). However when it first runs I can still alt-tab to it. Is there anyway to prevent this behaviour? Or have I missed a setting somewhere?
Thanks,
Psy
What you are seeing is correct behaviour, Alt+Tab will restore minimized windows.
It looks like you want a tray application, but be a bit more specific.
Take a look at this question.
I have a Windows Mobile application developed with Visual Studio 2008 and C# (Smart Device Project). When I run the application there's a start menu bar visible on the top and keyboard bar on the bottom. How can I make my application run in full-screen mode?
If possible I would like to have a solution that will allow me to turn full-screen mode on and off on runtime (after clicking some form button for example).
Getting rid of the keyboard/menu bar at the bottom is easy: just remove the MainMenu control from each of your forms.
Getting rid of the start menu (aka task bar) at the top of the screen is more difficult, and requires using the Windows API. This link shows how to do it.
There is a simpler way to make your application full-screen (sorry, it's early and I don't remember it right now), but the simpler method has an ugly side effect where the task bar momentarily reappears when you switch to another form in your application, which kind of kills the desired kiosk effect. Using the API as above to hide the task bar prevents this from happening.
However, there is a danger to this approach: if your application exits or crashes without having un-hidden the task bar, your user will have no way of unhiding it, and it will remain invisible until the device is reset.
Check Microsoft's example.
While example is for Windows Mobile 2003, you can pick syntax of SHFullScreen call from there. Here is already extracted call with example.
Try this on your main form; it might help:
this.WindowState = FormWindowState.Maximized;
I tested on Windows Mobile 6 Professional VGA emulator, it works. The keyboard button is missed too.
this.WindowState = FormWindowState.Maximized;
this.Menu = null;
this.ControlBox = false;
It a is a c# winform app. I've set ShowInTaskbar prop to false because I don't want the program to appear in taskbar, but like this SetForegroundWindow or ShowWindowAsync don't work.
Raymond Chen explains the things the govern the rules in Windows around foreground activation in his classic article Foreground activation permission is like love: You can't steal it, it has to be given to you. Roughly speaking, you cannot steal foreground activation using a call like SetForegroundWindow, you need to be given it from a process which already has the foreground activation.
In your case, when you have show in taskbar set, the taskbar is able to give your application the foreground activation, because when you click on the taskbar icon for your window, this will (briefly) give the activation to the taskbar. If you don't have the activation shown in the taskbar, you need to find a way to have an application that does give it to you. One way that is explicitly allowed is to use a notification window (tray) icon.
In an application that I am currently working on, a requirement is to bring a window of an external application to the foreground. Making Win32 API calls such as BringWindowToTop and SetForeground window do not work all the time. This is due to some restrictions within Windows XP. What I would like to do instead is send simulate a mouse click the window's button on the taskbar which I am hoping will bring the window to the front. Does anyone know how this is possible?
Check out the section "How to steal focus on 2K/XP" at http://www.codeproject.com/KB/dialog/dlgboxtricks.aspx, as this is exactly what you need. I wouldn't go the taskbar route as the taskbar could be hidden or simply not there.
It's possible. But it's extremely sketchy. Your application may also break with the next version of Windows, since it's undocumented. What you need to do is find the window handle of the taskbar, then find the window handle of the child window representing the button, then send it a WM_MOUSEDOWN (I think) message.
Here's a bit on finding the window handle of the taskbar:
http://www.codeproject.com/
FWIW, the restrictions on BringWindowToTop/SetForeground are there because it's irritating when a window steals focus. That may not matter if you're working on a corporate environment. Just keep it in mind. :)
I used this in a program where I needed to simulate clicks and mouse movements;
Global Mouse and Keyboard Library
To be honest I've never had an issue bringing a window to the foreground on XP/Vista/2003/2000.
You need to make sure you do the following:
Check if IsIconic (minimized)
If #1 results in true then call
ShowWindow passing SW_RESTORE
Then call SetForegroundWindow
I've never had problems that I can think of doing it with those steps.