// stdafx.h : include file for standard system include files,
//  or project specific include files that are used frequently, but
//      are changed infrequently
//#define WIN32_LEAN_AND_MEAN   // Exclude rarely-used stuff from Windows headers
// Windows Header Files:
//#include <windows.h>
//#include <WinSock2.h>


#if !defined(AFX_STDAFX_H__D3E3BA89_EEFA_11D5_AB1C_00D0B70C3D79__INCLUDED_)
#define AFX_STDAFX_H__D3E3BA89_EEFA_11D5_AB1C_00D0B70C3D79__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
//#define WIN32_LEAN_AND_MEAN
// #ifndef   _WIN32_WINNT 
// #define   _WIN32_WINNT   0x0400 
// #endif

#ifndef WINVER                          // ָ��Ҫ������ƽ̨�� Windows Vista��
#define WINVER 0x0600           // ����ֵ����Ϊ��Ӧ��ֵ���������� Windows �������汾��
#endif

#ifndef _WIN32_WINNT            // ָ��Ҫ������ƽ̨�� Windows Vista��
#define _WIN32_WINNT 0x0600     // ����ֵ����Ϊ��Ӧ��ֵ���������� Windows �������汾��
#endif

#ifndef _WIN32_WINDOWS          // ָ��Ҫ������ƽ̨�� Windows 98��
#define _WIN32_WINDOWS 0x0410 // ����ֵ����Ϊ�ʵ���ֵ���������� Windows Me ����߰汾��
#endif

#ifndef _WIN32_IE                       // ָ��Ҫ������ƽ̨�� Internet Explorer 7.0��
#define _WIN32_IE 0x0700        // ����ֵ����Ϊ��Ӧ��ֵ���������� IE �������汾��
#endif


//#define VC_EXTRALEAN		// Exclude rarely-used stuff from Windows headers
#include <afxwin.h>         // MFC core and standard components
#include <afxext.h>         // MFC extensions
#include <afxdtctl.h>		// MFC support for Internet Explorer 4 Common Controls
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h>			// MFC support for Windows Common Controls
#endif // _AFX_NO_AFXCMN_SUPPORT
#include <afxdb.h>			// MFC ODBC database classes
#include <afxmt.h>
#include <afxsock.h>		// MFC socket extensions
#include <afxdisp.h>

#include "Shlwapi.h"
#include <afxtempl.h>
#include <shlobj.h>
#include "shfolder.h"
#include <afxtempl.h>	// MFC ���

//#include <Wincrypt.h>	// ����ȥ��sdkinclude���Ŀ¼;
//#include "log4c.h"
#include "Global.h"
#include "LanShareDll.h"
using namespace LanShareDll;

#include "SafeList.h"

//#define BASIC_VERSION   //���װ棬ֻ������
#define MSG_LENGTH   64
#define TIMEDOG_VERSION//ʱ�ӹ�
#define SQLSERVER_VERSION   //MS SQL�汾
//...........................
//#define LKAY_VERSION   //������Ӥ
//#define LYFZ_VERSION   //�ڲ��汾
//...........................

//��ͯ��
//#define CHILD_VERSION
		
//��ϯ��
//#define CONNCOUNT_VERSION

//��ҵ��
//#define ENTERPRISE_VERSION		
//...........................

// ��ͯ���������汾��
// 1.ֻ����CHILD_VERSION�꣬���Ƕ�ͯȫ�ܰ�;
// 2.����CHILD_VERSION + CONNCOUNT_VERSION ����ͯ��ϯ��;
// 3.����CHILD_VERSION + ENTERPRISE_VERSION����ͯ��ҵ�棻

// ��ɴ�棺
// 1.ȫ����رգ����ǻ�ɴȫ�ܰ�;
// 2.ֻ����CONNCOUNT_VERSION�����ǻ�ɴ��ϯ�棻
// 3.ֻ����ENTERPRISE_VERSION�����ǻ�ɴ��ҵ�棻

#define FTPSTAT_DOWNLOADSUCCEEDED	2
#define FTPSTAT_UPLOADSUCCEEDED		3
#define FTPSTAT_DOWNLOADFAILED		4
#define FTPSTAT_UPLOADFAILED		5

#define WM_THREADSTART	WM_USER+200
#define WM_THREADCLOSE	WM_USER+201
#define WM_THREADMSG	WM_USER+202
#define WM_ADDTRACELINE WM_USER+203

#define USE_ADO_OPT_DB		0			//ʹ��Ado�������ݿ�

extern CString BrowseForFolder(HWND hWnd, LPCSTR lpszTitle, UINT nFlags);
extern void DoEvents();
extern void GetAppDir(CString& strAppDir);
extern BOOL WaitWithMessageLoop(HANDLE hEvent, int nTimeout);

PFNSHGETFOLDERPATHA GetFuncPtr_SHGetFolderPathA();
extern HRESULT CreateStartMenuShortcut(LPSTR lpszShortcutFile, LPSTR lpszDescription, LPTSTR lpszRelativeFolder);
extern void RemoveStartMenuShortcut(LPSTR lpszDescription, LPTSTR lpszRelativeFolder);
extern CString GetShortcutTarget(LPCTSTR lpszFilename);
void AutoSizeColumns(CListCtrl *pListCtrl);
BOOL MyMakeSureDirectoryPathExists(LPCTSTR lpszDirPath);
BOOL IsNumeric(char *buff);

#define USE_POOL 1
extern CArray<CODBCPool*, CODBCPool*> g_dbpool;
// ODBC������Ƭ��;
class ODBCConnGuard
{
	int m_nIndex;
	CDatabase *m_pODBCConn;
public:
	ODBCConnGuard( CDatabase *&pDBConn, const int& nIndex = -1, CONST DWORD &dwTimeOut = 30000 )
	{
		m_nIndex = nIndex + 1;
		m_pODBCConn = NULL;
		if ( g_dbpool.GetSize() )
		{
			pDBConn = g_dbpool.ElementAt(m_nIndex)->GetAConnection( dwTimeOut );
			m_pODBCConn = pDBConn;
		}
	}

	virtual ~ODBCConnGuard()
	{
		//CODBCPool::GetInstance()->RestoreAConnection(m_pODBCConn);
		if ( g_dbpool.GetSize() )
		{
			g_dbpool.ElementAt(m_nIndex)->RestoreAConnection(m_pODBCConn);
		}
	}
};

#define  MAXPOOL 3


#endif