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;
Related
I created app that open every time that I start pc. So its so annoying to close it every time so I'm wondering if its some code that will hide my console app. I saw videos and tutorials on forms but idk how to do it with console app.
The easiest way to do this is change your console app to a windows app.
Console apps get a console made for them by Windows. But if you change it to a windows forms app, then windows expect the application to make a window, so if you never make a window, then it will never show
The other way is to turn your application into a service. This has some additional requirements in terms of programming
Option 1
You can use this run command:
start /min "SomeTitle" MyConsoleApp.exe myarg1 myarg2
Thus it will be on the taskbar minimized.
Option 2
If you use a file link in the start menu, select the start minimized option for the exe.
Option 3
Using a WinForm app you will be able to use a tray icon by setting the main form as not visible, to say it simply because it can be complex according to the expected behavior, and it will not be in the taskbar too.
Option 4
If you don't want a main form, create a win form app, delete the form file and the code in the main method, and you're done, without GUI nor console, no main input and no main output but you can show MessageBox and some forms when necessary, just a background process only visible in the Task Manager.
With that you can add a tray icon to to offer exit and some status information for example.
Option 5
Also you can create a windows service:
.NET console application as Windows service
Note
In all cases, if you don't use an internal message events dispatcher like the WinForms Application pattern or WPF and so on, be carefull to not saturate the CPU with the processings like with loops and use Thread.Sleep() between iterations or any thread idleing pattern or some timer if necessary.
How do we force an app to Suspend (NOT shutdown, just suspend) and then force-resume it ourselves when we are NOT using visual studio/debugging?
When running under Visual Studio 2012, you can enable the Debug Location on the debugger toolbar. This will allow you to select one of the three operations, "suspend", "resume", and "suspend and shutdown".
[edited]
Sorry, just noticed that you are asking for non VS solution. You can suspend your app by dragging the app down. Move your cursor to the top of the page until you see a hand. Click and hold it and pull down to suspend your app. It takes a few seconds before the app actually enter suspend mode. If you want to do things sooner, you can use visibility change to toggle certain action first, like saving critical stuff.
Is it possible to run applications on the Windows Desktop? I mean... that it can only be seen in the system tray, and it should be able to run alongside the desktop.
I have no idea how to code it, please help me. I'm kind of new to these things, I am supposed to create something like a "Stardock Fence".
I have seen some examples, but they seem buggy, any strong alternative I could use?
Process.Start() can be used to start a windows application/console app from another win application. There are parameters that allow you to optionally hide the UI as well.
You want your application's windows to be always-on-bottom. In other words, your UI will always appear to be beneath any other open window and just above the Desktop's icons.
To accomplish that, see these related questions.
Once you have a window always on the bottom of the z-order, you'll probably want to remove the non-client window chrome (titlebar/min/max/close buttons) so that your UI can look like a more integrated part of the Desktop. There's plenty of examples around; Googling is left as an exercise for the reader.
Not entirely sure what you mean by background. I expect you mean a Windows Service which is a project type in visual studio, or you might (less likely) mean running a background thread.
Actually, if you want it in the system-tray, you don't want it entirely in the background.
If it was to be fully "in the background", then your best bet is to have it as a service.
System tray icons need a window, but you can just make it non-visible and non-taskbar and that's fine.
A common combo is a service that does the actual heavy-lifting, and a hidden-window application with a systray icon that reports on the service's status (possibly making that same window visible when further interaction is needed).
You want to run your application in the background? Is it on a windows machine? If so then you want to look into running your application as a windows service. Here's an msdn link:
Introduction to Windows Services
There's examples in the article I think - if not it's a good starting point. You can configure services to start automatically on startup of the machine etc. Your application will then run in the background.
Basically you craete your application as normal and then host it in a windows service rather than say a console app or a winforms app.
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'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.