   [GDI+] Lagging movement
  Hello!Im using GDI+ to draw some images. This image can move around. But the problem is that movement is pretty laggy. Sometimes it jumps around instead of moving fluently. I wonder what is the reason for that. Is it because i use GetTickCount() to calculate the difference between two frames? Or is it because of GDI+? Thats my code:while(m_isRunning){while(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)){TranslateMessage(&msg);DispatchMessage(&msg);}Render();Sleep(5);}To update the player:void Player::Update(DWORD dwDiff){if(!GetFocus())return;LPBYTE keys = new BYTE[256];GetKeyboardState(keys);if(keys[VK_LEFT] & 0x80){if(m_position.X - dwDiff * 0.2f > 0)m_position.X -= dwDiff * 0.2f;}if(keys[VK_RIGHT] & 0x80){if(m_position.X + dwDiff * 0.2f < 525)m_position.X += dwDiff * 0.2f;}}void Renderer::RenderImgObject(ImageObject* pObj, Graphics& g, UINT& diff){if(!pObj)return;if(!pObj->GetImage())return;if(pObj->GetPosition().X < 0)return;pObj->Update(diff);PointF& pos = pObj->GetPosition();g.DrawImage(pObj->GetImage(), pos.X, pos.Y, pObj->GetWidth(), pObj->GetHeight());}Is there something wrong?GreetingsPlerion   
  Could be both. GDI+ is not the best choice for realtime-rendering, but you can probably tweak it by using low quality rendering.GetTickCount() returns milliseconds, but the accuracy is 5 ms or more according to the docs. A better approach might be using QueryPerformanceCounter. There are various threads here covering this problem.Hope that helpsunbird   