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

📄 wincontainer.cpp

📁 miXo is a buzz machine (www.buzzmachines.com) - a plugin for the freely available jeskola buzz track
💻 CPP
字号:
#include <string>
#include <sstream>
#include <assert.h>
#include "stdafx.h"
#include "WinContainer.h"

using namespace std;

static CWinContainer g_stat_cWinContainer;
CWinContainer *g_GetWinContainer() {
	return &::g_stat_cWinContainer;
}
long CALLBACK g_WindowProcCaller(HWND h,UINT uMsg,WPARAM wParam,LPARAM lParam)
{	
	CAbProcClient *pcClient=::g_GetWinContainer()->GetProc(h);
	if(pcClient)
		return pcClient->Proc(h,uMsg,wParam,lParam);
	return ::DefWindowProc(h,uMsg,wParam,lParam);
}
BOOL CALLBACK g_DialogProcCaller(HWND h,UINT uMsg,WPARAM wParam,LPARAM lParam)
{
	CAbProcClient *pcClient=::g_GetWinContainer()->GetProc(h);
	if(pcClient)
		return pcClient->Proc(h,uMsg,wParam,lParam);
	return 0;
}

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CWinContainer::~CWinContainer()
{
	TLstProcData::iterator ite=m_lstProcData.begin();
	while(ite < m_lstProcData.end()) {
		delete *ite;
		ite++;
	}
#ifdef _DEBUG
	OutputDebugString("~CWinContainer");
#endif
}
void CWinContainer::RegisterWindow(CAbProcData *c)
{
	assert(c->GetClient());
	assert(c->GetWndHandle());
#ifdef _DEBUG
	stringstream stm;
	stm << "Register:" << c->GetWndHandle() << " " << c->GetClient()->GetDesc() << ends;
	string str=stm.str();
	OutputDebugString(str.c_str());
#endif
	m_lstProcData.push_back(c);
}

void CWinContainer::RegisterWindow(CAbProcClient*p,HWND h)
{
#ifdef _DEBUG
	stringstream stm;
	stm << "Register:" << h << " " << p->GetDesc() << ends;
	string str=stm.str();
	OutputDebugString(str.c_str());
#endif
	CAbProcData cWinProc(p,h);
	m_lstProcData.push_back(new CAbProcData(p,h));
}
void CWinContainer::UnregisterWindow(HWND h)
{
	assert(h);
	TLstProcData::iterator ite=m_lstProcData.begin();
	while(ite < m_lstProcData.end()) {
		if((*ite)->GetWndHandle() == h) {
#ifdef _DEBUG
			const char *sz=(*ite)->GetClient()->GetDesc();
			stringstream stm;
			stm << "Unregister:"<<sz<<ends;
			string str=stm.str();
			OutputDebugString(str.c_str());
#endif
			delete (*ite);
			m_lstProcData.erase(ite);
			return;
		}
		ite++;
	}
#ifdef _DEBUG
	stringstream stm;
	stm << "Unregister:" << h << "failed" << ends;
	string str=stm.str();
	OutputDebugString(str.c_str());
#endif
}
CAbProcClient *CWinContainer::GetProc(HWND h)
{
	TLstProcData::iterator ite=m_lstProcData.begin();
	while(ite < m_lstProcData.end()) {
		if((*ite)->GetWndHandle() == h) {
			assert(*ite);
			assert((*ite)->GetClient());
			return (*ite)->GetClient();//->Proc(h,uMsg,wParam,lParam);
		}
		ite++;
	}
	return NULL;//::DefWindowProc(h,uMsg,wParam,lParam);
}

⌨️ 快捷键说明

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