how to add a delay in program
-
Hi, I would like to know how to add a delay of say 1sec in my MDI program !!! Ehsan Behboudi
Sleep() - but then people may think you program is buggy or broken.:( Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
-
Hi, I would like to know how to add a delay of say 1sec in my MDI program !!! Ehsan Behboudi
maybe you want to use SetTimer SetTimer(TIMER_ID, time); Then just set up a message handler to check for TIMER_ID and do what you want in that message i think there are a few samples somewhere on this site :P
-
Hi, I would like to know how to add a delay of say 1sec in my MDI program !!! Ehsan Behboudi
1. Sleep, but it prevents the program from responding to any other event during the Sleep interval. 2. CreateEvent to create a dummy event, and then WaitForSingleObject "It was when I found out I could make mistakes that I knew I was on to something." -Ornette Coleman
-
Hi, I would like to know how to add a delay of say 1sec in my MDI program !!! Ehsan Behboudi
////////////////////////////////////////////////////////////////////////////////
// NAME
// Delay -- pause for N milliseconds
//
// SYNOPSIS
// void Delay(DWORD dwMsecs, BOOL bBlocking)
//
// DESCRIPTION
// Delay pauses for the number of milliseconds specified by dwMsecs.
// If bBlocking is FALSE, messages in the message queue will
// be processed. If bBlocking is TRUE, the message queue will
// not be processed until the delay period is expired.
//
// RETURN VALUE
// None.
//
////////////////////////////////////////////////////////////////////////////////
void Delay(DWORD dwMsecs, BOOL bBlocking)
{
DWORD dwStrtmsecs, dwCurmsecs;dwStrtmsecs = dwCurmsecs = ::GetTickCount(); do { if (!bBlocking) { MSG msg; if (::PeekMessage(&msg, NULL, 0, 0, PM\_REMOVE)) { ::TranslateMessage(&msg); ::DispatchMessage(&msg); } } dwCurmsecs = ::GetTickCount(); // check for timer overflow condition if (dwCurmsecs < dwStrtmsecs) dwStrtmsecs = dwCurmsecs; } while ((dwCurmsecs < (dwMsecs + dwStrtmsecs)));
}
HPS HwndSpy - GUI developer's aid to visually locate and inspect windows. For the month of August only, use coupon code CP-81239 for 30% off.
-
Hi, I would like to know how to add a delay of say 1sec in my MDI program !!! Ehsan Behboudi
-
Sleep() - but then people may think you program is buggy or broken.:( Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
:-D BuggyMax