// FileHandle.h: interface for the CFileHandle class.
//
//////////////////////////////////////////////////////////////////////
/***************************作者信息*************************************/
/* Name: Nack Li */
/* EMail: lhtn.com@163.com */
/* MSN: lhtnNack@hotmail.com */
/****************************author Info*********************************/
#if !defined(AFX_FILEHANDLE_H__E083727A_5960_4B1C_B8E0_8C0C2A6FA5E1__INCLUDED_)
#define AFX_FILEHANDLE_H__E083727A_5960_4B1C_B8E0_8C0C2A6FA5E1__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#ifdef FILE_HANDLE_IMPORT
#define FILE_HANDLE_IMPORT __declspec(dllimport)
#else
#define FILE_HANDLE_IMPORT __declspec(dllexport)
#endif
/***********************************************************************************/
typedef struct _FILE_NUN
{
DWORD FolderNum;
DWORD FileNum;
DWORD FileSize;
}FILE_NUM,*LPFILE_NUM;
#define MAXZERO(ZeroData) memset(ZeroData,0,MAX_PATH);
#ifndef min
#define min(a,b) (((a) < (b)) ? (a) : (b))
#endif
/***********************************************************************************/
static UINT WM_SHOWANDHIDETASK = ::RegisterWindowMessage(_T("NACK TEST"));//change status show exe file ico message
class FILE_HANDLE_IMPORT CFileHandle
{
public:
#ifndef UNDER_CE
long CopyAllFolderAndFile(char *szDest,char *szSrc);
#endif
BOOL Size2String(LONGLONG llBytes, LPTSTR pszSize, DWORD cLen);
BOOL JudgeFileIsExist(TCHAR *FileName);
void OnChangeStockIcon(HINSTANCE hInstance, HWND hWnd, UINT IconID);//change status show exe file ico
void OnShowPragramAndDelStock(HINSTANCE hInstance,HWND hWnd, UINT IconID);//delete status show exe file ico
void OnHidePragramAndAddStock(HINSTANCE hInstance,HWND hWnd,UINT IconID);//add status show exe file ico
void GetBuilTime(TCHAR * szTime);//get file build time
BOOL JudgeFileIsDir(TCHAR * szFileName);//judge file ifnot dir
void OpenDirPath(HWND hWnd, TCHAR *szCachePath);//not use wince
int SplitString(char *cInputString, //input string
char **cOutputArray,//output string ,note output buff size
unsigned int uiArraySize, //sizeof(cInputString)
const char *cDelimiters);//split string
// void FindAndKillProces(LPVOID ProcesName);//because inport dll
DWORD CreateRunProgram(LPVOID ProceeName);//create process
//write is not use
void WriteProfileInt(const char *filename,
const char *section,
const char *key,
int value);
void WriteProfileString(const char *filename,
const char *section,
const char *key,
const char *pszWriteStr);
void WriteProfileDouble(const char *filename,
const char *section,
const char *key,
double value);
//get profile is ok
void GetProfileString(const char *filename,
const char *section,
const char *key,
char *pszRetStr,
const char *defaultStr);
int GetProfileInt(const char *filename,
const char *section,
const char *key,
int defaultValue);
double GetProfileDouble(const char *filename,
const char *section,
const char *key,
double defaultValue);
void GetProfileString(const wchar_t *filename,
const wchar_t *section,
const wchar_t *key,
wchar_t *pszRetStr,
const wchar_t *defaultStr);
int GetProfileInt(const wchar_t *filename,
const wchar_t *section,
const wchar_t *key,
const int defaultValue);
double GetProfileDouble(const wchar_t *filename,
const wchar_t *section,
const wchar_t *key,
const double defaultValue);
BOOL DeleteAllFileAndFolder(TCHAR * szFileName);//delete file and dir,note readonly is dele but sys file is not delete
void CountFileSize(TCHAR *szFileName,LPFILE_NUM FileNum);//get file size
void GetRunExePath(TCHAR *strFolderPath);//get curren run process path
BOOL SetDirSysUpdateTime(LPTSTR DirName, LPSYSTEMTIME NewTime);//update dir and file updatetime
BOOL SetDirSysCreateTime(LPTSTR DirName, LPSYSTEMTIME NewTime);//update dir and file createtime
BOOL SetDirSysAccessTime(LPTSTR DirName, LPSYSTEMTIME NewTime);
BOOL GetDirSysAccessTime(LPTSTR DirName, LPSYSTEMTIME stime);//get dir and file access time
BOOL GetDirSysUpdateTime(LPTSTR DirName,LPSYSTEMTIME stime);
BOOL GetDirSysCreateTime(LPTSTR DirName,LPSYSTEMTIME stime);
DWORD CopyAllFileAndFolder(TCHAR * szDest, TCHAR * szSrc);//copy file and dir
CFileHandle();
virtual ~CFileHandle();
};
#endif // !defined(AFX_FILEHANDLE_H__E083727A_5960_4B1C_B8E0_8C0C2A6FA5E1__INCLUDED_)