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

📄 cwizard.cpp

📁 bt848,bt878 a采集卡的探测
💻 CPP
字号:
#include "CWizard.hpp"

CWizard* CWizard::Current=NULL;	// Current wizard executing

CWizard::CWizard(
		LPTSTR		Caption ,
		LPTSTR		Icon)
{
	// Fill in the Header struct
	// Prepare header
    memset(&psh,0,sizeof(PROPSHEETHEADER));
    psh.dwSize = sizeof(PROPSHEETHEADER);
	psh.dwFlags = PSH_PROPSHEETPAGE | PSH_WIZARD | PSH_NOAPPLYNOW | ((Icon) ? PSH_USEICONID : 0);
	psh.pszIcon = Icon;
	
	psh.pszCaption = Caption;
}

bool CWizard::Execute(HINSTANCE	Instance,const CWnd& parent)
{

	// Prepare all the structs to fire!
	CMemory blk;
	if (!blk.ReSize(sizeof(PROPSHEETPAGE) * Pages.Count())) return false;
	PROPSHEETPAGE* psp = (PROPSHEETPAGE*) blk.Ptr();
	
	memset(psp,0, sizeof(PROPSHEETPAGE) * Pages.Count());
	for (UINT Idx = 0; Idx < Pages.Count() ; Idx++) {
		CWizardPage* pg = Pages[Idx];
		psp[Idx].dwSize = sizeof(PROPSHEETPAGE);
		psp[Idx].hInstance = Instance;
		psp[Idx].pszTemplate = pg->GetRES();
		psp[Idx].pfnDlgProc = Proc;
		psp[Idx].dwFlags = PSP_PREMATURE;
		psp[Idx].lParam = (LPARAM) pg;
	}

	// Fill in all the missing parts to execute the wizard
    psh.hwndParent = parent.GetHWND();
    psh.nPages = Pages.Count();
    psh.ppsp = (LPCPROPSHEETPAGE) psp;
	psh.hInstance = Instance;

	// Start the Main Dialog!
	CWizard* Old = Current;
	Current = this;
    PropertySheet(&psh);
	Current = Old;

	return true;
}

// Our message handler for wizards
INT APIENTRY CWizard::Proc(
			HWND hWnd,                // window handle                   
			UINT message,             // type of message                 
			WPARAM wParam,            // additional information          
			LPARAM lParam)	          // additional information          
{
	// If we are initing, lParam contains pointer to CWizardPage. use to init page!
	if (message == WM_INITDIALOG) {
		PROPSHEETPAGE* psp = (PROPSHEETPAGE*) lParam;
		CWizardPage* pg = (CWizardPage*) psp->lParam;
		pg->SetHWND(hWnd);
	}
	
	// Look to see if we can locate the page!
	for (UINT Idx = 0; Idx < Current->Pages.Count() ; Idx++) {
		CWizardPage* pg = Current->Pages[Idx];
		if (pg->GetHWND() == hWnd) {
			// Found it, dispatch message!
			return pg->Proc(message,wParam,lParam);
		}
	}

	// Else, exit with default fn.
	return 0;
}

⌨️ 快捷键说明

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