Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Linking scrnsave.lib in Borland 5.00

Posted on 1997-02-25
1
Medium Priority
?
418 Views
Last Modified: 2013-12-04
I'm trying to build a screen saver under Win 32 under Borland C++ 5.00.
I've tried the example provided under the WIN API help provided with the compiler, but when I try to make the project, I cannot link to the library SCRNSAVE.LIB.
I've included the header scrnsave.h but it seems like the compiler is searching for a library that I don't have on my version.
The file scrnsave.lib is missing in the lib section, but I'm not sure that it exists. I think that the solution must be anywhere nearby.

I include here the main file (taken by Win Api help) after some little cut and paste:

Thanks for your help


#include <windows.h>
#include <win32\scrnsave.h>
#include "sscarlo.rh"

#define MINVEL  1               /* minimum redraw-speed value    */
#define MAXVEL  10              /* maximum redraw-speed value    */
#define DEFVEL  5               /* default redraw-speed value    */

LONG    lSpeed = DEFVEL;        /* redraw-speed variable         */

HANDLE hMainInstance; /* screen saver instance handle  */

TCHAR  szAppName[APPNAMEBUFFERLEN];
//CHAR   szAppName[80];           /* .INI section name             */
CHAR   szTemp[20];              /* temporary array of characters */

CHAR   szRedrawSpeed[] = "Redraw Speed";   /* .INI speed entry   */

BOOL WINAPI ScreenSaverConfigureDialog(hDlg, message, wParam, lParam)
HWND  hDlg;
UINT  message;
DWORD wParam;
LONG  lParam;
{
    static HWND hSpeed; /* handle of speed scroll bar */
    static HWND hOK;    /* handle of OK push button */

    switch(message)
    {
        case WM_INITDIALOG:

            /* Retrieve the application name from the .RC file. */

            LoadString(hMainInstance, idsAppName, szAppName, 40);


            /* Retrieve the .INI (or registry) filename. */

            LoadString(hMainInstance, idsIniFile, szIniFile,
                MAXFILELEN);

            /* Retrieve any redraw-speed data from the registry. */

            lSpeed = GetPrivateProfileInt(szAppName, szRedrawSpeed,
                DEFVEL, szIniFile);
 
            /*
             * If the initialization file does not contain an entry
             * for this screen saver, use the default value.

             */

            if(lSpeed > MAXVEL || lSpeed < MINVEL)
                lSpeed = DEFVEL;

            /* Initialize the redraw-speed scroll bar control. */
 
            hSpeed = GetDlgItem(hDlg, ID_SPEED);
            SetScrollRange(hSpeed, SB_CTL, MINVEL, MAXVEL, FALSE);
            SetScrollPos(hSpeed, SB_CTL, lSpeed, TRUE);

            /* Retrieve a handle of the OK push button control. */

            hOK = GetDlgItem(hDlg, ID_OK);


            return TRUE;

        case WM_HSCROLL:
 
            /*
             * Process scroll bar input, adjusting the lSpeed
             * value as appropriate.
             */
 
            switch (LOWORD(wParam))
                {
                    case SB_PAGEUP:
                        --lSpeed;
                    break;
 
                    case SB_LINEUP:
                        --lSpeed;
                    break;

                    case SB_PAGEDOWN:

                        ++lSpeed;
                    break;

                    case SB_LINEDOWN:
                        ++lSpeed;
                    break;
 
                    case SB_THUMBPOSITION:
                        lSpeed = HIWORD(wParam);
                    break;
 
                    case SB_BOTTOM:
                        lSpeed = MINVEL;
                    break;

                    case SB_TOP:
                        lSpeed = MAXVEL;

                    break;

                    case SB_THUMBTRACK:
                    case SB_ENDSCROLL:
                        return TRUE;
                    break;
                }
                if ((int) lSpeed <= MINVEL)
                    lSpeed = MINVEL;
                if ((int) lSpeed >= MAXVEL)
                    lSpeed = MAXVEL;

                SetScrollPos((HWND) lParam, SB_CTL, lSpeed, TRUE);
            break;
 
        case WM_COMMAND:

            switch(LOWORD(wParam))
            {
                case ID_OK:
 
                   /*
                    * Write the current redraw-speed variable to
                    * the .INI file.
                    */

                    wsprintf(szTemp, "%ld", lSpeed);
                    WritePrivateProfileString(szAppName, szRedrawSpeed,
                        szTemp, szIniFile);

                case ID_CANCEL:
                    EndDialog(hDlg, LOWORD(wParam) == ID_OK);

                return TRUE;
            }
    }
    return FALSE;
}




