home *** CD-ROM | disk | FTP | other *** search
/ Chip: Shareware for Win 95 / Chip-Shareware-Win95.bin / ostatni / delphi / delphi1 / ssshell.exe / MONEY.C < prev    next >
Encoding:
C/C++ Source or Header  |  1995-10-20  |  2.7 KB  |  111 lines

  1. #define STRICT
  2. #include <WINDOWS.H>
  3. #include <MEMORY.H>
  4. #include <STRING.H>
  5. #include <STDLIB.H>
  6.  
  7. #define TIMERID 1000
  8.  
  9. HINSTANCE ghInstDLL = (HINSTANCE) 0;
  10. char gszAppName [] = "MONEYSS";
  11. char gszScreenSaverName [] = "Dollar Sign Screen Saver";
  12. UINT nTimer = 0;
  13.  
  14. LPSTR WINAPI _export GetScreenSaverName (void);
  15. void  WINAPI _export CreateScreenSaver (HWND);
  16. void  WINAPI _export DisplayScreenSaver (HWND);
  17. void  WINAPI _export DestroyScreenSaver (HWND);
  18. void  WINAPI _export ScreenSaverOptionsDlg (void);
  19.  
  20. // Compile and link this as "MONEY.DLL" and then rename it to "MONEY.DSS".  
  21. // Copy it to your Windows directory and from the DeskTop applet select
  22. // "ScreenSaver Shell".  Then select "Setup", "Select", and "MONEY.DSS".
  23.  
  24. // This is for the Set Options dialog box title.
  25. LPSTR WINAPI _export 
  26.   GetScreenSaverName 
  27.     (void)
  28. {
  29.   return (gszScreenSaverName);
  30. } // GetScreenSaverName
  31.  
  32. // Create a timer and perform any initialization here.
  33. void WINAPI _export 
  34.   CreateScreenSaver 
  35.     (HWND hWnd)
  36. {
  37.   nTimer = SetTimer (hWnd, TIMERID, 1000, NULL);
  38. } // CreateScreenSaver
  39.  
  40. // Do your "screensaver thing" here.
  41. void WINAPI _export 
  42.   DisplayScreenSaver 
  43.     (HWND hWnd)
  44. {
  45.   HDC hDc;
  46.   RECT Rect;
  47.   HFONT hFont, hFontOld;
  48.   LOGFONT lf;
  49.   COLORREF iPrevTextColor;
  50.   
  51.   hDc = GetDC (hWnd);
  52.   GetWindowRect (hWnd, &Rect);
  53.   FillRect (hDc, &Rect, GetStockObject (WHITE_BRUSH));
  54.   memset (&lf, 0, sizeof (LOGFONT));
  55.   lf.lfHeight = -60;
  56.   lf.lfWeight = FW_BOLD;
  57.   strcpy (lf.lfFaceName, "Times New Roman");
  58.   hFont = CreateFontIndirect (&lf);
  59.   hFontOld = SelectObject (hDc, hFont);
  60.   iPrevTextColor = SetTextColor (hDc, RGB (0, 150, 0));
  61.   TextOut (hDc, 
  62.            (int) ((long) (640 * (long) rand ()) / (long) RAND_MAX), 
  63.            (int) ((long) (480 * (long) rand ()) / (long) RAND_MAX), 
  64.            "$end Money!", 11);
  65.   SetTextColor (hDc, iPrevTextColor);
  66.   SelectObject (hDc, hFontOld);
  67.   DeleteObject (hFont);
  68.   ReleaseDC (hWnd, hDc);
  69. } // DisplayScreenSaver
  70.  
  71. // Return any windows resources you may have used here.
  72. void WINAPI _export 
  73.   DestroyScreenSaver 
  74.     (HWND hWnd)
  75. {
  76.   KillTimer (hWnd, nTimer);
  77. } // DestroyScreenSaver
  78.  
  79. // Setup an options dialog procedure here with MakeProcInstance, DialogBox, etc.
  80. void WINAPI _export 
  81.   ScreenSaverOptionsDlg 
  82.     (void)
  83. {
  84. } // ScreenSaverOptionsDlg
  85.  
  86. #ifdef __BORLANDC__
  87. #pragma argsused
  88. #endif
  89. int FAR PASCAL
  90.   WEP
  91.     (int iParameter)
  92. {
  93.   return (1);
  94. } // WEP
  95.  
  96. #ifdef __BORLANDC__
  97. #pragma argsused
  98. #endif
  99. int CALLBACK
  100.   LibMain
  101.     (HINSTANCE hInst,
  102.      WORD wDataSeg,
  103.      WORD wHeap,
  104.      LPSTR szCmdLine)
  105. {
  106.   if (wHeap > 0)
  107.     UnlockData (0);
  108.   ghInstDLL = hInst;
  109.   return (1);
  110. } // LibMain
  111.