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

📄 dianzhen.cpp

📁 点阵汉字显示软件, 源码 当前针式打印机采用24针进行字符打印
💻 CPP
字号:
// dianzhen.cpp : Defines the class behaviors for the application.
//

#include "stdafx.h"
#include "dianzhen.h"
#include "dianzhenDlg.h"

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

/////////////////////////////////////////////////////////////////////////////
// CDianzhenApp

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

/////////////////////////////////////////////////////////////////////////////
// CDianzhenApp construction

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

/////////////////////////////////////////////////////////////////////////////
// The one and only CDianzhenApp object

CDianzhenApp theApp;

/////////////////////////////////////////////////////////////////////////////
// CDianzhenApp initialization

BOOL CDianzhenApp::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
	
	SetDialogBkColor(RGB(228,228,228),RGB(0,0,0));//设定对话框背景颜色与字符颜色
	
	CDianzhenDlg dlg;
	m_pMainWnd = &dlg;

	int nResponse = dlg.DoModal();
	if (nResponse == IDOK)
	{
		// TODO: Place code here to handle when the dialog is
		//  dismissed with OK
	}
	else if (nResponse == IDCANCEL)
	{
		// TODO: Place code here to handle when the dialog is
		//  dismissed with Cancel
	}

	// Since the dialog has been closed, return FALSE so that we exit the
	//  application, rather than start the application's message pump.
	m_hwndDlg = NULL;
	return FALSE;
}

BOOL CDianzhenApp::ProcessMessageFilter(int code, LPMSG lpMsg)
{
	// TODO: Add your specialized code here and/or call the base class
	CDianzhenDlg *pdlg = (CDianzhenDlg *)GetMainWnd();
	if(m_hwndDlg != NULL)
	{
		if(lpMsg->hwnd == m_hwndDlg || ::IsChild(m_hwndDlg,lpMsg->hwnd))
		{
			if(lpMsg->message == WM_KEYDOWN)
			{
				switch(lpMsg->wParam)
				{
					case 0x21: //处理PageUp键,上翻
						pdlg->DoPrePage();
						return 1;

					case 0x22://处理PageDown键,下翻
						pdlg->DoNextPage();
						return 1;

					case 0x23://处理End键,末页
						pdlg->DoLastPage();
						return 1;

					case 0x24://处理Home键,首页
						pdlg->DoFirstPage();
						return 1;

					case 0x25://处理向左箭头
						pdlg->DoBtnPrevious();
						return 1;

					case 0x26://处理向上箭头
						pdlg->DoBtnUp();
						return 1;//已经处理过的消息,应用程序会从消息队列中删除此消息

					case 0x27://处理向右箭头
						pdlg->DoBtnNext();
						return 1;

					case 0x28://处理向下箭头
						pdlg->DoBtnDown();
						return 1;

					case 0x6b://处理‘+’,放大字符
						pdlg->DoSlidEnlarge(true);
						return 1;

					case 0x6d://处理‘-’,放大字符
						pdlg->DoSlidEnlarge(false);
						return 1;

					default:
						/*char ch[20];
						sprintf(ch,"键%c(%d)被按下",lpMsg->wParam,lpMsg->wParam);
						AfxMessageBox(ch);*/
						break;
				}				
			}
		}
	}
	return CWinApp::ProcessMessageFilter(code, lpMsg);
}

⌨️ 快捷键说明

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