Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Keep the program evaluating... even when minimized

Keep the program evaluating... even when minimized

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    bugDanny
    wrote on last edited by
    #1

    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

    D 1 Reply Last reply
    0
    • B bugDanny

      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

      D Offline
      D Offline
      Dy
      wrote on last edited by
      #2

      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

      B 1 Reply Last reply
      0
      • D 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

        B Offline
        B Offline
        bugDanny
        wrote on last edited by
        #3

        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 with AfxMessageBox("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

        D S 2 Replies Last reply
        0
        • B bugDanny

          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 with AfxMessageBox("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

          D Offline
          D Offline
          Dy
          wrote on last edited by
          #4

          bugDanny 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 call CWnd::SetTimer(0, 60000, NULL); in your OnTimer (and you don't need the CWnd:: bit in the first SetTimer call...)


          -Dy

          1 Reply Last reply
          0
          • B bugDanny

            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 with AfxMessageBox("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

            S Offline
            S Offline
            S Douglas
            wrote on last edited by
            #5

            bugDanny wrote: AfxMessageBox("Hey, wake up!"); Use MessageBox instead of the AfxMessageBox version. This should get you the desired results. ------------------------------- DEBUGGING : Removing the needles from the haystack.

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups