mirror of
https://github.com/reactos/reactos.git
synced 2025-07-05 08:11:22 +00:00
- Compile screensavers as UNICODE applications + minor fixes (Part 1/2)
svn path=/trunk/; revision=29965
This commit is contained in:
parent
9c46f3877e
commit
e985f75055
5 changed files with 371 additions and 375 deletions
|
@ -53,12 +53,12 @@ GLvoid BuildFont(GLvoid) // Build Our Bitmap Font
|
||||||
FALSE, // Italic
|
FALSE, // Italic
|
||||||
FALSE, // Underline
|
FALSE, // Underline
|
||||||
FALSE, // Strikeout
|
FALSE, // Strikeout
|
||||||
ANSI_CHARSET, // Character Set Identifier
|
DEFAULT_CHARSET, // Character Set Identifier
|
||||||
OUT_TT_PRECIS, // Output Precision
|
OUT_TT_PRECIS, // Output Precision
|
||||||
CLIP_DEFAULT_PRECIS, // Clipping Precision
|
CLIP_DEFAULT_PRECIS, // Clipping Precision
|
||||||
ANTIALIASED_QUALITY, // Output Quality
|
ANTIALIASED_QUALITY, // Output Quality
|
||||||
FF_DONTCARE|DEFAULT_PITCH, // Family And Pitch
|
FF_DONTCARE|DEFAULT_PITCH, // Family And Pitch
|
||||||
"Tahoma"); // Font Name
|
_T("Tahoma")); // Font Name
|
||||||
|
|
||||||
SelectObject(hDC, font); // Selects The Font We Created
|
SelectObject(hDC, font); // Selects The Font We Created
|
||||||
|
|
||||||
|
@ -77,14 +77,14 @@ GLvoid KillFont(GLvoid) // Delete The Font
|
||||||
glDeleteLists(base, 256); // Delete All 256 Characters
|
glDeleteLists(base, 256); // Delete All 256 Characters
|
||||||
}
|
}
|
||||||
|
|
||||||
GLvoid glPrint(char *text) // Custom GL "Print" Routine
|
GLvoid glPrint(LPWSTR text) // Custom GL "Print" Routine
|
||||||
{
|
{
|
||||||
if (text == NULL) // If There's No Text
|
if (text == NULL) // If There's No Text
|
||||||
return; // Do Nothing
|
return; // Do Nothing
|
||||||
|
|
||||||
glPushAttrib(GL_LIST_BIT); // Pushes The Display List Bits
|
glPushAttrib(GL_LIST_BIT); // Pushes The Display List Bits
|
||||||
glListBase(base); // Sets The Base Character to 32
|
glListBase(base); // Sets The Base Character to 32
|
||||||
glCallLists(strlen(text), GL_UNSIGNED_BYTE, text); // Draws The Display List Text
|
glCallLists(wcslen(text), GL_UNSIGNED_SHORT, text); // Draws The Display List Text
|
||||||
glPopAttrib(); // Pops The Display List Bits
|
glPopAttrib(); // Pops The Display List Bits
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -185,14 +185,14 @@ LRESULT CALLBACK WndProc( HWND hWnd,
|
||||||
|
|
||||||
if (!PixelFormat) // No Matching Pixel Format?
|
if (!PixelFormat) // No Matching Pixel Format?
|
||||||
{
|
{
|
||||||
MessageBox(0,"Can't Find A Suitable PixelFormat.","Error",MB_OK|MB_ICONERROR);
|
MessageBox(0,_TEXT("Can't Find A Suitable PixelFormat."),_TEXT("Error"),MB_OK|MB_ICONERROR);
|
||||||
PostQuitMessage(0); // This Sends A 'Message' Telling The Program To Quit
|
PostQuitMessage(0); // This Sends A 'Message' Telling The Program To Quit
|
||||||
break; // Prevents The Rest Of The Code From Running
|
break; // Prevents The Rest Of The Code From Running
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!SetPixelFormat(hDC,PixelFormat,&pfd)) // Can We Set The Pixel Mode?
|
if(!SetPixelFormat(hDC,PixelFormat,&pfd)) // Can We Set The Pixel Mode?
|
||||||
{
|
{
|
||||||
MessageBox(0,"Can't Set The PixelFormat.","Error",MB_OK|MB_ICONERROR);
|
MessageBox(0,_TEXT("Can't Set The PixelFormat."),_TEXT("Error"),MB_OK|MB_ICONERROR);
|
||||||
PostQuitMessage(0); // This Sends A 'Message' Telling The Program To Quit
|
PostQuitMessage(0); // This Sends A 'Message' Telling The Program To Quit
|
||||||
break; // Prevents The Rest Of The Code From Running
|
break; // Prevents The Rest Of The Code From Running
|
||||||
}
|
}
|
||||||
|
@ -200,14 +200,14 @@ LRESULT CALLBACK WndProc( HWND hWnd,
|
||||||
hRC = wglCreateContext(hDC); // Grab A Rendering Context
|
hRC = wglCreateContext(hDC); // Grab A Rendering Context
|
||||||
if(!hRC) // Did We Get One?
|
if(!hRC) // Did We Get One?
|
||||||
{
|
{
|
||||||
MessageBox(0,"Can't Create A GL Rendering Context.","Error",MB_OK|MB_ICONERROR);
|
MessageBox(0,_TEXT("Can't Create A GL Rendering Context."),_TEXT("Error"),MB_OK|MB_ICONERROR);
|
||||||
PostQuitMessage(0); // This Sends A 'Message' Telling The Program To Quit
|
PostQuitMessage(0); // This Sends A 'Message' Telling The Program To Quit
|
||||||
break; // Prevents The Rest Of The Code From Running
|
break; // Prevents The Rest Of The Code From Running
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!wglMakeCurrent(hDC, hRC)) // Can We Make The RC Active?
|
if(!wglMakeCurrent(hDC, hRC)) // Can We Make The RC Active?
|
||||||
{
|
{
|
||||||
MessageBox(0,"Can't Activate GLRC.","Error",MB_OK|MB_ICONERROR);
|
MessageBox(0,_TEXT("Can't Activate GLRC."),_TEXT("Error"),MB_OK|MB_ICONERROR);
|
||||||
PostQuitMessage(0); // This Sends A 'Message' Telling The Program To Quit
|
PostQuitMessage(0); // This Sends A 'Message' Telling The Program To Quit
|
||||||
break; // Prevents The Rest Of The Code From Running
|
break; // Prevents The Rest Of The Code From Running
|
||||||
}
|
}
|
||||||
|
@ -312,26 +312,25 @@ void InitSaver(HWND hwndParent)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ParseCommandLine(PSTR szCmdLine, int *chOption, HWND *hwndParent)
|
//
|
||||||
|
// Look for any options Windows has passed to us:
|
||||||
|
//
|
||||||
|
// -a <hwnd> (set password)
|
||||||
|
// -s (screensave)
|
||||||
|
// -p <hwnd> (preview)
|
||||||
|
// -c <hwnd> (configure)
|
||||||
|
//
|
||||||
|
VOID ParseCommandLine(LPWSTR szCmdLine, UCHAR *chOption, HWND *hwndParent)
|
||||||
{
|
{
|
||||||
int ch;
|
UCHAR ch = *szCmdLine++;
|
||||||
|
|
||||||
if (!strlen(szCmdLine))
|
|
||||||
return;
|
|
||||||
|
|
||||||
ch = *szCmdLine++;
|
|
||||||
|
|
||||||
if(ch == '-' || ch == '/')
|
if(ch == '-' || ch == '/')
|
||||||
ch = *szCmdLine++;
|
ch = *szCmdLine++;
|
||||||
|
|
||||||
if(ch >= 'A' && ch <= 'Z')
|
if(ch >= 'A' && ch <= 'Z')
|
||||||
ch += 'a' - 'A';
|
ch += 'a' - 'A'; //convert to lower case
|
||||||
|
|
||||||
*chOption = ch;
|
*chOption = ch;
|
||||||
|
|
||||||
if (ch == 's' || ch == 'c')
|
|
||||||
return;
|
|
||||||
|
|
||||||
ch = *szCmdLine++;
|
ch = *szCmdLine++;
|
||||||
|
|
||||||
if(ch == ':')
|
if(ch == ':')
|
||||||
|
@ -342,11 +341,11 @@ void ParseCommandLine(PSTR szCmdLine, int *chOption, HWND *hwndParent)
|
||||||
|
|
||||||
if(isdigit(ch))
|
if(isdigit(ch))
|
||||||
{
|
{
|
||||||
unsigned int i = atoi(szCmdLine - 1);
|
unsigned int i = _wtoi(szCmdLine - 1);
|
||||||
*hwndParent = (HWND)i;
|
*hwndParent = (HWND)i;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
*hwndParent = 0;
|
*hwndParent = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -387,13 +386,13 @@ void Configure(void)
|
||||||
DialogBox(hInstance, MAKEINTRESOURCE(IDD_CONFIG), NULL , (DLGPROC)ConfigDlgProc);
|
DialogBox(hInstance, MAKEINTRESOURCE(IDD_CONFIG), NULL , (DLGPROC)ConfigDlgProc);
|
||||||
}
|
}
|
||||||
|
|
||||||
int WINAPI WinMain (HINSTANCE hInst,
|
int CALLBACK wWinMain (HINSTANCE hInst,
|
||||||
HINSTANCE hPrev,
|
HINSTANCE hPrev,
|
||||||
LPSTR lpCmdLine,
|
LPWSTR lpCmdLine,
|
||||||
int iCmdShow)
|
int iCmdShow)
|
||||||
{
|
{
|
||||||
HWND hwndParent = 0;
|
HWND hwndParent = 0;
|
||||||
int chOption = 0;
|
UCHAR chOption;
|
||||||
MSG Message;
|
MSG Message;
|
||||||
|
|
||||||
hInstance = hInst;
|
hInstance = hInst;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<!DOCTYPE module SYSTEM "../../../../tools/rbuild/project.dtd">
|
<!DOCTYPE module SYSTEM "../../../../tools/rbuild/project.dtd">
|
||||||
<module name="3dtext" type="win32scr" installbase="system32" installname="3dtext.scr">
|
<module name="3dtext" type="win32scr" installbase="system32" installname="3dtext.scr" unicode="true">
|
||||||
<define name="__USE_W32API" />
|
<define name="__USE_W32API" />
|
||||||
<library>kernel32</library>
|
<library>kernel32</library>
|
||||||
<library>user32</library>
|
<library>user32</library>
|
||||||
|
|
|
@ -36,7 +36,7 @@ void LoadSettings()
|
||||||
|
|
||||||
if(RegQueryValueEx(hkey, _T("DisplayString"), 0, 0, (LPBYTE)m_Text, &len) != ERROR_SUCCESS)
|
if(RegQueryValueEx(hkey, _T("DisplayString"), 0, 0, (LPBYTE)m_Text, &len) != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
strcpy(m_Text , "ReactOS Rocks!");
|
_tcscpy(m_Text , _TEXT("ReactOS Rocks!"));
|
||||||
}
|
}
|
||||||
|
|
||||||
RegCloseKey(hkey);
|
RegCloseKey(hkey);
|
||||||
|
|
|
@ -1,332 +1,332 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2003 J Brown
|
* Copyright 2003 J Brown
|
||||||
* Copyright 2006 Eric Kohl
|
* Copyright 2006 Eric Kohl
|
||||||
* Copyright 2007 Marc Piulachs (marc.piulachs@codexchange.net)
|
* Copyright 2007 Marc Piulachs (marc.piulachs@codexchange.net)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <tchar.h>
|
#include <tchar.h>
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
|
|
||||||
#define RANDOM( min, max ) ((rand() % (int)(((max)+1) - (min))) + (min))
|
#define RANDOM( min, max ) ((rand() % (int)(((max)+1) - (min))) + (min))
|
||||||
|
|
||||||
#define APPNAME _T("Logon")
|
#define APPNAME _T("Logon")
|
||||||
#define APP_TIMER 1
|
#define APP_TIMER 1
|
||||||
#define APP_TIMER_INTERVAL 2000
|
#define APP_TIMER_INTERVAL 2000
|
||||||
|
|
||||||
#define BITMAP_HEIGHT 240;
|
#define BITMAP_HEIGHT 240;
|
||||||
#define BITMAP_WIDTH 340
|
#define BITMAP_WIDTH 340
|
||||||
|
|
||||||
HINSTANCE hInstance;
|
HINSTANCE hInstance;
|
||||||
|
|
||||||
BOOL fullscreen = FALSE;
|
BOOL fullscreen = FALSE;
|
||||||
|
|
||||||
void DrawScreen (HDC hdc, HDC hMemDC , RECT rect)
|
void DrawScreen (HDC hdc, HDC hMemDC , RECT rect)
|
||||||
{
|
{
|
||||||
int x;
|
int x;
|
||||||
int y;
|
int y;
|
||||||
int width = BITMAP_WIDTH;
|
int width = BITMAP_WIDTH;
|
||||||
int height = BITMAP_HEIGHT;
|
int height = BITMAP_HEIGHT;
|
||||||
|
|
||||||
if (!fullscreen)
|
if (!fullscreen)
|
||||||
{
|
{
|
||||||
width = width / 20;
|
width = width / 20;
|
||||||
height = height / 20;
|
height = height / 20;
|
||||||
}
|
}
|
||||||
|
|
||||||
x = RANDOM (0, rect.right - width);
|
x = RANDOM (0, rect.right - width);
|
||||||
y = RANDOM (0, rect.bottom - height);
|
y = RANDOM (0, rect.bottom - height);
|
||||||
|
|
||||||
BitBlt(
|
BitBlt(
|
||||||
hdc,
|
hdc,
|
||||||
x,
|
x,
|
||||||
y,
|
y,
|
||||||
width,
|
width,
|
||||||
height,
|
height,
|
||||||
hMemDC,
|
hMemDC,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
SRCCOPY);
|
SRCCOPY);
|
||||||
}
|
}
|
||||||
|
|
||||||
HBITMAP GetScreenSaverBitmap (void)
|
HBITMAP GetScreenSaverBitmap (void)
|
||||||
{
|
{
|
||||||
OSVERSIONINFOEX osvi;
|
OSVERSIONINFOEX osvi;
|
||||||
|
|
||||||
ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX));
|
ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX));
|
||||||
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
|
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
|
||||||
GetVersionEx ((OSVERSIONINFO *) &osvi);
|
GetVersionEx ((OSVERSIONINFO *) &osvi);
|
||||||
|
|
||||||
switch(osvi.wProductType)
|
switch(osvi.wProductType)
|
||||||
{
|
{
|
||||||
case VER_NT_WORKSTATION:
|
case VER_NT_WORKSTATION:
|
||||||
return LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_WORKSTATION));
|
return LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_WORKSTATION));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_SERVER));
|
return LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_SERVER));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT WINAPI WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
LRESULT WINAPI WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
static POINT ptLast;
|
static POINT ptLast;
|
||||||
static POINT ptCursor;
|
static POINT ptCursor;
|
||||||
static BOOL fFirstTime = TRUE;
|
static BOOL fFirstTime = TRUE;
|
||||||
|
|
||||||
static PAINTSTRUCT ps;
|
static PAINTSTRUCT ps;
|
||||||
static RECT rect;
|
static RECT rect;
|
||||||
static HDC hDC;
|
static HDC hDC;
|
||||||
static HDC hMemDC;
|
static HDC hMemDC;
|
||||||
static HBRUSH hBlkBrush;
|
static HBRUSH hBlkBrush;
|
||||||
static HBITMAP bitmap;
|
static HBITMAP bitmap;
|
||||||
|
|
||||||
switch (msg)
|
switch (msg)
|
||||||
{
|
{
|
||||||
case WM_CREATE:
|
case WM_CREATE:
|
||||||
{
|
{
|
||||||
hDC = GetDC(hwnd);
|
hDC = GetDC(hwnd);
|
||||||
hBlkBrush = (HBRUSH) GetStockObject(BLACK_BRUSH);
|
hBlkBrush = (HBRUSH) GetStockObject(BLACK_BRUSH);
|
||||||
hMemDC = CreateCompatibleDC(hDC);
|
hMemDC = CreateCompatibleDC(hDC);
|
||||||
GetClientRect(hwnd, &rect);
|
GetClientRect(hwnd, &rect);
|
||||||
|
|
||||||
bitmap = GetScreenSaverBitmap ();
|
bitmap = GetScreenSaverBitmap ();
|
||||||
|
|
||||||
if(bitmap == NULL)
|
if(bitmap == NULL)
|
||||||
{
|
{
|
||||||
MessageBox(
|
MessageBox(
|
||||||
hwnd,
|
hwnd,
|
||||||
_T("Fatal Error: Could not load bitmap"),
|
_T("Fatal Error: Could not load bitmap"),
|
||||||
_T("Error"),
|
_T("Error"),
|
||||||
MB_OK | MB_ICONEXCLAMATION);
|
MB_OK | MB_ICONEXCLAMATION);
|
||||||
}
|
}
|
||||||
|
|
||||||
SetTimer (
|
SetTimer (
|
||||||
hwnd,
|
hwnd,
|
||||||
APP_TIMER,
|
APP_TIMER,
|
||||||
APP_TIMER_INTERVAL,
|
APP_TIMER_INTERVAL,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case WM_PAINT:
|
case WM_PAINT:
|
||||||
{
|
{
|
||||||
hDC = BeginPaint(hwnd, &ps);
|
hDC = BeginPaint(hwnd, &ps);
|
||||||
SelectObject(hMemDC, bitmap);
|
SelectObject(hMemDC, bitmap);
|
||||||
DrawScreen (hDC , hMemDC , rect);
|
DrawScreen (hDC , hMemDC , rect);
|
||||||
EndPaint(hwnd, &ps);
|
EndPaint(hwnd, &ps);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case WM_TIMER :
|
case WM_TIMER :
|
||||||
{
|
{
|
||||||
if (wParam == APP_TIMER)
|
if (wParam == APP_TIMER)
|
||||||
{
|
{
|
||||||
InvalidateRect(hwnd, NULL, 1);
|
InvalidateRect(hwnd, NULL, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case WM_ERASEBKGND:
|
case WM_ERASEBKGND:
|
||||||
{
|
{
|
||||||
SelectObject(hDC, hBlkBrush);
|
SelectObject(hDC, hBlkBrush);
|
||||||
|
|
||||||
PatBlt(
|
PatBlt(
|
||||||
hDC,
|
hDC,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
rect.right,
|
rect.right,
|
||||||
rect.bottom,
|
rect.bottom,
|
||||||
PATCOPY);
|
PATCOPY);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case WM_DESTROY:
|
case WM_DESTROY:
|
||||||
{
|
{
|
||||||
KillTimer (hwnd, APP_TIMER);
|
KillTimer (hwnd, APP_TIMER);
|
||||||
DeleteObject(bitmap);
|
DeleteObject(bitmap);
|
||||||
ShowCursor(TRUE);
|
ShowCursor(TRUE);
|
||||||
PostQuitMessage(0);
|
PostQuitMessage(0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// break out of screen-saver if any keyboard activity
|
// break out of screen-saver if any keyboard activity
|
||||||
case WM_NOTIFY:
|
case WM_NOTIFY:
|
||||||
case WM_SYSKEYDOWN:
|
case WM_SYSKEYDOWN:
|
||||||
PostMessage(hwnd, WM_CLOSE, 0, 0);
|
PostMessage(hwnd, WM_CLOSE, 0, 0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// break out of screen-saver if any mouse activity
|
// break out of screen-saver if any mouse activity
|
||||||
case WM_LBUTTONDOWN:
|
case WM_LBUTTONDOWN:
|
||||||
case WM_LBUTTONUP:
|
case WM_LBUTTONUP:
|
||||||
case WM_RBUTTONDOWN:
|
case WM_RBUTTONDOWN:
|
||||||
case WM_RBUTTONUP:
|
case WM_RBUTTONUP:
|
||||||
case WM_MBUTTONDOWN:
|
case WM_MBUTTONDOWN:
|
||||||
case WM_MBUTTONUP:
|
case WM_MBUTTONUP:
|
||||||
case WM_MOUSEMOVE:
|
case WM_MOUSEMOVE:
|
||||||
// If we've got a parent then we must be a preview
|
// If we've got a parent then we must be a preview
|
||||||
if(GetParent(hwnd) != 0)
|
if(GetParent(hwnd) != 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if(fFirstTime)
|
if(fFirstTime)
|
||||||
{
|
{
|
||||||
GetCursorPos(&ptLast);
|
GetCursorPos(&ptLast);
|
||||||
fFirstTime = FALSE;
|
fFirstTime = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
GetCursorPos(&ptCursor);
|
GetCursorPos(&ptCursor);
|
||||||
|
|
||||||
// if the mouse has moved more than 3 pixels then exit
|
// if the mouse has moved more than 3 pixels then exit
|
||||||
if(abs(ptCursor.x - ptLast.x) >= 3 || abs(ptCursor.y - ptLast.y) >= 3)
|
if(abs(ptCursor.x - ptLast.x) >= 3 || abs(ptCursor.y - ptLast.y) >= 3)
|
||||||
PostMessage(hwnd, WM_CLOSE, 0, 0);
|
PostMessage(hwnd, WM_CLOSE, 0, 0);
|
||||||
|
|
||||||
ptLast = ptCursor;
|
ptLast = ptCursor;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return DefWindowProc(hwnd, msg, wParam, lParam);
|
return DefWindowProc(hwnd, msg, wParam, lParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
void InitSaver(HWND hwndParent)
|
void InitSaver(HWND hwndParent)
|
||||||
{
|
{
|
||||||
WNDCLASS wc;
|
WNDCLASS wc;
|
||||||
ZeroMemory(&wc, sizeof(wc));
|
ZeroMemory(&wc, sizeof(wc));
|
||||||
wc.style = CS_HREDRAW | CS_VREDRAW;
|
wc.style = CS_HREDRAW | CS_VREDRAW;
|
||||||
wc.lpfnWndProc = WndProc;
|
wc.lpfnWndProc = WndProc;
|
||||||
wc.lpszClassName = APPNAME;
|
wc.lpszClassName = APPNAME;
|
||||||
wc.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
|
wc.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
|
||||||
RegisterClass(&wc);
|
RegisterClass(&wc);
|
||||||
|
|
||||||
if (hwndParent != 0)
|
if (hwndParent != 0)
|
||||||
{
|
{
|
||||||
RECT rect;
|
RECT rect;
|
||||||
GetClientRect(hwndParent, &rect);
|
GetClientRect(hwndParent, &rect);
|
||||||
CreateWindow(APPNAME, APPNAME,
|
CreateWindow(APPNAME, APPNAME,
|
||||||
WS_VISIBLE | WS_CHILD,
|
WS_VISIBLE | WS_CHILD,
|
||||||
0, 0,
|
0, 0,
|
||||||
rect.right,
|
rect.right,
|
||||||
rect.bottom,
|
rect.bottom,
|
||||||
hwndParent, 0,
|
hwndParent, 0,
|
||||||
hInstance, NULL);
|
hInstance, NULL);
|
||||||
fullscreen = FALSE;
|
fullscreen = FALSE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
HWND hwnd;
|
HWND hwnd;
|
||||||
hwnd = CreateWindowEx(WS_EX_TOPMOST,
|
hwnd = CreateWindowEx(WS_EX_TOPMOST,
|
||||||
APPNAME,
|
APPNAME,
|
||||||
APPNAME,
|
APPNAME,
|
||||||
WS_VISIBLE | WS_POPUP,
|
WS_VISIBLE | WS_POPUP,
|
||||||
0, 0,
|
0, 0,
|
||||||
GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN),
|
GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN),
|
||||||
HWND_DESKTOP, 0,
|
HWND_DESKTOP, 0,
|
||||||
hInstance, NULL);
|
hInstance, NULL);
|
||||||
|
|
||||||
SetWindowPos(hwnd,
|
SetWindowPos(hwnd,
|
||||||
0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0,
|
||||||
SWP_NOZORDER|SWP_NOACTIVATE|SWP_NOSIZE|SWP_SHOWWINDOW);
|
SWP_NOZORDER|SWP_NOACTIVATE|SWP_NOSIZE|SWP_SHOWWINDOW);
|
||||||
|
|
||||||
ShowCursor(FALSE);
|
ShowCursor(FALSE);
|
||||||
fullscreen = TRUE;
|
fullscreen = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ParseCommandLine(PSTR szCmdLine, int *chOption, HWND *hwndParent)
|
VOID ParseCommandLine(LPWSTR szCmdLine, UCHAR *chOption, HWND *hwndParent)
|
||||||
{
|
{
|
||||||
int ch = *szCmdLine++;
|
UCHAR ch = *szCmdLine++;
|
||||||
|
|
||||||
if(ch == '-' || ch == '/')
|
if(ch == '-' || ch == '/')
|
||||||
ch = *szCmdLine++;
|
ch = *szCmdLine++;
|
||||||
|
|
||||||
if(ch >= 'A' && ch <= 'Z')
|
if(ch >= 'A' && ch <= 'Z')
|
||||||
ch += 'a' - 'A';
|
ch += 'a' - 'A'; //convert to lower case
|
||||||
|
|
||||||
*chOption = ch;
|
*chOption = ch;
|
||||||
ch = *szCmdLine++;
|
ch = *szCmdLine++;
|
||||||
|
|
||||||
if(ch == ':')
|
if(ch == ':')
|
||||||
ch = *szCmdLine++;
|
ch = *szCmdLine++;
|
||||||
|
|
||||||
while(ch == ' ' || ch == '\t')
|
while(ch == ' ' || ch == '\t')
|
||||||
ch = *szCmdLine++;
|
ch = *szCmdLine++;
|
||||||
|
|
||||||
if(isdigit(ch))
|
if(isdigit(ch))
|
||||||
{
|
{
|
||||||
unsigned int i = atoi(szCmdLine - 1);
|
unsigned int i = _wtoi(szCmdLine - 1);
|
||||||
*hwndParent = (HWND)i;
|
*hwndParent = (HWND)i;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
*hwndParent = 0;
|
*hwndParent = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Configure(void)
|
void Configure(void)
|
||||||
{
|
{
|
||||||
TCHAR szTitle[256];
|
TCHAR szTitle[256];
|
||||||
TCHAR szText[256];
|
TCHAR szText[256];
|
||||||
|
|
||||||
LoadString(hInstance,
|
LoadString(hInstance,
|
||||||
IDS_TITLE,
|
IDS_TITLE,
|
||||||
szTitle,
|
szTitle,
|
||||||
256);
|
256);
|
||||||
|
|
||||||
LoadString(hInstance,
|
LoadString(hInstance,
|
||||||
IDS_TEXT,
|
IDS_TEXT,
|
||||||
szText,
|
szText,
|
||||||
256);
|
256);
|
||||||
|
|
||||||
MessageBox(0,
|
MessageBox(0,
|
||||||
szText,
|
szText,
|
||||||
szTitle,
|
szTitle,
|
||||||
MB_OK | MB_ICONWARNING);
|
MB_OK | MB_ICONWARNING);
|
||||||
}
|
}
|
||||||
|
|
||||||
int WINAPI WinMain (HINSTANCE hInst,
|
int CALLBACK wWinMain (HINSTANCE hInst,
|
||||||
HINSTANCE hPrev,
|
HINSTANCE hPrev,
|
||||||
LPSTR lpCmdLine,
|
LPWSTR lpCmdLine,
|
||||||
int iCmdShow)
|
int iCmdShow)
|
||||||
{
|
{
|
||||||
HWND hwndParent;
|
HWND hwndParent;
|
||||||
UINT nPreviousState;
|
UINT nPreviousState;
|
||||||
int chOption;
|
UCHAR chOption;
|
||||||
MSG Message;
|
MSG Message;
|
||||||
|
|
||||||
hInstance = hInst;
|
hInstance = hInst;
|
||||||
|
|
||||||
ParseCommandLine(lpCmdLine, &chOption, &hwndParent);
|
ParseCommandLine(lpCmdLine, &chOption, &hwndParent);
|
||||||
|
|
||||||
SystemParametersInfo(SPI_SETSCREENSAVERRUNNING, TRUE, &nPreviousState, 0);
|
SystemParametersInfo(SPI_SETSCREENSAVERRUNNING, TRUE, &nPreviousState, 0);
|
||||||
|
|
||||||
switch (chOption)
|
switch (chOption)
|
||||||
{
|
{
|
||||||
case 's':
|
case 's':
|
||||||
InitSaver(0);
|
InitSaver(0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'p':
|
case 'p':
|
||||||
InitSaver(hwndParent);
|
InitSaver(hwndParent);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'c':
|
case 'c':
|
||||||
default:
|
default:
|
||||||
Configure();
|
Configure();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (GetMessage(&Message, 0, 0, 0))
|
while (GetMessage(&Message, 0, 0, 0))
|
||||||
DispatchMessage(&Message);
|
DispatchMessage(&Message);
|
||||||
|
|
||||||
SystemParametersInfo(SPI_SETSCREENSAVERRUNNING, FALSE, &nPreviousState, 0);
|
SystemParametersInfo(SPI_SETSCREENSAVERRUNNING, FALSE, &nPreviousState, 0);
|
||||||
|
|
||||||
return Message.wParam;
|
return Message.wParam;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,16 +1,13 @@
|
||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<!DOCTYPE module SYSTEM "../../../../tools/rbuild/project.dtd">
|
<!DOCTYPE module SYSTEM "../../../../tools/rbuild/project.dtd">
|
||||||
<module name="logon" type="win32scr" installbase="system32" installname="logon.scr">
|
<module name="logon" type="win32scr" installbase="system32" installname="logon.scr" unicode="true">
|
||||||
<include base="logon">.</include>
|
<include base="logon">.</include>
|
||||||
<define name="UNICODE" />
|
<library>kernel32</library>
|
||||||
<define name="_UNICODE" />
|
<library>user32</library>
|
||||||
|
<library>gdi32</library>
|
||||||
<library>kernel32</library>
|
|
||||||
<library>user32</library>
|
<metadata description = "Default ReactOS Logo screensaver" />
|
||||||
<library>gdi32</library>
|
|
||||||
|
<file>logon.c</file>
|
||||||
<metadata description = "Default ReactOS Logo screensaver" />
|
<file>logon.rc</file>
|
||||||
|
</module>
|
||||||
<file>logon.c</file>
|
|
||||||
<file>logon.rc</file>
|
|
||||||
</module>
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue