If I have a program running in the background and it needs the user to see it (like a dialog box) when it pops up, can I take the user out of Metro Mode (in Windows 8) for him to be able to see this notification?
I highly doubt it, such a capability would spawn a bunch of apps that would essentially try to take over and be very jarring for the user. Your desktop app though could generate a toast notification that would alert the user there is some action to take, see this MSDN topic for details.
I agree with Jim: switching context automatically from the desktop to Metro (or whatever they're calling it now) would be visually jarring and user-hostile. I realize the OS itself does this, like when you launch a desktop app from the Start screen. That doesn't make it good design.
Besides, when it does it, the user (presumably) wanted to interact with the newly-launched application. That's not necessarily the case when you're just showing a notification. There may not even be action required.
Instead, I recommend that you use Toast, the notification framework designed explicitly for this purpose. There's a sample application available for download: Sending toast notifications from desktop apps.
Note, however, that in order for Toast notifications to work from desktop applications, you must install a shortcut to your desktop application in the Start screen, with a System.AppUserModel.ID. This should be handled by your installer. More information is here.
Of course, the user can disable this by either turning off notifications or removing your app's shortcut from their Start screen. That's perfectly okay—if they take either of these actions, you can assume that they no longer want to receive notifications from your app.
Related
I'm new to Windows Phone development and I've found something about background agents in WP 7.5:
http://code.msdn.microsoft.com/wpapps/CSWP7ScheduledTaskAgent-6450bcf1
I wasn't able to find a way of making the toast notification fixed, I mean, when it appears on the screen it should disappear.
Is there any way of doing this? any advices, documentation should be great.
Thanks.
Toast Notification by the OS
When a toast notification is created, the OS handles the amount of time it is displayed for...
A toast notification displays for about 10 seconds unless the user
dismisses it with a flick to the right. If the user taps the toast, by
default, your app's start screen launches. Or, you can choose to
specify which screen of your app will launch.
Taken from the official documentation.
The API for toast notifications does not allow you to specify a time. Only a title, content and deep link into your app. This is the only type of toast/notification that can be used by a Background Agent. But it will appear:
on the Start screen
when your app is being used
when any other app is being used.
Custom toast-like notification (eg. Coding4Fun Toolkit's Toast Prompt)
A custom toast notification, although more flexible, must obey all the system rules unlike the system's Toast Notification which has special permissions.
This means the Coding4Fun Toolkit's Toast Prompt cannot:
Display notifications when your app is not running (apps cannot run in the background, they are essentially paused)
Display notifications when the user is on the Start screen or not using your app
Having a permanently (or long) displaying toast notification would be annoying to the user (hence the 10 second limit by the OS version) so do think carefully about why you need it - is the System Tray or MessageBox a better idea?
If you're new to Windows Phone, I would recommend using a handset for a while to get the feel for how the system works and how other apps use all kinds of notifications.
Using JUCE with TUIO, I'm developing a multi-touch utility to send "hot keys" commands to other applications (I am using a usb touch frame that sends TUIO messages). For instance, I provide an interface through which users can touch-and-hold to program a key combo and then tap that button to send the programmed key combo to another app. They way I accomplish this on OSX is by running my utility as a "background only" application (NSApplicationActivationPolicyProhibited). I use [NSWindow setCanHide: NO] so the GUI of my utility is visible even though it runs as a background app.
It works well except in the case that a window from another application is on top of mine. What happens is that touches get passed through that other app into mine- causing unintentional button pushes in my app. Normally, I could have my app only listen to the TUIO touch callback whenever is is the active application, [NSApp isActive]. But, since my app is background only, it is never active and I have no way to tell if another window is covering it to prevent touches.
So, is there any way for a "background only" app to be able to tell if it is on top of all other windows? Or, is there a way from within my app to get a list of all Cocoa windows from other applications and be able to tell if they are appearing on top of my "background only" app?
Also, does anyone know how I would go about all of the above in Windows? In other words, what is the Windows equivalent of NSApplicationActivationPolicyProhibited and would I be able to tell if it is covered by other applications' windows?
I've been searching forever for a solution to this, so I thought I'd seek out the brainpower of greater minds than mine. I'm developing a Cocoa app that uses the Accessibility API to manipulate another program (it's a hotkey app). The app I'm controlling typically has multiple windows open, with some hidden behind others. What I would like to do, if it's possible, is to send mouse events to windows using the Accessibility API in a way that presses a button in the window without bringing it to the foreground (interact with the window but don't activate it). The reason I'm trying to do this is that sending the mouse event to this other window will force it to the foreground and disrupt the user's interaction with the foremost window.
This is possible on Windows - apparently, because apps similar to mine do it there - but I'm getting the feeling that this isn't possible with Cocoa, given the way the window manager works. Am I mistaken?
Accessibility is higher-level than that. You send, for example, AXPress actions to AXButton objects, but “press” is not necessarily a click—pressing the space bar while a view is focused, for example, is also a “press”. AXPress is a high-level action that means “do your thing”, which obviously has meaning for some views (such as buttons) and not others (such as fields).
Accessibility activating the application does make sense when you look at it from its intended purpose: Assistive devices for disabled users. If the user “presses” something by whatever means, they probably intend to activate the application and work in it.
Quartz Event Services will get you almost there: You can create an event tap for the process you want to control, and you can forge events and send them to a tap. The catch is that you can only send events to a tap when the tap fires—i.e., when the application already has an event to deal with. When it doesn't, you're stuck.
I'd like to show another app's windows under my app's taskbar button. It's a background app that reports another process's windows as my app's own. Is there any universal way to do this, e.g. each "new" window, alert glow, progressmeter, and other taskbar features, show under my own app's button?
For example, Winfox runs under its own process and steals Firefox's windows. It also adds features, but that's irrelevant -- I just want to support another app's existing taskbar features under my own app's button -- multiple windows, progressmeter, alert flashing, error flashing, mini-icons, etc. Is there a near-universal way to steal an app, or is it largely app-specific? Thanks!
You should be able to use SetParent() to take ownership of a window, but I'm not sure how much this will help you in your attempt to add taskbar features to the legacy app.
new Windows 7 hides systray icons by default.
what is the recommended way to show information to users now?
I need to have a small clickable icon visible to user so user can access my "tool" anytime. Should I use the gadget to show my GUI instead? Can it communicate with my Delphi app somehow?
Without more information it's a little difficult to provide a recommendation.
However, I would imagine that a sufficiently important tool, the user would simply keep minimized. They could then use Jumplists to access quick functionality.
For example, Live Messenger uses this setup on Win7.
If your users really like your icon/application they can always choose to not hide your application.
The only difference is that only the user can choose which icon is shown, instead of every application claiming it's "real estate".
In my opinion this is a good functionality and if I were you I wouldn't change the application, just provide a first run GUI which explains how to make your tray icon visible in windows 7.
The entire reason why change was made, was to stop programs like yours. If you need to show information, go ahead and do so. But the notification areas ("systray") is not where shortcuts go. For that, you've got the start menu, desktop and/or the quick launch bar (and please let the user decide).