
#pragma once
#include <stdio.h>
#include <locale.h>
#include <stdlib.h>
//#include <time.h> //或者 #include <ctime>
#include <ctime>
#include <io.h>
#pragma comment(lib,"version.lib")
#include <vector>
#include <string>
// GDI+
#include <gdiplus.h>
using namespace Gdiplus;
#pragma comment(lib, "gdiplus.lib")


#ifndef _UNICODE 
typedef string TString;
#else
typedef wstring TString;
#endif

namespace Global
{
	//////////////////////////////////////////////////////////////////////////
	// 全局变量;
	extern TCHAR g_szCurModuleDir[MAX_PATH];
	extern TCHAR g_szCurModulePath[MAX_PATH];
	extern TCHAR g_szFna[MAX_PATH];
	extern TCHAR g_szConfig[MAX_PATH];


	//////////////////////////////////////////////////////////////////////////
	// 全局函数;
	void GetConfig();
	void WriteTextLog(const TCHAR* format, ...);
	BOOL LoadImgFromFile(IN Image** pImg, LPCTSTR lpPath);
	BOOL LoadImgFromBuffer(IN Image** pImg, IN BYTE* pBuffer, IN CONST INT& nBufLen);
	BOOL LoadImgFromBuffer(IN Image** pImg, LPCTSTR lpPath);
	int GetEncoderClsid(IN CONST WCHAR* format, OUT CLSID* pClsid);
	Image* LoadImgFromResource(IN HMODULE hModule, IN LPCTSTR lpName, IN LPCTSTR lpType);
	BOOL SaveImgByRotate(LPCTSTR lpszFileName, BYTE* pBuffer, CONST INT& nBufLen, BOOL bHoriontal, BOOL bVertically);
	void MKDIR(LPCTSTR dir);
	bool GetVersion(OUT WORD* pdwFileVersion, OUT WORD* pdwProductVerion);
};
