I have an MFC dialog based application.
Please anyone tell me how to capture the Switch user(windows logged in user) event from this MFC program.
I tried to capture the WM_QUERYENDSESSION from the Dialog's WindowProc function and I could able to capture the Shutdown, Restart and log off events using WM_QUERYENDSESSION.
But the "Switch user" event is not getting called with WM_QUERYENDSESSION.
Any help is much appreciated.
Have a look at the WM_WTSSESSION_CHANGE message. Your application needs to call WTSRegisterSessionNotification() to receive this message.
Related
I have an app that prompts the user for confirmation on exit, which is (indirectly) done by opening a confirmation dialog when the WM_CLOSE message is received. However the message is also sent by the task manager when the user uses end task on the process.
Because I prevent the window from closing with the confirmation dialog, task manager sees it as the process hanging and forcefully terminates it preventing the app from doing a graceful exit when it's possible.
Is there any way to determine if it's the user closing the window from the message (e.g. clicking the close button, or Alt+F4), and not the task manager? As the message's parameters are unused the only way I could think of is checking for mouse events or WM_SYSCOMMAND that were received some time before the WM_CLOSE is received, but I'm unsure if this would handle all cases.
I assume the task manager calls EndTask. Perhaps in the old days it only sent WM_CLOSE but it seems to send WM_SYSCOMMAND when I tested now so there are no clues in the messages you can use, it just looks like a normal Alt+F4.
If your app is asking about unsaved changes in a document, I would say, put up the dialog regardless and just accept the hard termination if that is what the user wants.
If you are just trying to prevent an accidental close, call GetForegroundWindow in WM_CLOSE. If you are not foreground, it was not an accidental close.
My product works as following:
My application opens notification
My application exits
Now, when the user clicks the notification, my application is opened again. I DONT WANT it. I want that if user clicks the notification - it will just disappear
I found there is a callback for that (and it works)
- (void)userNotificationCenter:(NSUserNotificationCenter *)center didActivateNotification:(NSUserNotification *)notification
{
[center removeDeliveredNotification: notification];
}
but it works only when my application is running.
Is it possible to implement the behavior I want at all?
No it isn't possible to avoid having your application launched when a user touches your notification.
The application will always be launched in response to touching a notification and the UIApplicationDelegate method application:willFinishLaunchingWithOptions: will always be called when the application is not running.
Your app doesn't have to action on the notification, but it will be launched.
From a service, is there any way to create a pop up, application which is registered to my service may/may not be available, so i need to show a pop up/toast/notification message to user, is that possible in webOS
While I've never written a service, I don't see why this wouldn't be possible. Can a service launch an application? If so, set your application's no window mode to true. Launch the app, with some parameter indicating why it was launched. In the relaunch handler, check if that parameter is there, and if so, create a popup.
Is there a way in windows phone to track sent message event? i mean to say that whenever a message is sent then a function of my application execute
all i want is to execute a function whenever sent message button of windows phone is clicked?
If you open the message launcher (I don't remember the exact name), it'll open this screen and you have the event (something like application deactivated) and once the user sends the message, the screen should close and come back to your app (again another event is available at that point, activated).
So you'll have to play with the events to do something you like, IIRC there is no call back when the message button is clicked.
Here's a link with the lifecycle of apps
There is no API that notifies you if a message was sent (at least no open API). A similar question was asked here.
I'd like to hook the event that is triggered when an application is trying to notify you of something (when its icon background turns orange and starts flashing) so that I can create my own custom notifications (like getting a text message or email)
For example I'd like to have an event triggered when I receive an instant message on my computer that will send a message to my phone so I can respond appropriately.
How would I go about doing this?
Preferably I'd like something that could hook any notification event (then do the filtering inside the application, and something that works on windows XP and up)
Thanks
Duplicate of How can I determine which taskbar application/windows are requesting user attention ? Anyway, use RegisterShellHookWindow and catch HSHELL_FLASH