// 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;
		}
	}
}