multiscreen.cpp
上传用户:qdhuadeli
上传日期:2007-02-07
资源大小:978k
文件大小:2k
- // multiscreen.cpp : Defines the class behaviors for the application.
- //
- #include "stdafx.h"
- #include "multiscreen.h"
- #include "multiscreenDlg.h"
- #include "SaverWindow.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // CMultiscreenApp
- BEGIN_MESSAGE_MAP(CMultiscreenApp, CWinApp)
- //{{AFX_MSG_MAP(CMultiscreenApp)
- // NOTE - the ClassWizard will add and remove mapping macros here.
- // DO NOT EDIT what you see in these blocks of generated code!
- //}}AFX_MSG
- ON_COMMAND(ID_HELP, CWinApp::OnHelp)
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // CMultiscreenApp construction
- CMultiscreenApp::CMultiscreenApp()
- {
- // TODO: add construction code here,
- // Place all significant initialization in InitInstance
- }
- /////////////////////////////////////////////////////////////////////////////
- // The one and only CMultiscreenApp object
- CMultiscreenApp theApp;
- /////////////////////////////////////////////////////////////////////////////
- // CMultiscreenApp initialization
- BOOL CMultiscreenApp::InitInstance()
- {
- // if (!AfxSocketInit())
- // {
- // AfxMessageBox(IDP_SOCKETS_INIT_FAILED);
- // return FALSE;
- // }
- #ifdef _AFXDLL
- Enable3dControls(); // Call this when using MFC in a shared DLL
- #else
- Enable3dControlsStatic(); // Call this when linking to MFC statically
- #endif
- CString csCmdLine = m_lpCmdLine;
- csCmdLine.MakeLower();
- // Get the command line flags
- int nFwdSlash = csCmdLine.FindOneOf( "/-" );
- HWND hwndParent = NULL;
- #ifdef _DEBUG
- TCHAR cFlag = 's';
- #else
- TCHAR cFlag = 'C';
- #endif
- if ( nFwdSlash > -1 && csCmdLine.GetLength() > nFwdSlash+1 )
- cFlag = csCmdLine[nFwdSlash+1];
- if ( cFlag == 'p' && csCmdLine.GetLength() > nFwdSlash + 3 )
- hwndParent = (HWND)atoi( &((LPCTSTR)csCmdLine)[nFwdSlash+2] );
- if ( tolower(cFlag) == 'c' )
- {
- // Run configuration dialog
- CWnd* pParent = (cFlag=='c')?CWnd::GetActiveWindow():NULL;
- CMultiscreenDlg dlg( pParent );
- m_pMainWnd = &dlg;
- int nResponse = dlg.DoModal();
- if (nResponse == IDOK)
- {
- }
- else if (nResponse == IDCANCEL)
- {
- }
- }
- else
- {
- // Run screen saver either desktop or preview
- CSaverWindow* pSaverWindow = new CSaverWindow;
- if ( pSaverWindow->Create(hwndParent) )
- {
- m_pMainWnd = pSaverWindow;
- return TRUE;
- }
- }
- return FALSE;
- }