Hi, I have been coding for a number of years but cut my teeth with mud (multi-user dungeon) merc code. I have never coded a gui program before only console based applications. I have a program that I am trying to write in gui and have sort of gotten the hang of some things but I can not for the life of me figure out how to get the program to do what I need it to. My question is this.
Is there any way to make the program popup a window at a certain time?
The program is supposed to be able to take in data for call backs at a call center and put them in a file (I have done that) then read the data from the file (I have done that) and check every 15 minutes to see if the time on the call back is now or has passed and pop up a window when that is the case (How on earth do I do that?)
As far as I can tell in a gui application there is a consistent while loop:

    /* Run the message loop. It will run until GetMessage() returns 0 */
    while (GetMessage (&messages, NULL, 0, 0))
    {
        if (NULL == hwnd || !IsDialogMessage(hwnd, &messages))
        {
            /* Translate virtual-key messages into character messages */
            TranslateMessage(&messages);
            /* Send message to WindowProcedure */
            DispatchMessage(&messages);
        }
    }

I can't interupt that loop or the user can't input anything and I can't put a check in it based on time because that only triggers when someone does something in the environment. I am at a loss here. Any help or insight would be greatly appreciated.

Recommended Answers

All 2 Replies

What about SetTimer() (see Timers)?. This allows you to specify a Window handle, so a WM_TIMER message will be posted to the message loop when it expires. Keep in mind that this won't be incredibly accurate.

Another option is to create another thread that calls Sleep(15*60*1000) (15 minutes) in a tight loop.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.