⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 screensvr.cpp

📁 "Visual C++.net实践与提高-深入Windows编程"的源代码
💻 CPP
字号:
// ScreenSvr.cpp : Defines the class behaviors for the application.
//
#include "stdafx.h"
#include "ScreenSvr.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CScreenSvrApp

BEGIN_MESSAGE_MAP(CScreenSvrApp, CWinApp)
	//{{AFX_MSG_MAP(CScreenSvrApp)
		// 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()

/////////////////////////////////////////////////////////////////////////////
// CScreenSvrApp construction

CScreenSvrApp::CScreenSvrApp()
{
	// TODO: add construction code here,
	// Place all significant initialization in InitInstance
}

/////////////////////////////////////////////////////////////////////////////
// CScreenSvrApp initialization

BOOL CScreenSvrApp::InitInstance()
{
	//	iState: 1:预览 ;0:显示;2:设置
	//
	//
	int iState = 2 ;		// 命令行中如何没有参数,则打开设置窗口
	HWND hwnd = NULL ;
	TCHAR * pCmdLn = ::GetCommandLine() ;
	CString str ;
	str += pCmdLn ;
	str.MakeUpper() ;
#ifdef _DEBUG
	AfxMessageBox(str) ;
#endif
	int i = str.Find('/' , 0 ) ;
	if( i == -1 ){
		i = str.Find('-' , 0 ) ;
	}
	if( i > 0 )
	{
		switch(str[i+1])
		{
		case 'S':
			iState = 0 ;	// 显示
			break ;
		case 'P':
		case 'L':
			iState = 1 ;	// 预览
			if( str.GetLength() > i+3 ){
				str = str.Right(str.GetLength() - (i+3) ) ;
#ifdef _DEBUG
				AfxMessageBox("P or L :"+str) ; 
#endif
				hwnd = reinterpret_cast<HWND>(atoi(LPCTSTR(str)));
			}
			else{
				AfxMessageBox("程序进入错误区域!") ;
			}
			break ;
		case 'C':
			if( str.GetLength() > i+3 ){
				str = str.Right(str.GetLength() - (i+3) ) ;
#ifdef _DEBUG
				AfxMessageBox("C or Default:"+str) ;
#endif
				hwnd = reinterpret_cast<HWND>(atoi(LPCTSTR(str)));
			}
			break ;			// 设置窗口
		default:
			iState = 4 ;
			break ;
		}
	}
	switch(iState){
	case 0:
	case 1:
		return OpenScreenSvrWnd(hwnd) ;
	case 2:
		return OpenConfigWnd(hwnd) ;
	default:
		// Since the dialog has been closed, return FALSE so that we exit the
		//  application, rather than start the application's message pump.
		return FALSE ;
	}
}

BOOL CScreenSvrApp::OpenConfigWnd(HWND hParentWnd)
{
	return FALSE ;			// Exit Appliction: FALSE; True: enter messages Processing
}

BOOL CScreenSvrApp::OpenScreenSvrWnd(HWND hParentWnd)
{
	return FALSE ;			// Exit Appliction: FALSE; True: enter messages Processing
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -