2004-01-17 21:34:54 +00:00
|
|
|
//
|
|
|
|
// Contributor(s):
|
2004-01-18 19:36:50 +00:00
|
|
|
// DirectX 8.1 Screen Saver Framework from Microsoft.
|
|
|
|
// Microsoft Knowledge Base Article - 79212
|
2004-01-17 21:34:54 +00:00
|
|
|
//
|
|
|
|
|
|
|
|
#ifndef _BOINC_H
|
|
|
|
#define _BOINC_H
|
|
|
|
|
2004-11-14 08:29:32 +00:00
|
|
|
#include "gui_rpc_client.h"
|
|
|
|
|
|
|
|
|
2004-01-17 21:34:54 +00:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// Error codes
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2005-04-04 00:35:56 +00:00
|
|
|
#define SCRAPPERR_BOINCNOTDETECTED 0x82000001
|
|
|
|
#define SCRAPPERR_BOINCNOTDETECTEDSTARTUP 0x82000002
|
|
|
|
#define SCRAPPERR_BOINCSUSPENDED 0x82000003
|
|
|
|
#define SCRAPPERR_BOINCNOTGRAPHICSCAPABLE 0x82000004
|
|
|
|
#define SCRAPPERR_BOINCNOAPPSEXECUTING 0x82000005
|
|
|
|
#define SCRAPPERR_BOINCNOAPPSEXECUTINGNOPROJECTSDETECTED 0x82000006
|
|
|
|
#define SCRAPPERR_BOINCNOGRAPHICSAPPSEXECUTING 0x82000007
|
|
|
|
#define SCRAPPERR_BOINCSCREENSAVERLOADING 0x82000008
|
|
|
|
#define SCRAPPERR_NOPREVIEW 0x8200000f
|
2004-01-17 21:34:54 +00:00
|
|
|
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// Constants
|
|
|
|
//-----------------------------------------------------------------------------
|
2004-11-18 04:09:10 +00:00
|
|
|
#define MAX_DISPLAYS 9
|
|
|
|
#define NO_ADAPTER 0xffffffff
|
|
|
|
#define NO_MONITOR 0xffffffff
|
|
|
|
|
|
|
|
|
2004-12-03 19:47:54 +00:00
|
|
|
#define BOINC_SHORTCUT_NAME _T("\\BOINC Manager.lnk")
|
|
|
|
#define BOINC_WINDOW_CLASS_NAME _T("BOINC_app")
|
2004-01-17 21:34:54 +00:00
|
|
|
|
|
|
|
|
|
|
|
//***************************************************************************************
|
|
|
|
// Modes of operation for screensaver
|
|
|
|
enum SaverMode
|
|
|
|
{
|
|
|
|
sm_config, // Config dialog box
|
|
|
|
sm_preview, // Mini preview window in Display Properties dialog
|
|
|
|
sm_full, // Full-on screensaver mode
|
|
|
|
sm_test, // Test mode
|
|
|
|
sm_passwordchange // Change password
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// Prototype for VerifyScreenSavePwd() in password.cpl, used on Win9x
|
|
|
|
typedef BOOL (PASCAL * VERIFYPWDPROC) (HWND);
|
|
|
|
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// Name: struct INTERNALMONITORINFO
|
|
|
|
// Desc: Structure for holding information about a monitor
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
struct INTERNALMONITORINFO
|
|
|
|
{
|
|
|
|
TCHAR strDeviceName[128];
|
|
|
|
TCHAR strMonitorName[128];
|
|
|
|
HMONITOR hMonitor;
|
|
|
|
RECT rcScreen;
|
|
|
|
HWND hWnd;
|
|
|
|
|
|
|
|
// Error message state
|
|
|
|
FLOAT xError;
|
|
|
|
FLOAT yError;
|
|
|
|
FLOAT widthError;
|
|
|
|
FLOAT heightError;
|
|
|
|
FLOAT xVelError;
|
|
|
|
FLOAT yVelError;
|
2005-02-08 06:07:56 +00:00
|
|
|
time_t tLastRefresh;
|
2004-01-17 21:34:54 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// Use the following structure rather than DISPLAY_DEVICE, since some old
|
|
|
|
// versions of DISPLAY_DEVICE are missing the last two fields and this can
|
|
|
|
// cause problems with EnumDisplayDevices on Windows 2000.
|
|
|
|
struct DISPLAY_DEVICE_FULL
|
|
|
|
{
|
|
|
|
DWORD cb;
|
|
|
|
TCHAR DeviceName[32];
|
|
|
|
TCHAR DeviceString[128];
|
|
|
|
DWORD StateFlags;
|
|
|
|
TCHAR DeviceID[128];
|
|
|
|
TCHAR DeviceKey[128];
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// Name: class CScreensaver
|
|
|
|
// Desc: Screensaver class
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
class CScreensaver
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
CScreensaver();
|
|
|
|
|
|
|
|
virtual HRESULT Create( HINSTANCE hInstance );
|
|
|
|
virtual INT Run();
|
|
|
|
HRESULT DisplayErrorMsg( HRESULT hr );
|
|
|
|
|
|
|
|
|
|
|
|
protected:
|
2004-01-19 19:45:52 +00:00
|
|
|
VOID StartupBOINC();
|
2004-01-17 21:34:54 +00:00
|
|
|
VOID ShutdownBOINC();
|
|
|
|
|
|
|
|
SaverMode ParseCommandLine( TCHAR* pstrCommandLine );
|
|
|
|
VOID EnumMonitors( VOID );
|
2004-01-19 19:45:52 +00:00
|
|
|
|
|
|
|
HRESULT CreateSaverWindow();
|
|
|
|
VOID UpdateErrorBox();
|
2005-02-03 01:55:34 +00:00
|
|
|
VOID UpdateErrorBoxText();
|
2004-01-19 19:45:52 +00:00
|
|
|
VOID InterruptSaver();
|
|
|
|
VOID ShutdownSaver();
|
2004-01-17 21:34:54 +00:00
|
|
|
VOID ChangePassword();
|
|
|
|
|
|
|
|
VOID DoConfig();
|
|
|
|
HRESULT DoSaver();
|
|
|
|
VOID DoPaint( HWND hwnd, HDC hdc );
|
|
|
|
|
2004-01-19 19:45:52 +00:00
|
|
|
void DrawTransparentBitmap(HDC hdc, HBITMAP hBitmap, LONG xStart, LONG yStart, COLORREF cTransparentColor);
|
2004-01-17 21:34:54 +00:00
|
|
|
|
|
|
|
virtual BOOL GetTextForError( HRESULT hr, TCHAR* pszError, DWORD dwNumChars );
|
2004-01-19 19:45:52 +00:00
|
|
|
BOOL IsConfigStartupBOINC();
|
2004-01-17 21:34:54 +00:00
|
|
|
|
2005-03-23 00:16:58 +00:00
|
|
|
LRESULT SaverProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam );
|
2005-01-13 01:52:56 +00:00
|
|
|
INT_PTR ConfigureDialogProc( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam );
|
2004-01-17 21:34:54 +00:00
|
|
|
|
2005-03-23 00:16:58 +00:00
|
|
|
static LRESULT CALLBACK SaverProcStub( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam );
|
2004-01-17 21:34:54 +00:00
|
|
|
static INT_PTR CALLBACK ConfigureDialogProcStub( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam );
|
|
|
|
|
2005-01-13 04:44:21 +00:00
|
|
|
int UtilGetRegKey(LPCTSTR name, DWORD &keyval);
|
|
|
|
int UtilSetRegKey(LPCTSTR name, DWORD value);
|
|
|
|
int UtilGetRegStartupStr(LPCTSTR name, LPTSTR str);
|
2005-01-13 01:52:56 +00:00
|
|
|
|
2004-01-17 21:34:54 +00:00
|
|
|
protected:
|
2004-11-18 02:31:40 +00:00
|
|
|
RPC_CLIENT rpc;
|
|
|
|
CC_STATE state;
|
2004-11-14 08:29:32 +00:00
|
|
|
|
2004-01-17 21:34:54 +00:00
|
|
|
SaverMode m_SaverMode; // sm_config, sm_full, sm_preview, etc.
|
|
|
|
BOOL m_bAllScreensSame; // If TRUE, show same image on all screens
|
|
|
|
HWND m_hWnd; // Focus window and device window on primary
|
|
|
|
HWND m_hWndParent;
|
|
|
|
HINSTANCE m_hInstance;
|
|
|
|
BOOL m_bWaitForInputIdle; // Used to pause when preview starts
|
|
|
|
DWORD m_dwSaverMouseMoveCount;
|
|
|
|
BOOL m_bIs9x;
|
|
|
|
HINSTANCE m_hPasswordDLL;
|
|
|
|
VERIFYPWDPROC m_VerifySaverPassword;
|
|
|
|
BOOL m_bCheckingSaverPassword;
|
|
|
|
BOOL m_bWindowed;
|
|
|
|
|
|
|
|
// Variables for non-fatal error management
|
|
|
|
BOOL m_bErrorMode; // Whether to display an error
|
|
|
|
HRESULT m_hrError; // Error code to display
|
|
|
|
TCHAR m_szError[400]; // Error message text
|
|
|
|
|
|
|
|
INTERNALMONITORINFO m_Monitors[MAX_DISPLAYS];
|
|
|
|
DWORD m_dwNumMonitors;
|
|
|
|
RECT m_rcRenderTotal; // Rect of entire area to be rendered
|
|
|
|
RECT m_rcRenderCurDevice; // Rect of render area of current device
|
|
|
|
BOOL m_bPaintingInitialized;
|
|
|
|
|
|
|
|
TCHAR m_strWindowTitle[200]; // Title for the app's window
|
2005-02-06 19:01:28 +00:00
|
|
|
BOOL m_bCoreNotified;
|
2005-02-06 05:20:43 +00:00
|
|
|
BOOL m_bResetCoreState;
|
2005-02-06 19:01:28 +00:00
|
|
|
DWORD m_dwTimerCounter;
|
2005-02-06 05:20:43 +00:00
|
|
|
int m_iStatus;
|
2005-02-09 21:54:04 +00:00
|
|
|
DWORD m_dwBlankScreen;
|
2005-02-03 19:11:35 +00:00
|
|
|
DWORD m_dwBlankTime;
|
2005-02-03 01:55:34 +00:00
|
|
|
|
2004-12-03 19:47:54 +00:00
|
|
|
BOOL m_bBOINCConfigChecked;
|
|
|
|
BOOL m_bBOINCStartupConfigured;
|
2004-01-17 21:34:54 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|