5a8b9f3349c9b769d1d60dc12e68160b151514fb
2 * Copyright 2003 J Brown
3 * Copyright 2006 Eric Kohl
4 * Copyright 2007 Marc Piulachs (marc.piulachs@codexchange.net)
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
26 #define RANDOM( min, max ) ((rand() % (int)(((max)+1) - (min))) + (min))
28 #define APPNAME _T("Logon")
30 #define APP_TIMER_INTERVAL 2000
32 #define BITMAP_HEIGHT 240
33 #define BITMAP_WIDTH 340
35 HBITMAP
GetScreenSaverBitmap (void)
39 ZeroMemory(&osvi
, sizeof(OSVERSIONINFOEX
));
40 osvi
.dwOSVersionInfoSize
= sizeof(OSVERSIONINFOEX
);
41 GetVersionEx ((OSVERSIONINFO
*) &osvi
);
43 switch(osvi
.wProductType
)
45 case VER_NT_WORKSTATION
:
46 return LoadImage(GetModuleHandle(NULL
), MAKEINTRESOURCE(IDB_WORKSTATION
), IMAGE_BITMAP
, 0, 0, LR_CREATEDIBSECTION
);
49 return LoadImage(GetModuleHandle(NULL
), MAKEINTRESOURCE(IDB_SERVER
), IMAGE_BITMAP
, 0, 0, LR_CREATEDIBSECTION
);
55 ScreenSaverProc(HWND hWnd
, UINT message
, WPARAM wParam
, LPARAM lParam
)
58 static HBITMAP bitmap
;
64 GetClientRect(hWnd
, &rect
);
66 bitmap
= GetScreenSaverBitmap ();
72 _T("Fatal Error: Could not load bitmap"),
74 MB_OK
| MB_ICONEXCLAMATION
);
87 BITMAP bm
; /* Bitmap structure as seen in bmWidth & bmHeight */
90 HDC hdc
= BeginPaint(hWnd
, &ps
);
91 HDC hdcMem
= CreateCompatibleDC(hdc
);
92 HBITMAP hbmOld
= SelectObject(hdcMem
, bitmap
);
94 GetObject(bitmap
, sizeof(bm
), &bm
);
101 RANDOM (0, rect
.right
- BITMAP_WIDTH
),
102 RANDOM (0, rect
.bottom
- BITMAP_HEIGHT
),
110 SelectObject(hdcMem
, hbmOld
);
118 InvalidateRect(hWnd
, NULL
, 1);
123 KillTimer (hWnd
, APP_TIMER
);
124 DeleteObject(bitmap
);
130 // Pass Windows Messages to the default screensaver window procedure
131 return DefScreenSaverProc(hWnd
, message
, wParam
, lParam
);
137 BOOL WINAPI
ScreenSaverConfigureDialog(HWND hDlg
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
)
142 // This function is only called one time before opening the configuration dialog.
143 // Use it to show a message that no configuration is necesssary and return FALSE to indicate that no configuration dialog shall be opened.
144 BOOL WINAPI
RegisterDialogClasses(HANDLE hInst
)
146 TCHAR szMessage
[256];
149 LoadString(hInst
, IDS_TEXT
, szMessage
, sizeof(szMessage
) / sizeof(TCHAR
));
150 LoadString(hInst
, IDS_DESCRIPTION
, szTitle
, sizeof(szTitle
) / sizeof(TCHAR
));
152 MessageBox(NULL
, szMessage
, szTitle
, MB_OK
| MB_ICONEXCLAMATION
);