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

📄 msgthread.cpp

📁 tc35i(GSM模块)的控制程序VC源码
💻 CPP
字号:
// MsgThread.cpp : implementation file
//

#include "stdafx.h"
#include "gsm_ctrl_prj.h"
#include "MsgThread.h"
#include "ClueOnDlg.h"
#include "afxmt.h"

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

CEvent g_eventMsg;

//CMsgClueDlg msgClueDlg;
CMsgClueDlg CMsgThread::m_msgClueDlg;
/////////////////////////////////////////////////////////////////////////////
// CMsgThread

IMPLEMENT_DYNCREATE(CMsgThread, CWinThread)

CMsgThread::CMsgThread()
{
	InitializeCriticalSection(&m_csSend);
}

CMsgThread::~CMsgThread()
{
	DeleteCriticalSection(&m_csSend);
}

BOOL CMsgThread::InitInstance()
{
	// TODO:  perform and per-thread initialization here
	return TRUE;
}

int CMsgThread::ExitInstance()
{
	// TODO:  perform any per-thread cleanup here
	return CWinThread::ExitInstance();
}

BEGIN_MESSAGE_MAP(CMsgThread, CWinThread)
	//{{AFX_MSG_MAP(CMsgThread)
		// NOTE - the ClassWizard will add and remove mapping macros here.
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CMsgThread message handlers

int CMsgThread::Run() 
{
	// TODO: Add your specialized code here and/or call the base class
	//int res;
	CClueOnDlg dlg;
	while (1)
	{

		WaitForSingleObject(g_eventMsg.m_hObject,INFINITE);
//		dlg.DoModal();
	//	msgClueDlg.DoModal();
//		clueDlg.SetShowStr(m_strMsg);
		EnterCriticalSection(&m_csSend);
		m_msgClueDlg.DoModal();
        LeaveCriticalSection(&m_csSend);

	}
	
	return CWinThread::Run();
}
void CMsgThread::SetShowMsg(CString str,CString timeStr,CString telStr){
    //m_strMsg = str;
	if (CMsgClueDlg::m_isShow)
	{
        m_msgClueDlg.SetShowStr(str,timeStr,telStr);
        m_msgClueDlg.SetDlgItemText(IDC_MSG,str);
		m_msgClueDlg.SetDlgItemText(IDC_TIME,timeStr);
		m_msgClueDlg.SetDlgItemText(IDC_COMFROM,telStr);
	}else
	    m_msgClueDlg.SetShowStr(str,timeStr,telStr);
}
CString CMsgThread::GetTimeStr(){
    return m_msgClueDlg.GetTimeStr();
}
CString CMsgThread::GetTelStr(){
	return m_msgClueDlg.GetTelStr();
}
bool CMsgThread::IsDlgShow(){
    if (CMsgClueDlg::m_isShow)
    	return true;
    else
        return false;
}

⌨️ 快捷键说明

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