📄 scrsnap.cpp
字号:
// ScrSnap.cpp : Defines the class behaviors for the application.
//
#include "stdafx.h"
#include "ScrSnap.h"
#include "MainFrm.h"
#include "ChildFrm.h"
#include "ScrSnapDoc.h"
#include "ScrSnapView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
//类名:CScrSnapApp
//功能:应用程序的初始化
//作者:徐景周(jingzhou_xu@163.net)
//组织:未来工作室(Future Studio)
//日期:2001.12.1
/////////////////////////////////////////////////////////////////////////////
// CScrSnapApp
BEGIN_MESSAGE_MAP(CScrSnapApp, CWinAppEx) //改变相应应用类,来显示Office2000菜单风格
//{{AFX_MSG_MAP(CScrSnapApp)
ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG_MAP
// Standard file based document commands
ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
// Standard print setup command
ON_COMMAND(ID_FILE_PRINT_SETUP, CWinApp::OnFilePrintSetup)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CScrSnapApp construction
CScrSnapApp::CScrSnapApp()
{
// TODO: add construction code here,
// Place all significant initialization in InitInstance
}
/////////////////////////////////////////////////////////////////////////////
// The one and only CScrSnapApp object
CScrSnapApp theApp;
/////////////////////////////////////////////////////////////////////////////
// CScrSnapApp initialization
BOOL CScrSnapApp::InitInstance()
{
AfxEnableControlContainer();
// Standard initialization
// If you are not using these features and wish to reduce the size
// of your final executable, you should remove from the following
// the specific initialization routines you do not need.
#ifdef _AFXDLL
Enable3dControls(); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif
// Change the registry key under which our settings are stored.
// TODO: You should modify this string to be something appropriate
// such as the name of your company or organization.
SetRegistryKey(_T("Local AppWizard-Generated Applications"));
LoadStdProfileSettings(); // Load standard INI file options (including MRU)
//此程序只能运行一次,用互斥量来判断程序是否已运行
HANDLE m_hMutex=CreateMutex(NULL,TRUE, m_pszAppName);
if(GetLastError()==ERROR_ALREADY_EXISTS) { return FALSE; }
//设置对话框背景和文本颜色
SetDialogBkColor(RGB(160,180,220),RGB(0,0,0));
// create main MDI Frame window
UINT nID;
nID=IDR_MAINFRAME; //获取主菜单ID
CMainFrame* pMainFrame = new CMainFrame;
if (!pMainFrame->LoadFrame(nID)) //在框架中载入主菜单
return FALSE;
m_pMainWnd = pMainFrame;
// Register the application's document templates. Document templates
// serve as the connection between documents, frame windows and views.
CMultiDocTemplateEx* pDocTemplate; //改变相应文档类,来显示Office2000菜单风格
pDocTemplate = new CMultiDocTemplateEx( //改变相应文档类,来显示Office2000菜单风格
IDR_SCRSNATYPE,
RUNTIME_CLASS(CScrSnapDoc),
RUNTIME_CLASS(CChildFrame), // custom MDI child frame
RUNTIME_CLASS(CScrSnapView),
&nID,1); //载入主菜单,来显示Office2000菜单风格
AddDocTemplate(pDocTemplate);
CWinAppEx::InitInstance(); //显示Office2000菜单风格
// Parse command line for standard shell commands, DDE, file open
CCommandLineInfo cmdInfo;
//添加下面一行代码,是在初始化时不建立空视图
cmdInfo.m_nShellCommand=CCommandLineInfo::FileNothing;
ParseCommandLine(cmdInfo);
// Dispatch commands specified on the command line
if (!ProcessShellCommand(cmdInfo))
return FALSE;
// The main window has been initialized, so show and update it.
pMainFrame->ShowWindow(m_nCmdShow);
pMainFrame->UpdateWindow();
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About
#include "xShadeButton.h" //加入自绘式阴影位图按钮类
#include "HyperLink.h" //加入超链接类
//#include "XInfoTip.h" //加入具有立体感的工具提示类
class CAboutDlg : public CDialog
{
public:
CAboutDlg();
// Dialog Data
//{{AFX_DATA(CAboutDlg)
enum { IDD = IDD_ABOUTBOX };
CHyperLink m_Mail;
CxShadeButton m_OK; //使“关于”对话框中按钮为阴影位图按钮
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CAboutDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// CXInfoTip m_Tip; //工具提示变量
//{{AFX_MSG(CAboutDlg)
virtual BOOL OnInitDialog();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
//{{AFX_DATA_INIT(CAboutDlg)
//}}AFX_DATA_INIT
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAboutDlg)
DDX_Control(pDX, IDC_STATIC_MAIL, m_Mail);
DDX_Control(pDX, IDOK, m_OK);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
//{{AFX_MSG_MAP(CAboutDlg)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
// App command to run the dialog
void CScrSnapApp::OnAppAbout()
{
CAboutDlg aboutDlg;
aboutDlg.DoModal();
}
//“关于”对话框初始化
BOOL CAboutDlg::OnInitDialog()
{
CDialog::OnInitDialog();
/*
// 创建有立体感的工具提示
m_Tip.Create(this);
// 和相应控件产生联系
m_Tip.AddTool(GetDlgItem(IDOK), _T("关闭"),NULL);
*/
//“关于”对话框中,初始化阴影位图按钮
m_OK.SetTextColor(RGB(0,0,0));
m_OK.SetToolTipText("确定"); //暂不用,改用立体感的工具提示条
m_OK.SetShade(SHS_HARDBUMP,10,20,5,RGB(55,55,255)); //(SHS_NOISE,33);
//加入EMAIL的超连接
m_Mail.SetURL(_T("mailto:jingzhou_xu@163.net"));
m_Mail.SetUnderline(FALSE);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -