2002-11-18 21:20:54 +00:00
|
|
|
// The contents of this file are subject to the Mozilla Public License
|
|
|
|
// Version 1.0 (the "License"); you may not use this file except in
|
|
|
|
// compliance with the License. You may obtain a copy of the License at
|
|
|
|
// http://www.mozilla.org/MPL/
|
|
|
|
//
|
|
|
|
// Software distributed under the License is distributed on an "AS IS"
|
|
|
|
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
|
|
|
// License for the specific language governing rights and limitations
|
|
|
|
// under the License.
|
|
|
|
//
|
|
|
|
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
|
|
|
|
//
|
|
|
|
// The Initial Developer of the Original Code is the SETI@home project.
|
|
|
|
// Portions created by the SETI@home project are Copyright (C) 2002
|
|
|
|
// University of California at Berkeley. All Rights Reserved.
|
|
|
|
//
|
|
|
|
// Contributor(s):
|
|
|
|
//
|
|
|
|
// Based on code by Lucian Wischik
|
|
|
|
|
2002-11-14 00:49:24 +00:00
|
|
|
#include <afxwin.h>
|
|
|
|
|
2002-11-18 21:20:54 +00:00
|
|
|
enum TScrMode {smNone,smConfig,smPassword,smPreview,smSaver};
|
|
|
|
|
2002-11-14 00:49:24 +00:00
|
|
|
int WINAPI WinMain(HINSTANCE h,HINSTANCE,LPSTR,int)
|
|
|
|
{
|
2002-11-19 00:28:33 +00:00
|
|
|
int BOINC_SS_START_MSG;
|
2002-11-18 21:20:54 +00:00
|
|
|
UINT oldval;
|
|
|
|
TScrMode ScrMode=smNone;
|
|
|
|
|
2002-11-18 23:09:11 +00:00
|
|
|
/*char *c=GetCommandLine();
|
2002-11-18 21:20:54 +00:00
|
|
|
if (*c=='\"') {c++; while (*c!=0 && *c!='\"') c++;} else {while (*c!=0 && *c!=' ') c++;}
|
|
|
|
if (*c!=0) c++;
|
|
|
|
while (*c==' ') c++;
|
|
|
|
HWND hwnd=NULL;
|
|
|
|
if (*c==0) {ScrMode=smConfig; hwnd=NULL;}
|
|
|
|
else
|
|
|
|
{ if (*c=='-' || *c=='/') c++;
|
|
|
|
if (*c=='p' || *c=='P' || *c=='l' || *c=='L')
|
|
|
|
{ c++; while (*c==' ' || *c==':') c++;
|
|
|
|
if ((strcmp(c,"scrprev")==0) || (strcmp(c,"ScrPrev")==0) || (strcmp(c,"SCRPREV")==0)) hwnd=CheckForScrprev();
|
|
|
|
else hwnd=(HWND)atoi(c);
|
|
|
|
ScrMode=smPreview;
|
|
|
|
}
|
|
|
|
else if (*c=='s' || *c=='S') {ScrMode=smSaver; }
|
|
|
|
else if (*c=='c' || *c=='C') {c++; while (*c==' ' || *c==':') c++; if (*c==0) hwnd=GetForegroundWindow(); else hwnd=(HWND)atoi(c); ScrMode=smConfig;}
|
|
|
|
else if (*c=='a' || *c=='A') {c++; while (*c==' ' || *c==':') c++; hwnd=(HWND)atoi(c); ScrMode=smPassword;}
|
|
|
|
}
|
|
|
|
if (ScrMode==smPassword) ChangePassword(hwnd);
|
|
|
|
if (ScrMode==smConfig) DialogBox(hInstance,MAKEINTRESOURCE(DLG_CONFIG),hwnd,ConfigDialogProc);
|
2002-11-18 23:09:11 +00:00
|
|
|
if (ScrMode==smSaver || ScrMode==smPreview) DoSaver(hwnd);*/
|
2002-11-18 21:20:54 +00:00
|
|
|
|
|
|
|
// Set a flag in the system to indicate that we're in screensaver mode
|
|
|
|
//if (ScrMode==smSaver)
|
|
|
|
SystemParametersInfo(SPI_SCREENSAVERRUNNING,1,&oldval,0);
|
2002-11-14 00:49:24 +00:00
|
|
|
|
2002-11-19 00:28:33 +00:00
|
|
|
BOINC_SS_START_MSG = RegisterWindowMessage( "BOINC_SS_START" );
|
2002-11-14 00:49:24 +00:00
|
|
|
|
2002-11-19 00:28:33 +00:00
|
|
|
PostMessage(HWND_BROADCAST, BOINC_SS_START_MSG, 0, 0);
|
2002-11-14 00:49:24 +00:00
|
|
|
|
2002-11-18 21:20:54 +00:00
|
|
|
// Unset the system screensaver flag
|
|
|
|
//if (ScrMode==smSaver)
|
|
|
|
SystemParametersInfo(SPI_SCREENSAVERRUNNING,0,&oldval,0);
|
|
|
|
|
2002-11-14 00:49:24 +00:00
|
|
|
return 0;
|
|
|
|
}
|