I have a working Windows app that appears as an icon in the Windows system tray. When I click on my icon in the system tray it opens my application window, but the expanded system tray doesn't disappear. How do I tell the expanded system tray to hide itself once I've launched my application?
You don't. The notification area (often called "system tray") manages that stuff by itself, and applications shouldn't mess with it (that's why there are no APIs to affect substantially its behavior); read e.g. here.
Related
Is there any way to completely disable the taskbar in Windows 10 Home? I have a C# app that I want to display fullscreen on clients' displays without any sign of it running on Windows. It's supposed to run on startup and display a website.
I created a setup that changes most of the Windows settings via registry, like hiding desktop icons and altering logon view, but the taskbar remains visible. Auto hide doesn't satisfy me, because after the system boots the taskbar is still visible until you actually click somewhere on the desktop, and it takes a while for my app to run. I'd really appreciate some help.
When explorer is running, there taskbar will always be visible in some kind (even if it's a small border).
If you want to achieve something like a digital signage solution, you may replace the shell. Changing the shell will also provide some other benefits (most popups / balloontips won't occur anymore).
Be aware that this configuration is effective for all users on the system.
Path to the shell is available at
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\WinLogon\Shell
Update:
Just to hightlight:
It is indeed possible to have custom shells per user (see comments).
This is done by specifying a custom location of the shell path that is located in the registry for a given user.
Yes, you can totally disable the taskbar in Windows 10 but it is only temporary until you hover your mouse around the taskbar area.
Here's a tutorial: how to hide the taskbar in Windows 10
I have a C#/winforms application that runs minimized to the system tray. If I double click the EXE for this app it runs as it is supposed to, I see the process in task manager and the icon appears in the system tray. I also have a windows service which acts as a watchdog for the other app. If the winforms app gets closed the service restarts is using process.start
If the app is started from the service using process.start, firing off the same EXE file the process runs but the tray icon doesnt appear.
Just to be clear the winforms app puts the tray icon in place not the windows service.
Any idea why the app would react differently to a process.start than to a double click?
Edit: I may have partially answered my own question. The service is running as local system. Not sure some run as local system would be able to add an icon to my users system tray in the same manner a double click would. Does this sound like I am on the right track?
Yes, you're on the right track. Services run in a different session (session 0). If they open a window (which is highly discouraged), they are now called "interactive services". In that case, Windows pops up a dialog (see MSDN blog for a screenshot).
Similar things probably happen to the tray icon. Since you don't have a window, you don't get the popup dialog for interactive services, but the tray icon still exists in session 0, so you cannot see it.
If you're on Windows 8, interactive services have been disabled (MSDN) completely.
How to write a WinForms application that would not have any visible element except from a tray icon and at the same time allow the application to be closed by Windows Installer if the file is in use? As I understand it the Windows Installer sends a WM_CLOSE message to application's main window. I assume that the "main window" is indicated by MainForm property of ApplicationContext. Also it seems to me that for this mechanism to work the form must have been shown at least once.
I found some workarounds like creating an empty form and setting its opacity to 0 (to minimize flicker) then showing and hiding, but describing this as a nasty hack would heavily underestimate its ugliness.
Windows Installer does not send any WM_CLOSE messages. This might help:
http://haishibai.blogspot.com/2010/02/complete-tutorial-patch-restart-your.html
It's a slightly different scenario but might get you started if you want Windows Installer to tell your app when it should close down.
On recent operating system versions with Restart Manager a tray app will be detected. Back on Windows XP it wasn't detected.
In the WiX world there is a CloseApplication utility custom action that will send WM_CLOSE to the app window.
In applications like Skype, closing the window effectively minimizes to the taskbar on modern systems because notifications are shown directly on the taskbar overlay. In my case, I have a multi-window ecosystem. Is there a way to register some behavior assigned to a taskbar item that isn't part of the application lifecycle of a specific window? Are there ways to do this in .NET? WPF specifically?
Ideally this would be for a situation where starting the application doesn't create a window handle, just a process etc. Windows would be created contextually based on the usage. Resources would load on demand.
I am developing a Wpf application. On installing my application, shortcut icons are created in the desktop and the program menu.
When i click the desktop icon for the time, my application opens. Now i minimize my application in the tray/task bar. On clicking my desktop icon, my application is not maximized. It still minimized in the tray/task bar. For ex, you can take a look at Skype, adobe reader etc..
Requirement - where ever the application icon is present in the PC such as desktop or program menu or etc., my application should be maximized when the user clicks the shortcut icon.
A desktop link will open a new application every time you click on it. If you want your application to open only once and change position/size of the original one once you start a new one, you will have to do this yourself:
Once you application starts, check if another version is already running.
Send your running application a message.
End itself.
If there was no other application started, run normally and liste for the message.
On arrival of the message, check if minized and if so, maximize (or change size/position to whatever you need).
Try to implement it and if you have a very specific problem with any of the steps, come to SO and ask a very specific question about it :)