LRESULT WINAPI ScreenSaverProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { switch(uMsg) { case WM_CREATE: if (ss_init(hWnd) == 0) return -1; SetTimer(hWnd, 999, hack_delay / 1000, NULL); break; case WM_DESTROY: KillTimer(hWnd, 999); ss_term(); break; case WM_TIMER: hack_draw(&ss.modeinfo); break; default: return DefScreenSaverProc(hWnd, uMsg, wParam, lParam); } return 0; }
LONG WINAPI ScreenSaverProc(HWND hwnd,UINT message,WPARAM wparam,LPARAM lparam){ // Handles screen saver messages switch(message) { case WM_CREATE: // Creation of the screen saver window hWnd = hwnd; SetupOpenGL(); // Set Timer (Target 60 fps ish (1000/60 = 16) uTimer = SetTimer(hwnd, 1, 16, NULL); return 0; case WM_ERASEBKGND: // Erases the screen saver background // Not needed with OpenGL return 0; case WM_TIMER: // Handles the timer DrawGLScene(); return 0; case WM_DESTROY: // Cleans up the screen saver window KillTimer(hwnd, uTimer); KillGL(); PostQuitMessage(0); return 0; } return DefScreenSaverProc(hwnd,message,wparam,lparam); }
LRESULT WINAPI ScreenSaverProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { static HDC hDC; static HGLRC hRC; static RECT rect; switch (message) { case WM_CREATE: GetClientRect(hWnd, &rect); Width = rect.right; Height = rect.bottom; InitGL(hWnd, hDC, hRC); InitAnim(); SetTimer(hWnd, TIMER, 10, NULL); return 0; case WM_DESTROY: KillTimer(hWnd, TIMER); DestroyAnim(); CloseGL(hWnd, hDC, hRC); return 0; case WM_TIMER: DoAnim(); SwapBuffers(hDC); return 0; } return DefScreenSaverProc(hWnd, message, wParam, lParam); }
LRESULT WINAPI ScreenSaverProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { static HGLRC hRC; static DWORD timer = 1; HDC hDC; RECT WindowRect; int width; int height; switch (message) { case WM_CREATE: ReadRegistry(); hRC = InitOGLWindow(hWnd); GetClientRect (hWnd, &WindowRect); width = WindowRect.right - WindowRect.left; height = WindowRect.bottom - WindowRect.top; InitOpenGL(width,height); SetTimer(hWnd, timer, 5, NULL); break; case WM_TIMER: hDC = GetDC(hWnd); Display(); SwapBuffers(hDC); ReleaseDC(hWnd, hDC); break; case WM_DESTROY: wglMakeCurrent(NULL, NULL); wglDeleteContext(hRC); break; } return DefScreenSaverProc(hWnd, message, wParam, lParam); }
LRESULT WINAPI ScreenSaverProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { unsigned long ul; switch(uMsg) { case WM_CREATE: if (ss_init(hWnd) == 0) return -1; SetTimer(hWnd, 999, 0, NULL); break; case WM_DESTROY: KillTimer(hWnd, 999); ss_term(); break; case WM_TIMER: KillTimer(hWnd, 999); ul = hack_draw(ss.dpy, ss.window, ss.closure); SetTimer(hWnd, 999, ul / 1000, NULL); break; default: return DefScreenSaverProc(hWnd, uMsg, wParam, lParam); } return 0; }
LRESULT WINAPI ScreenSaverProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) { case WM_CREATE: InitSaver(hWnd); break; case WM_TIMER: OnTimer(hWnd, (UINT)wParam); break; case WM_DESTROY: KillTimer(hWnd, IDT_TIMER); PostQuitMessage(0); return 0; case WM_KEYDOWN: #ifdef DEBUG_MODE // in debug mode, user can exit program by press "ESC" if(VK_ESCAPE == wParam) PostQuitMessage(0); #endif if(IsMagicKey((char)wParam)) return 0; break; } #ifndef DEBUG_MODE return DefScreenSaverProc(hWnd, message, wParam, lParam); #else return DefWindowProc(hWnd, message, wParam, lParam); #endif }
LRESULT AppImplMswScreenSaver::eventHandler( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ) { switch( message ) { case WM_TIMER: mApp->getRenderer()->startDraw(); mApp->privateUpdate__(); mApp->privateDraw__(); mApp->getRenderer()->finishDraw(); return 0; break; case WM_DESTROY: mApp->getRenderer()->kill(); ::KillTimer( mWnd, TIMER_ID ); ::ReleaseDC( mWnd, mDC ); return 0; break; default: return DefScreenSaverProc( hWnd, message, wParam, lParam ); } }
LRESULT CALLBACK ScreenSaverProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { switch(message) { case WM_ERASEBKGND: // nothing to do return TRUE; case WM_CREATE: srand(time(NULL)); t1 = SetTimer(hWnd, 1, 203, NULL); CreateWorms(hWnd); break; case WM_DESTROY: KillTimer(hWnd, t1); delete pWuermer; break; case WM_TIMER: if (wParam == 1) DoPaint(hWnd); break; } return DefScreenSaverProc(hWnd, message, wParam, lParam); }
// Screen Saver Procedure LRESULT WINAPI ScreenSaverProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { switch ( message ) { case WM_CREATE: struct _timeb tb; _ftime( &tb ); // initialize random number generator srand((999*tb.time) + (1001*tb.millitm) + (1003 * _getpid())); if (gTimeCounter == 0.0) { gTimeCounter = currentTime(); } if (flurry_info == NULL) { flurry_info = (global_info_t*)malloc(sizeof(global_info_t)); } // enable OpenGL for the window ReadPresetFromRegistry(); EnableOpenGL( hWnd, &flurry_info->window, &flurry_info->glx_context); init_flurry( hWnd, flurry_info ); /* * this clamps the speed at below 60fps and, here * at least, produces a reasonably accurate 50fps. * (probably part CPU speed and part scheduler). * * Flurry is designed to run at this speed; much higher * than that and the blending causes the display to * saturate, which looks really ugly. */ //create a timer that ticks every 10 milliseconds // 40ms delay = 25fps // 30ms delay ~ 30fps // 20ms delay = 50fps SetTimer( hWnd, TIMER, 20, NULL ); return 0; case WM_DESTROY: KillTimer( hWnd, TIMER ); //delete any objects created during animation //and close down OpenGL nicely DisableOpenGL( hWnd, flurry_info->window, flurry_info->glx_context ); release_flurry(); return 0; case WM_TIMER: // call some function to advance your animation draw_flurry( &flurry_info->window, &flurry_info->glx_context ); return 0; } //let the screensaver library take care of any //other messages return DefScreenSaverProc(hWnd, message, wParam, lParam); }
LRESULT WINAPI ScreenSaverProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { RECT rc; HANDLE hPalMem; flightstruct *fs = &flights; int x, R,G,B; struct elem *pelem; switch (message) { case WM_CREATE: vLoadStrings(); GetIniSettings(); wTimer = SetTimer(hWnd, ID_TIMER, wElapse, NULL); // create timer for image refresh GetClientRect(hWnd, &rc); fs->centerx = rc.right / 2; fs->centery = rc.bottom / 2; fs->smallscrn = (rc.right < 320); fs->num = iRotorCnt; if (fs->elements == NULL) { // allocate memory if ((fs->elements = (struct elem *) malloc(sizeof(struct elem) * fs->num)) == 0) { exit(1); } if ((fs->savex = (LPINT)malloc(sizeof(INT) * iSegLen)) == 0) exit(1); if ((fs->savey = (LPINT)malloc(sizeof(INT) * iSegLen)) == 0) exit(1); } (void) memset(fs->savex,0, sizeof(fs->savex)); pelem = fs->elements; for (x = fs->num; --x >= 0; pelem++) { // define drift for segments pelem->radius_drift_max = (FLOAT)1.0; pelem->radius_drift_now = (FLOAT)1.0; pelem->end_radius = (FLOAT)100.0; // define end radius pelem->ratio_drift_max = (FLOAT)1.0; // define ratio drift pelem->ratio_drift_now = (FLOAT)1.0; pelem->end_ratio = (FLOAT)10.0; } srand((unsigned)time(NULL)); // seed random # generator fs->rotor = 0; fs->prev = 1; fs->lastx = fs->centerx; fs->lasty = fs->centery; fs->angle = (float)(rand() % (long)MAXANGLE) / 3; // define initial angle fs->r = iClrStart; // set start color value fs->firsttime = TRUE; // first time through hPalMem = LocalAlloc(LMEM_FIXED, sizeof(LOGPALETTE) + PALSIZE * sizeof(PALETTEENTRY)); if (!hPalMem) { return -1; } pLogPal = (NPLOGPALETTE) LocalLock(hPalMem); pLogPal->palVersion = 0x300; pLogPal->palNumEntries = PALSIZE; for (x=0, R=255, G=0, B=0; x < PALSIZE; x++) { cycle_colors(&R, &G, &B, 255, 0, 6); pLogPal->palPalEntry[x].peRed = LOBYTE(R); pLogPal->palPalEntry[x].peGreen = LOBYTE(G); pLogPal->palPalEntry[x].peBlue = LOBYTE(B); pLogPal->palPalEntry[x].peFlags = PC_RESERVED; } hPal = CreatePalette((LPLOGPALETTE)pLogPal); if (!hPal) { return -1; } break; case WM_ERASEBKGND: GetClientRect(hWnd,&rc); FillRect((HDC)wParam,&rc,(HBRUSH)GetStockObject(BLACK_BRUSH)); return 0L; break; case WM_TIMER: MoveImage(hWnd); break; case WM_DESTROY: if( wTimer ) // if timer was defined KillTimer(hWnd, ID_TIMER); // then kill it free( flights.savey ); // free any allocated memory free( flights.savex ); free( flights.elements ); if (hPal) { // free palette memory DeleteObject(hPal); } break; } return DefScreenSaverProc(hWnd, message, wParam, lParam); }
LONG WINAPI ScreenSaverProc(HWND hwnd_in,UINT message,WPARAM wparam,LPARAM lparam) { RECT r; int key; float delta_x, delta_y; POINT p; // Handles screen saver messages switch(message) { case WM_SIZE: width = LOWORD(lparam); // width of client area height = HIWORD(lparam); // height of client area if (wparam == SIZE_MAXIMIZED) { IniIntSet ("WindowMaximized", 1); } else { IniIntSet ("WindowWidth", width); IniIntSet ("WindowHeight", height); IniIntSet ("WindowMaximized", 0); } RenderResize (); break; case WM_KEYDOWN: key = (int) wparam; if (key == 'R') WorldReset (); else if (key == 'W') RenderWireframeToggle (); else if (key == 'E') RenderEffectCycle (); else if (key == 'L') RenderLetterboxToggle (); else if (key == 'F') RenderFPSToggle (); else if (key == 'G') RenderFogToggle (); else if (key == 'T') RenderFlatToggle (); else if (key == VK_F1) RenderHelpToggle (); else if (key == VK_ESCAPE) break; else if (!SCREENSAVER) { //Dev mode keys if (key == 'C') CameraAutoToggle (); if (key == 'B') CameraNextBehavior (); if (key == VK_F5) CameraReset (); if (key == VK_UP) CameraMedial (1.0f); if (key == VK_DOWN) CameraMedial (-1.0f); if (key == VK_LEFT) CameraLateral (1.0f); if (key == VK_RIGHT) CameraLateral (-1.0f); if (key == VK_PRIOR) CameraVertical (1.0f); if (key == VK_NEXT) CameraVertical (-1.0f); if (key == VK_F5) CameraReset (); return 0; } else break; return 0; case WM_MOVE: GetClientRect (hwnd, &r); height = r.bottom - r.top; width = r.right - r.left; IniIntSet ("WindowX", r.left); IniIntSet ("WindowY", r.top); IniIntSet ("WindowWidth", width); IniIntSet ("WindowHeight", height); half_width = width / 2; half_height = height / 2; return 0; case WM_LBUTTONDOWN: lmb = true; SetCapture (hwnd); break; case WM_RBUTTONDOWN: rmb = true; SetCapture (hwnd); break; case WM_LBUTTONUP: lmb = false; if (!rmb) { ReleaseCapture (); MoveCursor (select_pos.x, select_pos.y); } break; case WM_RBUTTONUP: rmb = false; if (!lmb) { ReleaseCapture (); MoveCursor (select_pos.x, select_pos.y); } break; case WM_MOUSEMOVE: p.x = LOWORD(lparam); // horizontal position of cursor p.y = HIWORD(lparam); // vertical position of cursor if (p.x < 0 || p.x > width) break; if (p.y < 0 || p.y > height) break; if (!mouse_forced && !lmb && !rmb) { select_pos = p; } if (mouse_forced) { mouse_forced = false; } else if (rmb || lmb) { CenterCursor (); delta_x = (float)(mouse_pos.x - p.x) * MOUSE_MOVEMENT; delta_y = (float)(mouse_pos.y - p.y) * MOUSE_MOVEMENT; if (rmb && lmb) { GLvector pos; CameraPan (delta_x); pos = CameraPosition (); pos.y += delta_y; CameraPositionSet (pos); } else if (rmb) { CameraPan (delta_x); CameraForward (delta_y); } else if (lmb) { GLvector angle; angle = CameraAngle (); angle.y -= delta_x; angle.x += delta_y; CameraAngleSet (angle); } } mouse_pos = p; break; case WM_CREATE: hwnd = hwnd_in; if (SCREENSAVER) AppInit (); SetTimer (hwnd, 1, 7, NULL); return 0; case WM_TIMER: AppUpdate (); return 0; case WM_DESTROY: PostQuitMessage(0); return 0; } #if SCREENSAVER return DefScreenSaverProc(hwnd_in,message,wparam,lparam); #else return DefWindowProc (hwnd_in,message,wparam,lparam); #endif }
LRESULT CALLBACK ScreenSaverProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { static RECT rect; static HBITMAP bitmap; switch (message) { case WM_CREATE: { bitmap = GetScreenSaverBitmap (); if (bitmap == NULL) { MessageBox(hWnd, _T("Fatal Error: Could not load bitmap"), _T("Error"), MB_OK | MB_ICONEXCLAMATION); } SetTimer(hWnd, APP_TIMER, APP_TIMER_INTERVAL, NULL); break; } case WM_PAINT: { BITMAP bm; /* Bitmap structure as seen in bmWidth & bmHeight */ PAINTSTRUCT ps; HDC hdc; HDC hdcMem; HBITMAP hbmOld; // Obtain window coordinates. GetClientRect (hWnd, &rect); hdc = BeginPaint(hWnd, &ps); hdcMem = CreateCompatibleDC(hdc); hbmOld = SelectObject(hdcMem, bitmap); GetObject(bitmap, sizeof(bm), &bm); if (rect.right < bm.bmWidth || rect.bottom < bm.bmHeight) { StretchBlt( hdc, RANDOM (0, rect.right - (bm.bmWidth /5)), RANDOM (0, rect.bottom - (bm.bmHeight /5)), bm.bmWidth /5, bm.bmHeight /5, hdcMem, 0, 0, bm.bmWidth, bm.bmHeight, SRCCOPY); } else { BitBlt( hdc, RANDOM (0, rect.right - bm.bmWidth), RANDOM (0, rect.bottom - bm.bmHeight), bm.bmWidth, bm.bmHeight, hdcMem, 0, 0, SRCCOPY); } SelectObject(hdcMem, hbmOld); DeleteDC(hdcMem); EndPaint(hWnd, &ps); break; } case WM_TIMER: { InvalidateRect(hWnd, NULL, 1); break; } case WM_DESTROY: { KillTimer(hWnd, APP_TIMER); DeleteObject(bitmap); PostQuitMessage(0); break; } default: // Pass Windows Messages to the default screensaver window procedure return DefScreenSaverProc(hWnd, message, wParam, lParam); } return 0; }
LRESULT WINAPI ScreenSaverProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { RECT rc; HANDLE hPalMem; switch (msg) { case WM_CREATE: { gravstruct *gp = &gravs; int i, R,G,B; unsigned char ball; vLoadStrings(); // load strings from table GetIniSettings(); // get settings from ini file (control.ini) wTimer = SetTimer(hWnd, ID_TIMER, wElapse, NULL); // create timer to move image GetClientRect(hWnd, &rc); // find size of screen gp->width = rc.right; gp->height = rc.bottom; gp->sr = STARRADIUS; gp->nplanets = iPlanets; srand((unsigned)time(NULL)); // seed random w/ timer if (!gp->planets) { gp->planets = (planetstruct*)malloc((gp->nplanets+1)*sizeof(planetstruct)); memset(gp->planets, 0, (gp->nplanets+1)*sizeof(planetstruct)); gp->starcolor = rand() % (PALSIZE-21); } for (ball = 0; ball <= gp->nplanets; ball++) init_planet(&(gp->planets[ball])); // Create a logical palette to play with hPalMem = LocalAlloc(LMEM_FIXED, sizeof(LOGPALETTE) + PALSIZE * sizeof(PALETTEENTRY)); if (!hPalMem) { // error("No memory for palette"); return -1; } pLogPal = (NPLOGPALETTE) LocalLock(hPalMem); pLogPal->palVersion = 0x300; pLogPal->palNumEntries = PALSIZE; for (i=0, R=255,G=0,B=0; i<PALSIZE; i++) { cycle_colors(&R,&G,&B,255,0,6); pLogPal->palPalEntry[i].peRed = LOBYTE(R); pLogPal->palPalEntry[i].peGreen = LOBYTE(G); pLogPal->palPalEntry[i].peBlue = LOBYTE(B); pLogPal->palPalEntry[i].peFlags = PC_RESERVED; } hPal = CreatePalette((LPLOGPALETTE)pLogPal); if (!hPal) { //Error("CreatePalette() failed"); return -1; } break; } case WM_TIMER: // BOUNCER-specific MoveImage(hWnd); // move image around break; case WM_DESTROY: // BOUNCER-specific if( wTimer ) KillTimer(hWnd, ID_TIMER); if (hPal) DeleteObject(hPal); free(gravs.planets); break; case WM_ERASEBKGND: GetClientRect(hWnd,&rc); FillRect((HDC)wParam,&rc,(HBRUSH)GetStockObject(BLACK_BRUSH)); return 0L; default: break; } return DefScreenSaverProc(hWnd, msg, wParam, lParam); }
EXTERN_C LONG WINAPI ScreenSaverProc( HWND hWnd, // Handle For This Window UINT uMsg, // Message For This Window WPARAM wParam, // Additional Message Information LPARAM lParam) // Additional Message Information { static HDC hDC = NULL; // Private GDI Device Context static HGLRC hRC = NULL; // Permanent Rendering Context static int nState; static int nFrames; switch (uMsg) // Check For Windows Messages { case WM_CREATE: { // Load settings CCuckooSettings settings; settings.Load(); // Load clock switch (settings.GetClockType()) { case 2: // Mickey g_pClock = new CClockMickey; break; case 1: // Wesminster g_pClock = new CClockWestminster; break; case 0: // Cuckoo g_pClock = new CClockCuckoo; break; default: // Error MessageBox(hWnd, _T("Unknown clock: Please configure the screen saver.\n\nHorloge inconnue: Veuillez reconfigurer l'écran de veille."), _T("Cuckoo"), MB_ICONEXCLAMATION); return -1; } if (g_pClock == NULL) { MessageBox(hWnd, _T("Not enought memory to load the clock."), _T("Cuckoo"), MB_ICONERROR); return -1; } // Initialize OpenGL on hWnd. if (!CreateGLWindow(hWnd, &hDC, &hRC)) return -1; // Starting state nState = STATE_SWAP_TEST; // Set timers SetTimer(hWnd, 1, 10, NULL); return 0; } case WM_DESTROY: // Timers KillTimer(hWnd, 1); // Clock if (g_pClock != NULL) { delete g_pClock; g_pClock = NULL; } // OpenGL KillGLWindow(hWnd, hDC, hRC); return 0; case WM_TIMER: switch (nState) { case STATE_SWAP_TEST: // Check if SwapBuffers() swap or copy back to front if (IsSwapBufferCopyingBackToFront(hDC)) g_pClock->SetSwapBufferMode(CClock::COPY_BACK_TO_FRONT); else g_pClock->SetSwapBufferMode(CClock::SWAP_BACK_AND_FRONT); nState++; break; case STATE_INIT_CLOCK: { // Load settings CCuckooSettings settings; settings.Load(); // Clock g_pClock->EnableSounds(settings.HasTicTacSound(), settings.BellsOnHours(), settings.BellsOnHalfHours(), settings.BellsOnQuartHours()); g_pClock->Init(); // Precise timing g_swTimer.Init(); g_swTimer.Start(); // Frame counter nFrames = 0; nState++; break; } case STATE_RENDER: // Met à jour l'heure if (++nFrames > 4) { nFrames = 0; g_pClock->UpdateTime(); } // Affiche la scène DrawGLScene(); glFlush(); SwapBuffers(hDC); break; } return 0; case WM_SYSCOMMAND: if (wParam == SC_MONITORPOWER) { // Load settings CCuckooSettings settings; settings.Load(); if (settings.IsDisabledOnMonitorTurnOff()) PostQuitMessage(0); } } // Pass All Unhandled Messages To DefScreenSaverProc return DefScreenSaverProc(hWnd, uMsg, wParam, lParam); }
LRESULT CALLBACK ScreenSaverProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { RECT Screen; // Used Later On To Get The Size Of The Window GLuint PixelFormat; // Pixel Format Storage static PIXELFORMATDESCRIPTOR pfd= // Pixel Format Descriptor { sizeof(PIXELFORMATDESCRIPTOR), // Size Of This Pixel Format Descriptor 1, // Version Number (?) PFD_DRAW_TO_WINDOW | // Format Must Support Window PFD_SUPPORT_OPENGL | // Format Must Support OpenGL PFD_DOUBLEBUFFER, // Must Support Double Buffering PFD_TYPE_RGBA, // Request An RGBA Format 16, // Select A 16Bit Color Depth 0, 0, 0, 0, 0, 0, // Color Bits Ignored (?) 0, // No Alpha Buffer 0, // Shift Bit Ignored (?) 0, // No Accumulation Buffer 0, 0, 0, 0, // Accumulation Bits Ignored (?) 16, // 16Bit Z-Buffer (Depth Buffer) 0, // No Stencil Buffer 0, // No Auxiliary Buffer (?) PFD_MAIN_PLANE, // Main Drawing Layer 0, // Reserved (?) 0, 0, 0 // Layer Masks Ignored (?) }; switch (message) { case WM_CREATE: LoadSettings(); // Gets A Device Context For The Window hDC = GetDC(hWnd); // Finds The Closest Match To The Pixel Format We Set Above PixelFormat = ChoosePixelFormat(hDC, &pfd); // No Matching Pixel Format? if (!PixelFormat) { MessageBox(0, _TEXT("Can't Find A Suitable PixelFormat."), _TEXT("Error"),MB_OK | MB_ICONERROR); // This Sends A 'Message' Telling The Program To Quit PostQuitMessage(0); break; } // Can We Set The Pixel Mode? if (!SetPixelFormat(hDC, PixelFormat, &pfd)) { MessageBox(0, _TEXT("Can't Set The PixelFormat."), _TEXT("Error"), MB_OK | MB_ICONERROR); // This Sends A 'Message' Telling The Program To Quit PostQuitMessage(0); break; } // Grab A Rendering Context hRC = wglCreateContext(hDC); // Did We Get One? if (!hRC) { MessageBox(0, _TEXT("Can't Create A GL Rendering Context."), _TEXT("Error"), MB_OK | MB_ICONERROR); // This Sends A 'Message' Telling The Program To Quit PostQuitMessage(0); break; } // Can We Make The RC Active? if (!wglMakeCurrent(hDC, hRC)) { MessageBox(0, _TEXT("Can't Activate GLRC."), _TEXT("Error"), MB_OK | MB_ICONERROR); // This Sends A 'Message' Telling The Program To Quit PostQuitMessage(0); break; } // Grab Screen Info For The Current Window GetClientRect(hWnd, &Screen); // Initialize The GL Screen Using Screen Info InitGL(Screen.right, Screen.bottom); break; case WM_DESTROY: // Disable Fullscreen Mode ChangeDisplaySettings(NULL, 0); // Deletes The Font Display List KillFont(); // Make The DC Current wglMakeCurrent(hDC, NULL); // Kill The RC wglDeleteContext(hRC); // Free The DC ReleaseDC(hWnd, hDC); break; case WM_PAINT: DrawGLScene(); SwapBuffers(hDC); break; case WM_SIZE: // Resizing The Screen // Resize To The New Window Size ReSizeGLScene(LOWORD(lParam), HIWORD(lParam)); break; default: // Pass Windows Messages to the default screensaver window procedure return DefScreenSaverProc(hWnd, message, wParam, lParam); } return 0; }