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

📄 sample.cpp

📁 RPG游戏的剧情部分源码。是Visual C++角色扮演游戏程序设计的第七章的源码
💻 CPP
字号:
//
//	Application
//
//		Copyright (c) 2000-2001 Chihiro.SAKAMOTO (HyperWorks)
//
#include "StdAfx.h"
#include "Sample.h"
#include "resource.h"

//
// Application的对象实例(instance)
//
CSampleApp	theApp;

//
// 构造函数
//
CSampleApp::CSampleApp()
{
	hMutex = 0;
}

//
// 析构函数
//
CSampleApp::~CSampleApp()
{
	if (hMutex)
		::CloseHandle(hMutex);
}

//
// Application 初始化
//
BOOL CSampleApp::InitInstance()
{
	// 防止Application多重启动
	if ((hMutex = ::CreateMutex(NULL, FALSE, ApplicationName "_Running")) == NULL)
		return FALSE;

	DWORD	Ret = ::WaitForSingleObject(hMutex, 0);
	if (Ret == WAIT_TIMEOUT || Ret == WAIT_FAILED)
		return FALSE;

	// 若不是真彩模式则不能启动应用程序
	HDC		dc = GetDC(0);
	int		nbits = GetDeviceCaps(dc, BITSPIXEL);
	ReleaseDC(0, dc);

	if (nbits < 15) {
		::MessageBox(0, "程序不能在256色以下执行。\n请更换显示模式。",
			ApplicationTitle, MB_ICONSTOP|MB_OK);
		return FALSE;
	}

	// 产生主窗口MainWin
	if (!MainWin.Create(this, ApplicationTitle, LoadMenu(IDC_APPMENU)))
		return FALSE;

	MainWnd = &MainWin;

	return TRUE;
}

⌨️ 快捷键说明

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