Guest User

SFML Windows 7 Taskbar Freeze Fix

a guest
Jul 15th, 2011
315
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.62 KB | None | 0 0
  1. #include <windows.h>
  2. #include <SFML/Graphics.hpp>
  3.  
  4. int CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
  5. {
  6.     sf::RenderWindow window(sf::VideoMode(400, 300), "Test");
  7.    
  8.     while(window.IsOpened())
  9.     {
  10.         // fix begin
  11.         MSG msg;
  12.         while(PeekMessage(&msg, NULL, 0xc042, 0xc042, PM_REMOVE))
  13.         {
  14.             TranslateMessage(&msg);
  15.             DispatchMessage(&msg);
  16.         }
  17.         // fix end
  18.         sf::Event event;
  19.         while(window.PollEvent(event))
  20.         {
  21.             if(event.Type == sf::Event::Closed)
  22.                 window.Close();
  23.         }
  24.         window.Clear(sf::Color::Black);
  25.         window.Display();
  26.         Sleep(200);
  27.     }
  28.  
  29.     return 0;
  30. }
Add Comment
Please, Sign In to add comment