12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- // stdafx.cpp : 只包括标准包含文件的源文件
- // test.pch 将作为预编译头
- // stdafx.obj 将包含预编译类型信息
- #include "stdafx.h"
- // TODO: 在 STDAFX.H 中
- // 引用任何所需的附加头文件,而不是在此文件中引用
- //////////////////////////////////////////////////////////////////////////
- // 用例;
- HMODULE g_hlogdll = NULL;
- log_Start g_logStart = NULL;
- log_Stop g_logStop = NULL;
- log_enable g_logEnable = NULL;
- log_Setlogpath g_Setlogpath = NULL;
- log_Getlogpath g_Getlogpath = NULL;
- log_GetTime g_GetTime = NULL;
- BOOL LoadLogLibarary()
- {
- if ( g_hlogdll == NULL )
- {
- g_hlogdll = (HMODULE)LoadLibrary(_T("logmodule.dll"));
- if (!g_hlogdll)
- return FALSE;
- }
- g_logStart = (log_Start)GetProcAddress(g_hlogdll, "StartServer");
- if ( !g_logStart )
- {
- FreeLogLibarary();
- return FALSE;
- }
- g_logStop = (log_Stop)GetProcAddress(g_hlogdll, "StopServer");
- if ( !g_logStop )
- {
- FreeLogLibarary();
- return FALSE;
- }
- g_logEnable = (log_enable)GetProcAddress(g_hlogdll, "EnableWriteLog");
- if ( !g_logEnable )
- {
- FreeLogLibarary();
- return FALSE;
- }
- g_Setlogpath = (log_Setlogpath)GetProcAddress(g_hlogdll, "SetCaselogPath");
- if ( !g_Setlogpath )
- {
- FreeLogLibarary();
- return FALSE;
- }
- g_Getlogpath = (log_Getlogpath)GetProcAddress(g_hlogdll, "GetCaselogPath");
- if ( !g_Getlogpath )
- {
- FreeLogLibarary();
- return FALSE;
- }
- g_GetTime= (log_GetTime)GetProcAddress(g_hlogdll, "GetReceivePrintTime");
- if ( !g_GetTime )
- {
- FreeLogLibarary();
- return FALSE;
- }
- return TRUE;
- }
- void FreeLogLibarary()
- {
- if ( g_hlogdll )
- {
- if ( FreeLibrary(g_hlogdll) )
- {
- g_hlogdll = NULL;
- g_logStart = NULL;
- g_logStop = NULL;
- }
- }
- }
|