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

📄 mywnd.cpp

📁 磁卡读写器编程
💻 CPP
字号:
/*********************************************************************
 *   Designed by xiaohuiyang 2002.03.15    E-mail: yxh2001@21cn.com  * 
 *********************************************************************/
// Mywnd.cpp: implementation of the CMyWindow class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "KDCard.h"
#include "Mywnd.h"

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

///////////////////////////////////////
//message: WM_THREADFIREEVENT
//wParam:  FALSE means fire the event.  TRUE means destroy our window
//lParam:  Not used
#define WM_THREADFIREEVENT WM_USER+102
#define WM_THREADTAKECARDEVENT WM_USER+103

/////////////////////////////////////////////////////////////////////////////
// CMyWindow

CMyWindow::CMyWindow(CKDCARDCtrl *pCtrl):m_pControl(pCtrl)
{
}

CMyWindow::~CMyWindow()
{
}


BEGIN_MESSAGE_MAP(CMyWindow, CWnd)
	//{{AFX_MSG_MAP(CMyWindow)
		// NOTE - the ClassWizard will add and remove mapping macros here.
	//}}AFX_MSG_MAP
	ON_MESSAGE(WM_THREADFIREEVENT,OnFireEventForThread)
	ON_MESSAGE(WM_THREADTAKECARDEVENT,OnTakCardEventForThread)
END_MESSAGE_MAP()


/////////////////////////////////////////////////////////////////////////////
// CMyWindow message handlers

HWND CMyWindow::Create()
{
	//Register a window class
	LPCTSTR classname = 0;
	classname = AfxRegisterWndClass(0);

	//Create the window and return it's handle
	CWnd::CreateEx(NULL,classname,NULL,NULL,1,1,1,1,NULL,NULL);
	ASSERT(m_hWnd!=NULL);
	return m_hWnd;
}

LRESULT CMyWindow::OnFireEventForThread(WPARAM wParam, LPARAM lParam)
{
	//This is a one-message-does-everything handler.  If wParam is not
	//set, that means our message has been sent to fire the even.
	//If wParam is set that means we're being asked to destroy ourselves
//	if(!wParam)
		m_pControl->FireClassEvent();
//	else if(wParam==1)
//		DestroyWindow();

	return TRUE;
}
LRESULT CMyWindow::OnTakCardEventForThread(WPARAM wParam, LPARAM lParam)
{
	m_pControl->FireTakeEvent();

	return TRUE;
}

void CMyWindow::PostNcDestroy() 
{
	//clean up this object
	delete this;
}

void CMyWindow::Close()
{
    if(	m_hWnd!=NULL)
	{
		DestroyWindow();
//		PostNcDestroy();
	}
	
}

⌨️ 快捷键说明

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