BOOL WINAPI RegisterDialogClasses(hInst)
HANDLE  hInst;
{
    return TRUE;
}

LONG WINAPI ScreenSaverProc(hwnd, message, wParam, lParam)
HWND  hwnd;
UINT  message;
DWORD wParam;
LONG  lParam;
{
static HDC          hdc;    /* device-context handle */
static RECT         rc;     /* RECT structure */
static UINT         uTimer; /* timer identifier */
static UINT                    i;

    switch(message)
    {
        case WM_CREATE:

            /* Retrieve the application name from the .RC file. */
 
            LoadString(hMainInstance, idsAppName, szAppName, 40);

 
            /* Retrieve the .INI (or registry) filename. */

            LoadString(hMainInstance, idsIniFile, szIniFile,
                MAXFILELEN);
 
            /* Retrieve any redraw-speed data from the registry. */

            lSpeed = GetPrivateProfileInt(szAppName, szRedrawSpeed,
                DEFVEL, szIniFile);

           /*
            * Set a timer for the screen saver window using the
            * redraw-rate stored in REGEDIT.INI.

            */
 
            uTimer = SetTimer(hwnd, 1, lSpeed * 1000, NULL);
            break;
 
        case WM_ERASEBKGND:

           /*
            * The WM_ERASEBKGND message is issued before the
            * WM_TIMER message, allowing the screen saver to
            * paint the background as appropriate.
            */
 
            hdc = GetDC(hwnd);
            GetClientRect (hwnd, &rc);
            FillRect (hdc, &rc, GetStockObject(BLACK_BRUSH));

            ReleaseDC(hwnd,hdc);
            break;

        case WM_TIMER:
 
           /*
            * The WM_TIMER message is issued at (lSpeed * 1000)
            * intervals, where lSpeed == .001 seconds. This
            * code repaints the entire desktop with a white,
            * light gray, dark gray, or black brush each
            * time a WM_TIMER message is issued.
            */

            hdc = GetDC(hwnd);
            GetClientRect(hwnd, &rc);

            if (i++ <= 4)
                FillRect(hdc, &rc, GetStockObject(i));
            else
                (i = 0);
            ReleaseDC(hwnd,hdc);
            break;

        case WM_DESTROY:

           /*
            * When the WM_DESTROY message is issued, the screen saver
            * must destroy any of the timers that were set at WM_CREATE
            * time.
            */
 
            if (uTimer)
                KillTimer(hwnd, uTimer);

            break;
    }

   /*
    * DefScreenSaverProc processes any messages
    * ignored by ScreenSaverProc.
    */
 
    return DefScreenSaverProc(hwnd, message, wParam, lParam);
}
0
Comment
Question by:Carlo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 1

Accepted Solution

by:
dtowell earned 140 total points
ID: 1298640
The WIN32.HLP example you are using is documentation provided
by Microsoft (the compiler is Borland of course).  The example
assumes you have MSVC++.  MS and Borland object formats are not
the same so (of course) Borland did not ship a useless library
from Microsoft's SDK (as they did ship WIN32.HLP).  However,
SCRNSAVE.LIB is not required (it only contains a small amount
of glue code).  I have a trivial screen saver written in for
Borland's compiler (available via email: dwayne@imagebuilder.com)
if you need it.
0

Featured Post

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

What my article will show is if you ever had to do processing to a listbox without being able to just select all the items in it. My software Visual Studio 2008 crystal report v11 My issue was I wanted to add crystal report to a form and show…
After several hours of googling I could not gather any information on this topic. There are several ways of controlling the USB port connected to any storage device. The best example of that is by changing the registry value of "HKEY_LOCAL_MACHINE\S…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question