123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151 |
- // StoneU_HC_CARDOCX.cpp : CStoneU_HC_CARDOCXApp 和 DLL 注册的实现。
- #include "stdafx.h"
- #include "StoneU_HC_CARDOCX.h"
- #include "Global.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #endif
- CStoneU_HC_CARDOCXApp NEAR theApp;
- const GUID CDECL BASED_CODE _tlid =
- { 0xDA935744, 0x8DBC, 0x4546, { 0xA6, 0xC2, 0x2F, 0xDE, 0x72, 0xF6, 0x4, 0x4C } };
- const WORD _wVerMajor = 1;
- const WORD _wVerMinor = 0;
- BOOL FolderExist(CString strPath)
- {
- WIN32_FIND_DATA wfd;
- BOOL rValue = FALSE;
- HANDLE hFind = FindFirstFile(strPath, &wfd);
- if( (hFind != INVALID_HANDLE_VALUE) && (wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) )
- {
- rValue = TRUE;
- }
- FindClose(hFind);
-
- return rValue;
- }
- // CStoneU_HC_CARDOCXApp::InitInstance - DLL 初始化
- BOOL CStoneU_HC_CARDOCXApp::InitInstance()
- {
- BOOL bInit = COleControlModule::InitInstance();
- if (bInit)
- {
- AfxEnableControlContainer();
- CCommandLineInfo cmdInfo;
- ParseCommandLine(cmdInfo);
- // Standard initialization
- // If you are not using these features and wish to reduce the size
- // of your final executable, you should remove from the following
- // the specific initialization routines you do not need.
- #ifdef _AFXDLL
- Enable3dControls(); // Call this when using MFC in a shared DLL
- #else
- Enable3dControlsStatic(); // Call this when linking to MFC statically
- #endif
-
- if (!AfxSocketInit())
- {
- AfxMessageBox(IDP_SOCKETS_INIT_FAILED);
- return FALSE;
- }
- g_IniFile.SetPath("C:\\OCXRect.ini");
- g_IniFile.GetVarInt(_T("WH"),_T("W"),g_nFrameWeight);
- g_IniFile.GetVarInt(_T("WH"),_T("H"),g_nFrameHeight);
- //if( g_nFrameWeight<=750 ) g_nFrameWeight = 750;
- //if( g_nFrameHeight<=570 ) g_nFrameHeight = 570;
-
- g_IniFile.SetPath("C:\\videoset.ini");
- g_IniFile.GetVarStr(_T("video"),_T("VideoPath"),g_strVideoPath);
- g_IniFile.GetVarInt(_T("video"),_T("DiskVelume"),g_nDiskVolume);
- g_IniFile.GetVarInt(_T("video"),_T("OperateType"),g_nOperateType);
- g_IniFile.GetVarInt(_T("video"),_T("VideoMaxTime"),g_nVideoMaxTime);
- g_IniFile.GetVarInt(_T("video"),_T("NoMotionTime"),g_nNoMotionTime);
- //RECT
- g_IniFile.GetVarInt(_T("RECT"),_T("Change"),g_nChangePos);
- int left=0,top=0,right=0,bottom=0;
- g_IniFile.GetVarInt(_T("RECT"),_T("Left"),left);
- g_IniFile.GetVarInt(_T("RECT"),_T("Top"),top);
- g_IniFile.GetVarInt(_T("RECT"),_T("Right"),right);
- g_IniFile.GetVarInt(_T("RECT"),_T("Bottom"),bottom);
- g_Rect.left = left;
- g_Rect.top = top;
- g_Rect.right = right;
- g_Rect.bottom = bottom;
- if( g_Rect.right<=550 ) g_Rect.right = 550;
- if( g_Rect.bottom<=400 ) g_Rect.bottom = 400;
- if( g_strVideoPath=="" )
- g_strVideoPath = "D:\\StoneUVideo\\";
- if (!FolderExist(g_strVideoPath))
- CreateDirectory(g_strVideoPath, NULL);
- }
- //RegisterLogRecordCallback(LogRecordFunc, &dlg);
- return bInit;
- }
- // CStoneU_HC_CARDOCXApp::ExitInstance - DLL 终止
- int CStoneU_HC_CARDOCXApp::ExitInstance()
- {
- // TODO: 在此添加您自己的模块终止代码。
- return COleControlModule::ExitInstance();
- }
- // DllRegisterServer - 将项添加到系统注册表
- STDAPI DllRegisterServer(void)
- {
- AFX_MANAGE_STATE(_afxModuleAddrThis);
- if (!AfxOleRegisterTypeLib(AfxGetInstanceHandle(), _tlid))
- return ResultFromScode(SELFREG_E_TYPELIB);
- if (!COleObjectFactoryEx::UpdateRegistryAll(TRUE))
- return ResultFromScode(SELFREG_E_CLASS);
- return NOERROR;
- }
- // DllUnregisterServer - 将项从系统注册表中移除
- STDAPI DllUnregisterServer(void)
- {
- AFX_MANAGE_STATE(_afxModuleAddrThis);
- if (!AfxOleUnregisterTypeLib(_tlid, _wVerMajor, _wVerMinor))
- return ResultFromScode(SELFREG_E_TYPELIB);
- if (!COleObjectFactoryEx::UpdateRegistryAll(FALSE))
- return ResultFromScode(SELFREG_E_CLASS);
- return NOERROR;
- }
|