UIThread.cpp
资源名称:08.zip [点击查看]
上传用户:ynjin1970
上传日期:2014-10-13
资源大小:6438k
文件大小:2k
源码类别:
中间件编程
开发平台:
Visual C++
- // UIThread.cpp : implementation file
- //
- #include "stdafx.h"
- #include "MyThread.h"
- #include "UIThread.h"
- #include "UIDlg.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // CUIThread
- IMPLEMENT_DYNCREATE(CUIThread, CWinThread)
- CUIThread::CUIThread()
- {
- }
- CUIThread::~CUIThread()
- {
- }
- BOOL CUIThread::InitInstance()
- {
- //在InitInstance中分配内存空间,产生窗口类对象
- /*CFrameWnd* pFrameWnd = new CFrameWnd();//动态分配内存空间
- //保存指针到CUIThread的m_pMainWnd成员中
- m_pMainWnd=pFrameWnd;//在线程正常退出时会自动被释放内存空间
- //使用Create函数产生窗口
- //pFrameWnd->Create(NULL,"用户界面线程");
- //或者使用LoadFrame装入框架窗口
- pFrameWnd->LoadFrame(IDR_MYZY);
- //使用ShowWindow函数显示窗口
- pFrameWnd->ShowWindow(SW_SHOW);
- //更新窗口
- pFrameWnd->UpdateWindow();*/
- //基于对话框的用户界面线程
- CUIDlg dlg;
- m_pMainWnd = &dlg;//在线程正常退出时会自动被释放内存空间
- dlg.DoModal();
- return TRUE;
- }
- int CUIThread::ExitInstance()
- {
- // TODO: perform any per-thread cleanup here
- //delete m_pMainWnd;
- return CWinThread::ExitInstance();
- }
- BEGIN_MESSAGE_MAP(CUIThread, CWinThread)
- //{{AFX_MSG_MAP(CUIThread)
- ON_COMMAND(ID_JM_COPY, OnJmCopy)
- ON_COMMAND(ID_JM_CUT, OnJmCut)
- ON_COMMAND(ID_JM_EXIT, OnJmExit)
- ON_COMMAND(ID_JM_PASTE, OnJmPaste)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // CUIThread message handlers
- void CUIThread::OnJmCopy()
- {
- // TODO: Add your command handler code here
- }
- void CUIThread::OnJmCut()
- {
- // TODO: Add your command handler code here
- }
- void CUIThread::OnJmExit()
- {
- // TODO: Add your command handler code here
- AfxEndThread(0);
- }
- void CUIThread::OnJmPaste()
- {
- // TODO: Add your command handler code here
- }