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

📄 smartbook.cpp

📁 Smartphone手机阅读软件
💻 CPP
字号:
// SmartBook.cpp : Defines the entry point for the application.
//

#include "stdafx.h"

#include "MainWnd.h"

// Global variables
CAppModule _Module;

const TCHAR g_szApplicationTitle[] = _T("Phone Reader");
const TCHAR g_szUniqueString[] = _T("DmoQs3XbkUC6zFoS8lC/gQ==");
HWND g_hWndLast = NULL;
// WinMain
int WINAPI WinMain(HINSTANCE hInstance,
                   HINSTANCE hPrevInstance,
                   LPWSTR     lpCmdLine,
                   int        CmdShow)
{
	// Check if one instance is already running.
	const HANDLE hMutex = ::CreateMutex(NULL, FALSE, g_szUniqueString);

	if(NULL != hMutex) {
		if(ERROR_ALREADY_EXISTS == ::GetLastError())
		{
			// This is not the first instance of the application.
			// Activate the firsty instance and exit.
			const HWND hWndExistingInstance = ::FindWindow(g_szUniqueString, NULL);
//			VERIFY((NULL == hWndExistingInstance) || ::SetForegroundWindow(hWndExistingInstance));
			::SendMessage(hWndExistingInstance,WM_ACTIVATEPREINSTANCE,0,0);
			return 0;
		}

		// Init common controls
		// TODO: remove unused controls
		INITCOMMONCONTROLSEX comctrex;
		comctrex.dwSize = sizeof(comctrex);
		comctrex.dwICC = ICC_UPDOWN_CLASS
			| ICC_DATE_CLASSES		// date and time-picker control 
			| ICC_PROGRESS_CLASS	// progress bar control 
			| ICC_LISTVIEW_CLASSES  // list view and header control
			| ICC_TREEVIEW_CLASSES;	// tree view control
		::InitCommonControlsEx(&comctrex);

		// Init module.
		_Module.Init(NULL, hInstance);

		// Create main window.
		CMainWnd wnd;
		RECT rc;
		::SystemParametersInfo(SPI_GETWORKAREA, 0, &rc, 0);
		if(NULL == wnd.Create(NULL, rc, g_szApplicationTitle, WS_VISIBLE))
		{
			return 1;
		}

		// Run message loop.
		CMessageLoop loop;
		_Module.AddMessageLoop(&loop);
		int nResult = loop.Run();

		// Terminate.
		_Module.RemoveMessageLoop();
		_Module.Term();

		return nResult;
	}

	return 2;
}

⌨️ 快捷键说明

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