- Compile screensavers as UNICODE applications + minor fixes (Part 2/2)

svn path=/trunk/; revision=29966
This commit is contained in:
Marc Piulachs 2007-10-29 22:52:33 +00:00
parent e985f75055
commit 47f240c7fb
8 changed files with 646 additions and 652 deletions

View file

@ -236,26 +236,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;
if (!strlen(szCmdLine))
return;
ch = *szCmdLine++;
UCHAR ch = *szCmdLine++;
if(ch == '-' || ch == '/')
ch = *szCmdLine++;
if(ch >= 'A' && ch <= 'Z')
ch += 'a' - 'A';
ch += 'a' - 'A'; //convert to lower case
*chOption = ch;
if (ch == 's' || ch == 'c')
return;
ch = *szCmdLine++;
if(ch == ':')
@ -266,11 +265,11 @@ void ParseCommandLine(PSTR szCmdLine, int *chOption, HWND *hwndParent)
if(isdigit(ch))
{
unsigned int i = atoi(szCmdLine - 1);
unsigned int i = _wtoi(szCmdLine - 1);
*hwndParent = (HWND)i;
}
else
*hwndParent = 0;
*hwndParent = NULL;
}
void Configure(void)
@ -294,13 +293,13 @@ void Configure(void)
MB_OK | MB_ICONWARNING);
}
int WINAPI WinMain (HINSTANCE hInst,
int CALLBACK wWinMain (HINSTANCE hInst,
HINSTANCE hPrev,
LPSTR lpCmdLine,
LPWSTR lpCmdLine,
int iCmdShow)
{
HWND hwndParent = 0;
int chOption = 0;
UCHAR chOption;
MSG Message;
hInstance = hInst;

View file

@ -1,9 +1,6 @@
<?xml version="1.0"?>
<!DOCTYPE module SYSTEM "../../../../tools/rbuild/project.dtd">
<module name="cylfrac" type="win32scr" installbase="system32" installname="cylfrac.scr">
<define name="UNICODE" />
<define name="_UNICODE" />
<module name="cylfrac" type="win32scr" installbase="system32" installname="cylfrac.scr" unicode="true">
<library>kernel32</library>
<library>user32</library>
<library>gdi32</library>

View file

@ -1,13 +1,9 @@
<?xml version="1.0"?>
<!DOCTYPE module SYSTEM "../../../../tools/rbuild/project.dtd">
<module name="matrix" type="win32scr" installbase="system32" installname="matrix2.scr" allowwarnings="true">
<module name="matrix" type="win32scr" installbase="system32" installname="matrix2.scr" allowwarnings="true" unicode="true">
<include base="matrix">.</include>
<define name="_WIN32_IE">0x0501</define>
<define name="_WIN32_WINNT">0x0501</define>
<define name="UNICODE" />
<define name="_UNICODE" />
<library>kernel32</library>
<library>user32</library>
<library>gdi32</library>

View file

@ -100,7 +100,7 @@ BOOL ScreenSaver(HWND hwndParent)
// -p <hwnd> (preview)
// -c <hwnd> (configure)
//
VOID ParseCommandLine(LPSTR szCmdLine, UCHAR *chOption, HWND *hwndParent)
VOID ParseCommandLine(LPWSTR szCmdLine, UCHAR *chOption, HWND *hwndParent)
{
UCHAR ch = *szCmdLine++;
@ -121,7 +121,7 @@ VOID ParseCommandLine(LPSTR szCmdLine, UCHAR *chOption, HWND *hwndParent)
if(isdigit(ch))
{
unsigned int i = atoi(szCmdLine - 1);
unsigned int i = _wtoi(szCmdLine - 1);
*hwndParent = (HWND)i;
}
else
@ -131,7 +131,7 @@ VOID ParseCommandLine(LPSTR szCmdLine, UCHAR *chOption, HWND *hwndParent)
//
// Entrypoint for screen-saver: it's just a normal win32 app!
//
int WINAPI WinMain (HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpCmdLine, int iCmdShow)
int CALLBACK wWinMain (HINSTANCE hInst, HINSTANCE hPrev, LPWSTR lpCmdLine, int iCmdShow)
{
HWND hwndParent;
UCHAR chOption;

View file

@ -124,15 +124,15 @@ void InitSaver(HWND hwndParent)
}
}
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 == '/')
ch = *szCmdLine++;
if(ch >= 'A' && ch <= 'Z')
ch += 'a' - 'A';
ch += 'a' - 'A'; //convert to lower case
*chOption = ch;
ch = *szCmdLine++;
@ -145,11 +145,11 @@ void ParseCommandLine(PSTR szCmdLine, int *chOption, HWND *hwndParent)
if(isdigit(ch))
{
unsigned int i = atoi(szCmdLine - 1);
unsigned int i = _wtoi(szCmdLine - 1);
*hwndParent = (HWND)i;
}
else
*hwndParent = 0;
*hwndParent = NULL;
}
void Configure(void)
@ -174,14 +174,14 @@ void Configure(void)
}
int WINAPI WinMain (HINSTANCE hInst,
int CALLBACK wWinMain (HINSTANCE hInst,
HINSTANCE hPrev,
LPSTR lpCmdLine,
LPWSTR lpCmdLine,
int iCmdShow)
{
HWND hwndParent;
UINT nPreviousState;
int chOption;
UCHAR chOption;
MSG Message;
hInstance = hInst;

View file

@ -1,9 +1,6 @@
<?xml version="1.0"?>
<!DOCTYPE module SYSTEM "../../../../tools/rbuild/project.dtd">
<module name="scrnsave" type="win32scr" installbase="system32" installname="scrnsave.scr">
<define name="UNICODE" />
<define name="_UNICODE" />
<module name="scrnsave" type="win32scr" installbase="system32" installname="scrnsave.scr" unicode="true">
<library>kernel32</library>
<library>user32</library>
<library>gdi32</library>

View file

@ -287,15 +287,23 @@ void InitSaver(HWND hwndParent)
SetUpStars(250);
}
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 = *szCmdLine++;
UCHAR ch = *szCmdLine++;
if(ch == '-' || ch == '/')
ch = *szCmdLine++;
if(ch >= 'A' && ch <= 'Z')
ch += 'a' - 'A';
ch += 'a' - 'A'; //convert to lower case
*chOption = ch;
ch = *szCmdLine++;
@ -308,11 +316,11 @@ void ParseCommandLine(PSTR szCmdLine, int *chOption, HWND *hwndParent)
if(isdigit(ch))
{
unsigned int i = atoi(szCmdLine - 1);
unsigned int i = _wtoi(szCmdLine - 1);
*hwndParent = (HWND)i;
}
else
*hwndParent = 0;
*hwndParent = NULL;
}
void Configure(void)
@ -336,14 +344,14 @@ void Configure(void)
MB_OK | MB_ICONWARNING);
}
int WINAPI WinMain (HINSTANCE hInst,
int CALLBACK wWinMain (HINSTANCE hInst,
HINSTANCE hPrev,
LPSTR lpCmdLine,
LPWSTR lpCmdLine,
int iCmdShow)
{
HWND hwndParent;
UINT nPreviousState;
int chOption;
UCHAR chOption;
MSG Message;
hInstance = hInst;

View file

@ -1,9 +1,6 @@
<?xml version="1.0"?>
<!DOCTYPE module SYSTEM "../../../../tools/rbuild/project.dtd">
<module name="starfield" type="win32scr" installbase="system32" installname="starfield.scr">
<define name="UNICODE" />
<define name="_UNICODE" />
<module name="starfield" type="win32scr" installbase="system32" installname="starfield.scr" unicode="true">
<library>kernel32</library>
<library>user32</library>
<library>gdi32</library>