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

📄 tdatasource.cpp

📁 mpq文件的格式就是一种压缩格式
💻 CPP
字号:
/*****************************************************************************/
/* TDataSource.cpp                        Copyright (c) Ladislav Zezula 2003 */
/*---------------------------------------------------------------------------*/
/* Implementation of TDataSource class for drag from MPQ Editor to Explorer  */
/*---------------------------------------------------------------------------*/
/*   Date    Ver   Who  Comment                                              */
/* --------  ----  ---  -------                                              */
/* 06.05.03  1.00  Lad  The first version of TDataSource.cpp                 */
/*****************************************************************************/

#include "StdAfx.h"
#include "TMainFrm.h"
#include "TDataSource.h"

//-----------------------------------------------------------------------------
// TDataSource class

TDataSource::TDataSource() : COleDataSource()
{
    m_pMainFrame = NULL;
    m_pWorkInfo  = NULL;
    m_hDrop      = NULL;
}

TDataSource::~TDataSource()
{
    if(m_pMainFrame != NULL && m_pWorkInfo != NULL)
    {
        m_pMainFrame->FreeWorkInfo(m_pWorkInfo);
        m_pWorkInfo = NULL;
    }
}

BOOL TDataSource::OnRenderGlobalData(LPFORMATETC, HGLOBAL * phGlobal)
{
    MSG msg;
    BOOL bResult = FALSE;

    *phGlobal = NULL;
    if(m_pMainFrame && m_pWorkInfo && m_hDrop)
    {
        // Start the worker thread. If succeeded, invalidate the pointer
        // to the work info. The worker thread will free it when finishes.
        if(m_pMainFrame->StartWorkThread(m_pWorkInfo) == ERROR_SUCCESS)
        {
            m_pWorkInfo = NULL;

            // Wait untile the worker thread finishes.
            // Do not forget to process messages !!!
            while(WaitForSingleObject(m_pMainFrame->m_hWorkThread, 100) == WAIT_TIMEOUT)
            {
                if(::PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
                {
                    ::TranslateMessage(&msg);
                    ::DispatchMessage(&msg);
                }
            }
            *phGlobal = (HGLOBAL)m_hDrop;
            bResult = TRUE;
        }
    }
    return bResult;
}

void TDataSource::SetWorkData(TMainFrame * pMainFrame, TWorkInfo * pInfo)
{
    m_pMainFrame = pMainFrame;
    m_pWorkInfo  = pInfo;
}

⌨️ 快捷键说明

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