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

📄 jhhb.cpp

📁 串口调试助手的源代码
💻 CPP
字号:
// JHHB.cpp : Defines the class behaviors for the application.
//

#include "stdafx.h"
#include "JHHB.h"

#include "MainFrm.h"
#include "JHHBDoc.h"

#include "JHHBView.h"

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

/////////////////////////////////////////////////////////////////////////////
// CJHHBApp

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

/////////////////////////////////////////////////////////////////////////////
// CJHHBApp construction

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

/////////////////////////////////////////////////////////////////////////////
// The one and only CJHHBApp object

CJHHBApp theApp;


/////////////////////////////////////////////////////////////////////////////
// CJHHBApp initialization

// Indicates whether the class was registered so that we can
// unregister it in ExitInstance
LPCTSTR	CJHHBApp::lpszUniqueClass = _T("__HBJK__CLASS");
BOOL	CJHHBApp::bClassRegistered = FALSE;
BOOL CJHHBApp::InitInstance()
{
	// If a previous instance of the application is already running,
	// then activate it and return FALSE from InitInstance to
	// end the execution of this instance.
	if (!FirstInstance())
		return  FALSE;

	// Register our unique class name that we wish to use
	WNDCLASS	wndcls;
	memset(&wndcls, 0, sizeof(WNDCLASS));	// start with NULL defaults

	wndcls.style = CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW;
	wndcls.lpfnWndProc = ::DefWindowProc;
	wndcls.hInstance = AfxGetInstanceHandle();
	wndcls.hIcon = LoadIcon(IDR_MAINFRAME);		// or load a different icon
	wndcls.hCursor = LoadCursor(IDC_ARROW);
	wndcls.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
	wndcls.lpszMenuName = NULL;
	// Specify our own class name for using FindWindow later
	wndcls.lpszClassName = lpszUniqueClass;

	// Register new class and exit if it fails
	if (!::AfxRegisterClass(&wndcls))
	{
		TRACE("Class Registration Failed\n");
		return  FALSE;
	}
	bClassRegistered = TRUE;

	// 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

	LoadStdProfileSettings(0);  // Load standard INI file options (including MRU)

	// Register the application's document templates.  Document templates
	//  serve as the connection between documents, frame windows and views.

	CSingleDocTemplate* pDocTemplate;
	pDocTemplate = new CSingleDocTemplate(
		IDR_MAINFRAME,
		RUNTIME_CLASS(CJHHBDoc),
		RUNTIME_CLASS(CMainFrame),       // main SDI frame window
		RUNTIME_CLASS(CJHHBView));
	AddDocTemplate(pDocTemplate);

	// Parse command line for standard shell commands, DDE, file open
	CCommandLineInfo cmdInfo;
	ParseCommandLine(cmdInfo);

	m_nCmdShow = SW_SHOWMAXIMIZED;

	// Dispatch commands specified on the command line
	if (!ProcessShellCommand(cmdInfo))
		return  FALSE;

	return  TRUE;
}

BOOL	CJHHBApp::FirstInstance(void){	// Determine if another window with our class name exists...
	CWnd*  pWndPrev;
	if (pWndPrev = CWnd::FindWindow(lpszUniqueClass, NULL))
	{
//		::AfxMessageBox(IDS_ALEARDY_RUN);
		// if so, does it have any popups?
		CWnd*	pWndChild = pWndPrev->GetLastActivePopup();
		// If iconic, restore the main window
		if (pWndPrev->IsIconic()) 
			pWndPrev->ShowWindow(SW_RESTORE);

		// Bring the main window or its popup to the foreground
		pWndChild->SetForegroundWindow();

		// and we are done activating the previous one.
		return  FALSE;
	}
//	else	// First instance. Proceed as normal.
	return  TRUE;
}
int CJHHBApp::ExitInstance() 
{
	if (bClassRegistered)
		::UnregisterClass(lpszUniqueClass, ::AfxGetInstanceHandle());

	return  CWinApp::ExitInstance();
}

/////////////////////////////////////////////////////////////////////////////
// CJHHBApp commands

// App command to run the dialog
#include "AboutDlg.h"
void CJHHBApp::OnAppAbout()
{
	CAboutDlg aboutDlg;
	aboutDlg.DoModal();
}

⌨️ 快捷键说明

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