   Why can't my Flip function work?
int GameMain(){   static __int64 s;   s = GetTickCount();   while ( FAILED(lpDDSPrimary->Flip(NULL, DDFLIP_WAIT) );   while ( (GeTickCount()-s) <33 );   return 1;}I had loaded a bitmap into the back buffer(lpDDSBack).And then entered the game's loop, however it winked very strongly. It seemed that it winked 30 times in one second...( while ( (GeTickCount()-s) <33; )....:-(What do I have to do?Thanks in advanced...   
  If you write it out you get this:int GameMain(){   static __int64 s;   s = GetTickCount();   while ( FAILED(lpDDSPrimary->Flip(NULL, DDFLIP_WAIT) )   {   }   while ( (GeTickCount()-s) <33 )   {   }   return 1;}So it first does the flipping until it failes. and then it waits 33ms.I think you are looking for something like this:int GameMain(){   static __int64 s;   s = GetTickCount();   while ( FAILED(lpDDSPrimary->Flip(NULL, DDFLIP_WAIT) )   { while ( (GeTickCount()-s) <33 ) { } s = GetTickCount();   } return 1;};  Well, mldaalder  , thank you first!I just want to flip the screen, so I use 'lpDDSPrimary->Flip(NULL, DDFLIP_WAIT'until it succeedes, and at the same time I want to lock fps so... 'while ((GeTickCount()-s) <33 );'I found some codes use this way..but my can't.:-)By the way, Compare 'Blt' with 'Flip', which is better?Thanks![embarrass]//------------------------------------------------------------int CGame::GameInit(){//.....DDReloadBitmap( m_lpDDSBack, "alien.bmp" );//...}int CGame::GameRun(){static __int64 s;s = GetTickCount();ProcessInput();//---------// some drawing codes..//---------FlipScreen();while ( (GetTickCount() - s) < 33 );return 1;}void CGame::FlipScreen(){HRESULT hr;hr = m_lpDDSPrimary->Flip(NULL, DDFLIP_WAIT);if ( hr == DD_OK )return;if ( hr == DDERR_SURFACELOST )m_lpDDSPrimary->Restore();}//------------------------------------------------------------;  I'm afraid I only do OpenGL, I've tried DX ounce, but didn't find it usable, atleast, not in the same way as OpenGL.I just saw your problem and replied to it.   ;  When you flip your backbuffer becomes Primary buffer and you will see the image but your backbuffer is black now(because it is your last primary buffer). you should write the image again to the backbuffer before you flip again; for each fame:1.write the image to the backbuffer;2.  ...    s = GetTickCount();  while ( FAILED(lpDDSPrimary->Flip(NULL, DDFLIP_WAIT) );  while ( (GeTickCount()-s) <33 );  ...   ;Quote:Original post by KambizWhen you flip your backbuffer becomes Primary buffer and you will see the image but your backbuffer is black now(because it is your last primary bufferYeah, just it![totally]Well, there is not a cursor on the back buffer, so when I flip the screen, the cursor winks, how to resolve this problem?//-------------------WNDCLASSEX wcex;....wcex.hCursor = LoadCursorFromFile( "cursor.cur" );....//-------------------;Quote:Well, there is not a cursor on the back buffer, so when I flip the screen,the cursor winks, how to resolve this problem?//-------------------WNDCLASSEX wcex;....wcex.hCursor = LoadCursorFromFile( "cursor.cur" );....//-------------------No, the Windows cursor is drawn separately from your client area, this is by no means "the cursor is in the back buffer". Or you're talking about in-game cursor ?   