How to Handle The Notification (Shell_NotifyIcon) to perform Some action when user clicked on It? - notifications

Iam NewBie, I have Created Tray Icon for my Application
with
void createTrayIcon(LpSTR msg)
{
memset(&m_NID, 0 , sizeof(m_NID));
m_NID.cbSize = sizeof(m_NID);
// set tray icon ID
m_NID.uID = ID_SYSTEMTRAY ;
// set handle to the window that receives tray icon notifications
ASSERT(::IsWindow(GetSafeHwnd()));
m_NID.hWnd = GetSafeHwnd();
// set message that will be sent from tray icon to the window
m_NID.uCallbackMessage = WM_TRAYICON_EVENT;
StringCchCopy(m_NID.szInfo, ARRAYSIZE(m_NID.szTip),msg);
StringCchCopy(m_NID.szInfoTitle, ARRAYSIZE(m_NID.szInfoTitle), L"DuOS");
// fields that are being set when adding tray icon
m_NID.uFlags = NIF_MESSAGE|NIF_ICON|NIF_INFO;
// set image
m_NID.hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
if(!m_NID.hIcon)
return FALSE;
return Shell_NotifyIcon(NIM_ADD, &m_NID);
}
I Am Showing the Notifications By Using
Shell_NotifyIcon(NIM_MODIFY , &m_NID);
My problem is I want to handle that Notification i.e, If user clicks on that
Notification I need to do some action, How to achieve this
I am trying for this from last two days I had Googled Lot of times and searched lot of blogs But I cant, Anyone Please Help me Out

Finally I Got the Answer ,
there was a NIN_BALOONUSERCLICK flag was there, if User clicks on Baloon it will return this Flag...

Related

Notification action buttons action without showing the app

I have a local notification with action buttons 'Start' and 'Remind later'. When I click on either of two, the app opens. I want to keep it for the Start button, but for Remind later button I want to silently run some code (reschedule notification on a later time) without opening an app.
Is this possible to do?
function onOpened(notification) {
if (notification.action == 'Start') {
cancelNotification(notification.id)
NavigationService.navigate(notification.title)
} else {
cancelNotification(notification.id)
// reschedule
let dateTime = new Date(notification.fireDate)
dateTime.setMinutes(dateTime.getMinutes() + 30)
scheduleNotification(notification.id, notification.title, notification.message, dateTime)
}
}
This code works, but as I said, it bring the app to the foreground, and I'd like to avoid it.
You need to include your full code if you looking for help, but from your tags, I assume you are using React Native Push Notifications. If that's the case you might want to look at this Action click brings the app from background to foreground issue. Basically, you need to go through some native codes and change a few lines.

Multiple occurence of web notification

I want to show a web notification to the user if they left the page open for 10 seconds. I have already taken the notification permission.
Problem here is the notification occurs multiple times even if the user comes back to the page in less than 10 secs. Already use clearTimeout for flushing myVar value....but no luck.....any help!
var myVar;
window.onblur = function myFunction() {
myVar = setTimeout(function () {
var notification = new Notification("XXX page is open in background ");
}, 10000);
clearTimeout(myVar);
};
want to make in such a way that only if user goes out of the page multiple times the notification will trigger everytime....but if he comes back to the page it will not appear..
Well, it could be due to testing. You must realize that window.onblur is triggered each time you leave the page. So if you leave, enter, leave, enter, leave, you will get 3 popups; each event runs independantly.
What you should do is call clearTimeout() in your window.onfocus event; don't forget to clear your myVar variable in both your popup handling code and your onfocus event (and test for it being null or not).

Tracking group upload with widget

I deployed Uploadcare and would like to track the widget multifilepick progress. My code:
function placeOrder(){
var widgets = uploadcare.initialize();
var widget = uploadcare.MultipleWidget('[role=uploadcare-uploader][data-multiple]');
widget.onUploadComplete(function(info) {
$('#orderForm').find('[type="submit"]').trigger('click');
});
};
Trying to execute a submit button only when the upload is complete. Here are the issues:
If a user clicks the button during upload the trigger gets fired immediately the upload completes taking away control from the user.
If a user clicks the button only after upload completes, nothing happens.
Anyone out there that can help? Thanks.

The app failed to resume properly from snapped view

When my Windows 8 app returns from snapped view, it sends the user to the first page of the app. I received a failure notice that my app fails to resume properly, however, Windows passed it before. Is it illegal to send the user to the first page, when the user resumes from snapped mode? How do I tell the app what page the user is located and to restore it?
When my app enter exits snapped mode, this code runs:
void ShowCurrentViewState()
{
//this.UpdateUnsnapButtonState();
// Query for the current view state
ApplicationViewState currentState = Windows.UI.ViewManagement.ApplicationView.Value;
if (currentState != ApplicationViewState.Snapped)
{
App.DataMode = Mode.Featured;
this.Frame.Navigate(typeof(RestaurantSearchDetails));
}
}
The Reading and writing data sample shows how you can navigate between two different screens and change the layout for each screen depending on the view state, snapped vs. filled.

Google Places - Autocomplete box - Bring suggestions to foreground

I have an application where I'm using a Ajax Modal Pop Up extender to allow a user to add a new user and map them to a location using the Google Places Autocomplete box.
Used something suggested here:
http://kishor-naik-dotnet.blogspot.in/2011/12/aspnet-google-map-version-3-in-aspnet.html
My problem is that when I use this on a normal page, the suggestions appear correctly, but on a modal pop up extender they appear in the background. I want to bring this to the foreground. How do I do it?
This might be a bit late, but it should work.
//Have to do this or else the autocomplete list is hidden under the popup window
var pacContainerInitialized = false;
$('#autocompleteMapSearch').keypress(function () {
if (!pacContainerInitialized) {
$('.pac-container').css('z-index', '9999');
pacContainerInitialized = true;
}
});