Click here to Skip to main content
15,911,785 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralWM_SIZE Question Pin
yellowine8-May-02 4:28
yellowine8-May-02 4:28 
GeneralRe: WM_SIZE Question Pin
Jeremy Falcon8-May-02 4:48
professionalJeremy Falcon8-May-02 4:48 
GeneralRe: WM_SIZE Question Pin
Paul M Watt8-May-02 4:59
mentorPaul M Watt8-May-02 4:59 
GeneralCProperty Sheet or Page problem Pin
8-May-02 4:05
suss8-May-02 4:05 
GeneralRe: CProperty Sheet or Page problem Pin
Prem Kumar8-May-02 8:32
Prem Kumar8-May-02 8:32 
GeneralDesign Question Pin
Tony Fontenot8-May-02 3:58
Tony Fontenot8-May-02 3:58 
GeneralRe: Design Question Pin
Niklas L8-May-02 4:54
Niklas L8-May-02 4:54 
GeneralRe: Design Question Pin
Paul M Watt8-May-02 5:07
mentorPaul M Watt8-May-02 5:07 
I would use a waitable timer. Because it will block your program while you are waiting, but if you expand your program in the future, you will have the ability to wake that thread up before the timer expires. With Sleep, your program will block for the same amount of time and this cannot be changed at runtime.

Here is an example from MSDN of how to use a waitable timer.
#include <windows.h>
#include <stdio.h>

int main()
{
    HANDLE hTimer = NULL;
    LARGE_INTEGER liDueTime;

    liDueTime.QuadPart=-100000000;

    // Create a waitable timer.
    hTimer = CreateWaitableTimer(NULL, TRUE, "WaitableTimer");
    if (!hTimer)
    {
        printf("CreateWaitableTimer failed (%d)\n", GetLastError());
        return 1;
    }

    printf("Waiting for 10 seconds...\n");

    // Set a timer to wait for 10 seconds.
    if (!SetWaitableTimer(
        hTimer, &liDueTime, 0, NULL, NULL, 0))
    {
        printf("SetWaitableTimer failed (%d)\n", GetLastError());
        return 2;
    }

    // Wait for the timer.

    if (WaitForSingleObject(hTimer, INFINITE) != WAIT_OBJECT_0)
        printf("WaitForSingleObject failed (%d)\n", GetLastError());
    else printf("Timer was signaled.\n");

    return 0;
}



Build a man a fire, and he will be warm for a day
Light a man on fire, and he will be warm for the rest of his life!

GeneralSMTP server Pin
Edilson Vasconcelos de Melo Junior8-May-02 3:12
Edilson Vasconcelos de Melo Junior8-May-02 3:12 
GeneralRe: SMTP server Pin
Nish Nishant8-May-02 3:44
sitebuilderNish Nishant8-May-02 3:44 
GeneralRe: SMTP server Pin
Edilson Vasconcelos de Melo Junior8-May-02 5:38
Edilson Vasconcelos de Melo Junior8-May-02 5:38 
GeneralRe: SMTP server Pin
David Cunningham8-May-02 4:11
cofounderDavid Cunningham8-May-02 4:11 
GeneralRe: SMTP server Pin
Edilson Vasconcelos de Melo Junior8-May-02 5:43
Edilson Vasconcelos de Melo Junior8-May-02 5:43 
QuestionSingle View & Multiple Document Problem? Pin
8-May-02 2:02
suss8-May-02 2:02 
AnswerRe: Single View & Multiple Document Problem? Pin
Jonathan Craig8-May-02 3:32
Jonathan Craig8-May-02 3:32 
GeneralRe: Single View & Multiple Document Problem? Pin
8-May-02 17:48
suss8-May-02 17:48 
GeneralRe: Single View & Multiple Document Problem? Pin
Jonathan Craig9-May-02 5:07
Jonathan Craig9-May-02 5:07 
GeneralDrag and Drop, (getting target info) Pin
8-May-02 1:22
suss8-May-02 1:22 
GeneralCommunicating to devices via RS232 to RS485 converter Pin
Agnihothra8-May-02 1:02
Agnihothra8-May-02 1:02 
GeneralRe: Communicating to devices via RS232 to RS485 converter Pin
Tim Smith8-May-02 2:42
Tim Smith8-May-02 2:42 
QuestionWhy Pointers? Pin
a.a8-May-02 0:58
a.a8-May-02 0:58 
AnswerRe: Why Pointers? Pin
8-May-02 1:25
suss8-May-02 1:25 
GeneralRe: Why Pointers? Pin
redeemer8-May-02 12:42
redeemer8-May-02 12:42 
GeneralRe: Why Pointers? Pin
8-May-02 22:36
suss8-May-02 22:36 
AnswerRe: Why Pointers? Pin
Philip Patrick8-May-02 1:34
professionalPhilip Patrick8-May-02 1:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.