Click here to Skip to main content
15,913,854 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: vc60.pdb Pin
ashsri4-Dec-04 15:57
ashsri4-Dec-04 15:57 
GeneralRe: vc60.pdb Pin
Andy H4-Dec-04 22:17
Andy H4-Dec-04 22:17 
GeneralRe: vc60.pdb Pin
Gary R. Wheeler5-Dec-04 10:06
Gary R. Wheeler5-Dec-04 10:06 
Generalinterchanging between two dialog boxes Pin
haseeb_saeed4-Dec-04 10:34
haseeb_saeed4-Dec-04 10:34 
GeneralRe: interchanging between two dialog boxes Pin
John R. Shaw4-Dec-04 11:35
John R. Shaw4-Dec-04 11:35 
Questionhow to control program execution speed Pin
Mohammad A Gdeisat4-Dec-04 9:16
Mohammad A Gdeisat4-Dec-04 9:16 
AnswerRe: how to control program execution speed Pin
Stanciu Vlad4-Dec-04 9:37
Stanciu Vlad4-Dec-04 9:37 
AnswerRe: how to control program execution speed Pin
John R. Shaw4-Dec-04 10:34
John R. Shaw4-Dec-04 10:34 
This problem is as old as computers. We used to write code to do everying thing as fast a possible, because they where to slow. Now they are to fast.

1) You could do your animation in a seperate thread and use Sleep().

You might start by looking up "thread classes" in the MSDN library, then go onto look at other methods of handling threads.

2) (NO LONGER RECOMMENDED - BUT WORKS)
An older method that is not used much any more (I think) is to handle message passing in your own proccessing loop. This method has been used offten in game programing.

int Wait(DWORD dwDelay)
{
    clock_t nGoal = clock() + dwDelay;;
    if( PeekMessage(&msg,NULL,0,0,PM_REMOVE) )
    {
        TranslateMessage(&msg);
        DispatchMessage(&msg);
        if( msg.message == WM_QUIT )
            return -1; // closing down
        // check for other message that
        // tells use to quit
        .....
        // check if we need to stop
        if( clock() >= nGoal )
            break;
    }
    return 0; // times up
}

void ShowAnimation(...)
{
    ....
    ShowFirstFrame(...);
    for( ;; )
    {
        ShowNextFrame(...);
        ... // make some outher decisions
        // slow down (wait between frames)
        if( Wait(...) < 0 )
           break;
    }
}


This sample above uses the clock function but you could also use the mulimedia timer (See "Using Multimedia Timers" in MSDN).

How you apply apply the message passing code in your own code is up to you.

------------------------------------------------

Well that enough, there are probably other ways to accomplish this.

P.S. There are lots of sights (and books) dedicated to game programing and animation.

Good Luck!

INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
GeneralRe: how to control program execution speed Pin
Mohammad A Gdeisat5-Dec-04 5:43
Mohammad A Gdeisat5-Dec-04 5:43 
GeneralRe: how to control program execution speed Pin
David Crow6-Dec-04 3:08
David Crow6-Dec-04 3:08 
GeneralRe: how to control program execution speed Pin
Mohammad A Gdeisat6-Dec-04 9:31
Mohammad A Gdeisat6-Dec-04 9:31 
GeneralRe: how to control program execution speed Pin
David Crow6-Dec-04 9:39
David Crow6-Dec-04 9:39 
GeneralRegistering file type and icon Pin
SloanCode4-Dec-04 7:40
SloanCode4-Dec-04 7:40 
GeneralRe: Registering file type and icon Pin
Michael Dunn4-Dec-04 9:01
sitebuilderMichael Dunn4-Dec-04 9:01 
GeneralUser Interface - Advice Required Pin
Imtiaz Murtaza4-Dec-04 7:27
Imtiaz Murtaza4-Dec-04 7:27 
GeneralRe: User Interface - Advice Required Pin
Maximilien4-Dec-04 8:49
Maximilien4-Dec-04 8:49 
GeneralRe: User Interface - Advice Required Pin
toddbrooks4-Dec-04 9:37
toddbrooks4-Dec-04 9:37 
GeneralRe: User Interface - Advice Required Pin
peterchen5-Dec-04 0:36
peterchen5-Dec-04 0:36 
GeneralRe: User Interface - Advice Required Pin
Tareq Ahmed Siraj5-Dec-04 5:26
Tareq Ahmed Siraj5-Dec-04 5:26 
GeneralRe: User Interface - Advice Required Pin
Henry miller6-Dec-04 6:50
Henry miller6-Dec-04 6:50 
GeneralOninitUpdate Pin
jimjake4-Dec-04 4:01
jimjake4-Dec-04 4:01 
GeneralRe: OninitUpdate Pin
Ravi Bhavnani4-Dec-04 6:00
professionalRavi Bhavnani4-Dec-04 6:00 
QuestionHow to force the control to redraw? Pin
ytod4-Dec-04 3:44
ytod4-Dec-04 3:44 
AnswerRe: How to force the control to redraw? Pin
User 66584-Dec-04 4:22
User 66584-Dec-04 4:22 
AnswerRe: How to force the control to redraw? Pin
John R. Shaw4-Dec-04 10:54
John R. Shaw4-Dec-04 10:54 

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.