GetZZLCommander.h
资源名称:p2p_vod.rar [点击查看]
上传用户:liguizhu
上传日期:2015-11-01
资源大小:2422k
文件大小:3k
源码类别:
P2P编程
开发平台:
Visual C++
- /*
- * Openmysee
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
- #if defined (_MSC_VER) && (_MSC_VER >= 1000)
- #pragma once
- #endif
- #ifndef _GETZZLCOMMANDER_H
- #define _GETZZLCOMMANDER_H
- #include <list>
- #include "GetZZL.h"
- using namespace std;
- class CGetZZLDisplayDlg;
- class CCri
- {
- public:
- CCri()
- {
- InitializeCriticalSection(&moCS);
- };
- ~CCri()
- {
- DeleteCriticalSection(&moCS);
- };
- void Enter()
- {
- EnterCriticalSection(&moCS);
- };
- void Leave()
- {
- LeaveCriticalSection(&moCS);
- }
- private:
- CRITICAL_SECTION moCS;
- };
- class CAuto
- {
- public:
- CAuto (CCri* apCS)
- {
- mpCS = apCS;
- mpCS->Enter();
- };
- ~CAuto()
- {
- mpCS->Leave();
- };
- CCri* mpCS;
- };
- class CGetZZLCommander
- {
- public:
- CGetZZLCommander();
- ~CGetZZLCommander();
- public:
- void CreateInstance();
- BOOL SetSourceFile(CString& astrSourceFile, CString& astrSourceFileName);
- void DelSourceFile(CString& astrSourceFileName);
- void CloseGetZZL();
- BOOL RunCommader(CWnd* apWnd);
- void Stop();
- void SetClose();
- void SetBuffer(CString& astrBuffer);
- //该函数用来回调
- static int __stdcall GetZZLState(void* apUserPara,int aiState);
- //设置转化ZZL处理过程函数
- static void __stdcall ConvertZZL( CGetZZLCommander* pParam);
- //初始化调试信息
- bool CreateDebugInfo();
- private:
- struct STRU_SOURCE_FILE
- {
- char* mszSourceFile;
- char* mszSourceFileName;
- BOOL mbFinished;
- };
- int miCount; //当转换多个文件时,用来计数。
- HANDLE mhGetZZL;
- list<STRU_SOURCE_FILE> mlstSourceFile;
- //这是一个ZZL文件转换完成的标志,0为运行,1为停止(全部文件转化完成为停止)。-1为发生意外错误停止(用户点击Stop为意外停止)
- volatile int miStopFlag;
- CString mstrBuffer;
- CWnd* mpWnd; //显示界面的CWnd
- BOOL mbClose;
- BOOL mbRunThread; //防止起两个或以上线程
- CCri mocritsec;
- };
- #endif