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

📄 dialogthread.cpp

📁 类似于文件浏览器的vc++应用程序,容易使用,能进行各种文件操作.
💻 CPP
字号:
// DialogThread.cpp : implementation file
//

#include "stdafx.h"
#include "FileDialogView.h"
#include "DialogThread.h"
#include "DialogFileView.h"

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

/////////////////////////////////////////////////////////////////////////////
// CDialogThread
HANDLE CDialogThread::g_hEventClosed = CreateEvent(NULL, TRUE, FALSE, NULL);;
HHOOK CDialogThread::g_hHook = NULL;
static long lThreads = 0;

IMPLEMENT_DYNCREATE(CDialogThread, CWinThread)

CDialogThread::CDialogThread()
{
	m_msgCur.wParam = 0;
	m_hWndParent = NULL;
	m_pAttachedView = NULL;
	m_nID = 0;
	InterlockedIncrement(&lThreads);
	m_hEventCreated = CreateEvent(NULL, TRUE, FALSE, NULL);
}

CDialogThread::~CDialogThread()
{
	CloseHandle(m_hEventCreated);
	if(m_pAttachedView)
		delete m_pAttachedView;
	if(0 == InterlockedDecrement(&lThreads))
		VERIFY(SetEvent(g_hEventClosed));
}

BOOL CDialogThread::InitInstance()
{
	g_hHook = SetWindowsHookEx(WH_KEYBOARD, 
						 reinterpret_cast<HOOKPROC>(CDialogThread::KeyBoardHook), 
						 NULL, GetCurrentThreadId());	

	CDialogFileView dlg(*this);
	dlg.DoModal();
	m_pMainWnd = NULL;
	return FALSE;
}

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

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

/////////////////////////////////////////////////////////////////////////////
// CDialogThread message handlers

UINT WINAPI CDialogThread::KeyBoardHook(int nCode, WPARAM wParam, LPARAM lParam)
{
	if (nCode >= 0 && wParam==VK_ESCAPE)
		return 1;
	return CallNextHookEx(g_hHook, nCode, wParam, lParam);
}

⌨️ 快捷键说明

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