How do you display Taskbar notifications? - c#

How would one go about displaying taskbar notifications?
I want to write an app that periodically displays a flash card esque notification, the intention is to see if a 5 second or so distraction every hour can help with language learning.

In .NET you can use the Notification Icon to place a notification in the system tray.

For the application you describe, I probably wouldn't use a notification icon or taskbar icon. You'll likely need a larger window displayed, with larger font.
I'd open a frameless window (possibly faded or scrolled into view) that sits in the lower-left of the desktop. (Although of course remember that not everyone has the taskbar at the bottom of the screen).
As an example, look at what Outlook or many RSS readers do to notify of new messages - this feature is commonly called a "toast" pop-up.

Related

Cycle through open windows in C# using ALT+TAB/ESC and have the current window in focus and forced to be maximized (if already minimized to taskbar)?

I am writing a small application to automatically rotate through open windows on Windows 7/8.1/10 PC's. I have written the majority of the code and it is working well except I cannot figure out or find out what key presses to use to cycle through open applications.
I have tried SendKeys.Send("%{Tab 2}"); but this seems to only actually press the TAB button once as it keeps switching between the same two windows (even though more are open).
I have tried SendKeys.Send("%+{Esc}"); but this doesn't maximize windows that are minimized to the taskbar. It will effectively cycle through each open windows and bring them into focus (as evident by watching the white semi-transparent overlay on the taskbar item) but it won't show them on screen - I'm assuming because they started minimized. Only the maximized ones will show on screen when it's their turn.
Can anyone please assist? I'm sure it's a simple fix of maximizing the window it cycles to but I'm unsure how to implement this.
I haven't included the code of the entire application as I don't think it is relevant. If you do require it please let me know and I will add it.
Many thanks.

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.

How to show popup notifications in windows notification bars

I am creating my personal gmail checker in C# and I need a way to popup a notification in system tray whenever there is a new email and how to control the contents of that notification bar. Also if possible I don't need it to be like windows notifications but my personal way. For example not popup like a notification but like a rectangle (or square or whatever) and if windows taskbar is in autohide the taskbar not be shown but only the notification. Also it is a wpf app. If you need more info let me know
Sounds like you're looking at trying to create a "toaster"-style popup. You can take a look at including something like this WPF NotifyIcon:
This is an implementation of a NotifyIcon (aka system tray icon or taskbar icon) for the WPF platform. It does not just rely on the Windows Forms NotifyIcon component, but is a purely independent control which leverages several features of the WPF framework in order to display rich ToolTips, Popups, context menus, and balloon messages. It can be used directly in code or embedded in any XAML file.
You could also look at using a notification framework like Growl for Windows:
Ok, so what is Growl?
Put simply, Growl lets you know when things happen. Files finished downloading, friends came online, new email has arrived - Growl can let you know when any event occurs with a subtle notification. The rest of the time, Growl stays out of your way.
Along with letting you know when things happen, Growl also gives you full control over how you are notified and what action (if any) you want to take in response to the notification. You can choose to be alerted with a visual indicator or an audible alert, both, or neither. You can choose the type of display that is shown, whether the display remains on the screen, the importance of the notification, and even if the notification should be forwarded to another computer. You can have notifications that trigger an email, run a script, launch a program, or are read out loud.
You can find the documentation and Growl.net files on Growl's developer page.

divide the window to display a software, always on top

This function is like the "always on top", it is something like always occupy the right most area.
I wrote a software that the software will pull some messages from server periodically, so I want to put it into the right-most area of the screen, and never be overwriten by other windows unless the user press the minimize button.
So it means the other windows, even the maximize button is pressed, will only occupy the left side of the screen(the space that not be occupied by my software).
Is it achievable in MS Windows?
Sounds like the support for Application Desktop Toolbar is what you want:
An application desktop toolbar (also called an appbar) is a window that is similar to the Windows taskbar. It is anchored to an edge of the screen, and it typically contains buttons that give the user quick access to other applications and windows. The system prevents other applications from using the desktop area used by an appbar. Any number of appbars can exist on the desktop at any given time.
The best you can do is to make your window "always on top". You can't reserve part of the desktop exclusively for your application.

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.

Categories

Resources