Keep the program evaluating... even when minimized
-
I wrote an app that will alert me when something happens after a certain amount of time. The app will also dump a file in a directory when it pops up with my alert message. The only problem is, it doesn't alert me if I minimize the dialog. It may still dump the file, I haven't been able to test that yet, but I want my app to still alert me and output this file even when minimized. Any help? Thnx, Danny
-
I wrote an app that will alert me when something happens after a certain amount of time. The app will also dump a file in a directory when it pops up with my alert message. The only problem is, it doesn't alert me if I minimize the dialog. It may still dump the file, I haven't been able to test that yet, but I want my app to still alert me and output this file even when minimized. Any help? Thnx, Danny
Can we see some code? I've written apps along the same lines without an issue, regardless of being minimised (to the task bar or the system tray). If we can see some code maybe we can investigate. How is the thing being triggered? An event / message / timer checking for "x" / thread checking for "x" etc.?
-Dy
-
Can we see some code? I've written apps along the same lines without an issue, regardless of being minimised (to the task bar or the system tray). If we can see some code maybe we can investigate. How is the thing being triggered? An event / message / timer checking for "x" / thread checking for "x" etc.?
-Dy
When the dialog is created I use
CWnd::SetTimer(0, 60000, NULL);
and then I catch it with:void CNewNotifyDlg::OnTimer(UINT nIDEvent) { // TODO: Add your message handler code here and/or call default OnRefresh(); CWnd::SetTimer(0, 60000, NULL); CDialog::OnTimer(nIDEvent); }
OnRefresh()
is my function to do my calculations and see if I should notify the user. I want this to run in the background, minimized the majority of the time, and then, if my app's logic dictates, I notify withAfxMessageBox("Hey, wake up!");
I didn't actually see the AfxMessageBox until I maximized the dialog (after I was informed that I had forgotten to do something in the office within a certain amount of time, Arrggh! :)). Danny -
When the dialog is created I use
CWnd::SetTimer(0, 60000, NULL);
and then I catch it with:void CNewNotifyDlg::OnTimer(UINT nIDEvent) { // TODO: Add your message handler code here and/or call default OnRefresh(); CWnd::SetTimer(0, 60000, NULL); CDialog::OnTimer(nIDEvent); }
OnRefresh()
is my function to do my calculations and see if I should notify the user. I want this to run in the background, minimized the majority of the time, and then, if my app's logic dictates, I notify withAfxMessageBox("Hey, wake up!");
I didn't actually see the AfxMessageBox until I maximized the dialog (after I was informed that I had forgotten to do something in the office within a certain amount of time, Arrggh! :)). DannybugDanny wrote: I didn't actually see the AfxMessageBox Your timer is being called. Try turning your speakers on - you should hear a beep with each message box each time the timer is executed. The message box however, is in the foregound of your app, and your app is minimised - so you don't see it. (Your data file is still being written out right?) You could do this:
if (IsIconic()) { ShowWindow(SW_RESTORE); }
in your timer, it will restore your dialog. Personally I don't think it's good form to be bringing windows up in front of the user like that, I'd rather minimise to the system tray and maybe use a balloon tooltip as a notification. You might want to have a look around this site for examples of that. Again, should you be new to this... you don't need to callCWnd::SetTimer(0, 60000, NULL);
in your OnTimer (and you don't need theCWnd::
bit in the first SetTimer call...)
-Dy
-
When the dialog is created I use
CWnd::SetTimer(0, 60000, NULL);
and then I catch it with:void CNewNotifyDlg::OnTimer(UINT nIDEvent) { // TODO: Add your message handler code here and/or call default OnRefresh(); CWnd::SetTimer(0, 60000, NULL); CDialog::OnTimer(nIDEvent); }
OnRefresh()
is my function to do my calculations and see if I should notify the user. I want this to run in the background, minimized the majority of the time, and then, if my app's logic dictates, I notify withAfxMessageBox("Hey, wake up!");
I didn't actually see the AfxMessageBox until I maximized the dialog (after I was informed that I had forgotten to do something in the office within a certain amount of time, Arrggh! :)). Danny