scrnsave.lib problem
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums
Results 1 to 2 of 2

Thread: scrnsave.lib problem

  1. #1
    Join Date
    Sep 2006

    Question scrnsave.lib problem

    I'm attempting to write a screen saver. scrnsave.lib has been linked but I keep getting the following error:

    1>scrnsave.lib(scrnsave.obj) : error LNK2019: unresolved external symbol _ScreenSaverProc@16 referenced in function _RealScreenSaverProc@16

    I'm at a bit of a loss here, Since this is at its most basic stage.

    Please help!!

    #include <windows.h>
    #include <scrnsave.h>
    void InitGL(HWND hWnd, HDC &hDC, HGLRC &hRC);
    void CloseGL(HWND hWnd, HDC hDC, HGLRC hRC);
    //globals used by the function below to hold the screen size
    int Width;	
    int Height;
    //define a Windows timer 
    #define TIMER 1 
    // Screen Saver Procedure
    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: 
        // get window dimensions
        GetClientRect( hWnd, &rect );
        Width = rect.right;		
        Height = rect.bottom;
        //get configuration from registry if applicable
        //set up OpenGL
        InitGL( hWnd, hDC, hRC );
        //Initialize perspective, viewpoint, and
        //any objects you wish to animate
        //create a timer that ticks every 10 milliseconds
        SetTimer( hWnd, TIMER, 10, NULL ); 
        return 0;
      case WM_DESTROY:
        KillTimer( hWnd, TIMER );
        //delete any objects created during animation
        //and close down OpenGL nicely
         CloseGL( hWnd, hDC, hRC );
        return 0;
      case WM_TIMER:
        //call some function to advance your animation		
        return 0;				
      //let the screensaver library take care of any
      //other messages
      return DefScreenSaverProc( 
        hWnd, message, wParam, lParam );
    static void InitGL(HWND hWnd, HDC & hDC, HGLRC & hRC)
      ZeroMemory( &pfd, sizeof pfd );
      pfd.nSize = sizeof pfd;
      pfd.nVersion = 1;
      pfd.iPixelType = PFD_TYPE_RGBA;
      pfd.cColorBits = 24;
      hDC = GetDC( hWnd );
      int i = ChoosePixelFormat( hDC, &pfd );  
      SetPixelFormat( hDC, i, &pfd );
      hRC = wglCreateContext( hDC );
      wglMakeCurrent( hDC, hRC );
    static void CloseGL(HWND hWnd, HDC hDC, HGLRC hRC)
      wglMakeCurrent( NULL, NULL );
      wglDeleteContext( hRC );
      ReleaseDC( hWnd, hDC );
    ScreenSaverConfigureDialog(HWND hDlg, UINT message, 
                               WPARAM wParam, LPARAM lParam)
        return FALSE;
    // needed for SCRNSAVE.LIB
    BOOL WINAPI RegisterDialogClasses(HANDLE hInst)
      return TRUE;

  2. #2
    Join Date
    Aug 1999

    Re: scrnsave.lib problem

    This might help,

    Creating a screen saver
    Ramkrishna Pawar

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

This is a survey!

HTML5 Development Center