📄 appface.h
字号:
int nDefWinType ,
char* szCheckSum ,
int nURFType ,
DWORD hInstance ,
char* szResType
) ;
BOOL __stdcall SkinStartW(PCWSTR SkinFile,
int nDefWinType ,
PCWSTR szCheckSum ,
int nURFType ,
DWORD hInstance ,
PCWSTR szResType
) ;
void __stdcall SkinThread() ;
BOOL __stdcall SkinWindowSet(HWND hWnd,int nSkinType) ;
BOOL __stdcall SkinWindowSetEx( HWND hWnd ,
int nSkinType ,
int nID ,
int nURFType ,
char* SkinFile ,
DWORD hInst ,
char* szResType ) ;
BOOL __stdcall SkinWindowSetExW(HWND hWnd ,
int nSkinType ,
int nID ,
int nURFType ,
PCWSTR SkinFile ,
DWORD hInst ,
PCWSTR szResType ) ;
void __stdcall SkinRemove() ;
HANDLE __stdcall BkCreate(int nBkType) ;
BOOL __stdcall BkDraw(HANDLE bkHandle ,
HDC dcTarget ,
LPRECT rcTarget ,
int nReserved //nControl only for bitmap
) ;
void __stdcall BkDelete(HANDLE bkHandle) ;
//Define SKINSTART and SKINSETEX macro for both ANSI and UNICODE
#ifdef _UNICODE
#define SKINSTART SkinStartW
#define SKINSETEX SkinWindowSetExW
#else
#define SKINSTART SkinStart
#define SKINSETEX SkinWindowSetEx
#endif
#ifdef __cplusplus
}
#endif //__cplusplus
//Help class for loading AppFace dynamic
#ifdef __cplusplus
class CAppFace
{
public:
typedef BOOL (__stdcall *APPFACE_START)(char*,int,char*,int,DWORD,char*) ;
typedef BOOL (__stdcall *APPFACE_STARTW)(PCWSTR,int,PCWSTR,int,DWORD,PCWSTR) ;
typedef void (__stdcall *APPFACE_REMOVE)();
typedef BOOL (__stdcall *APPFACE_SKINWINDOW)(HWND,int);
typedef void (__stdcall *APPFACE_THREAD)();
typedef HANDLE (__stdcall *APPFACE_BKCREATE)(int);
typedef BOOL (__stdcall *APPFACE_BKDRAW)(HANDLE,HDC,LPRECT,int);
typedef void (__stdcall *APPFACE_BKDELETE)(HANDLE);
typedef BOOL (__stdcall *APPFACE_SKINWINDOWEX)(HWND,long,long,int,char*,DWORD,char*) ;
typedef BOOL (__stdcall *APPFACE_SKINWINDOWEXW)(HWND,long,long,int,PCWSTR,DWORD,PCWSTR) ;
//After Ver 2.4 and the later, appface.dll is for ANSI ,appfaceu.dll is for UNICODE
#ifdef _UNICODE
CAppFace(LPCTSTR DllPath = L"AppFaceu.dll")
#else
CAppFace(LPCTSTR DllPath = "AppFace.dll")
#endif
{
pfnStart = NULL ;
pfnStartW = NULL ;
pfnRemove = NULL ;
pfnThread = NULL ;
pfnSkinWindow = NULL ;
pfnBkCreate = NULL ;
pfnBkDraw = NULL ;
pfnBkDelete = NULL ;
pfnSkinWindowEx = NULL ;
pfnSkinWindowExW= NULL ;
m_bValid = FALSE;
m_hDll = NULL ;
Init(DllPath) ;
};
~CAppFace(){Release(); };
BOOL Init(LPCTSTR DllPath)
{
if(m_hDll && m_bValid) return TRUE;
m_hDll = ::LoadLibrary(DllPath);
if(m_hDll == NULL) return FALSE ;
pfnStart = (APPFACE_START) GetProcAddress(m_hDll, "SkinStart");
if(!pfnStart) return FALSE;
pfnStartW = (APPFACE_STARTW) GetProcAddress(m_hDll, "SkinStartW");
if(!pfnStartW) return FALSE;
pfnRemove= (APPFACE_REMOVE)GetProcAddress(m_hDll, "SkinRemove");
if(!pfnRemove) return FALSE;
pfnSkinWindow= (APPFACE_SKINWINDOW)GetProcAddress(m_hDll, "SkinWindowSet");
if(!pfnSkinWindow) return FALSE;
pfnThread= (APPFACE_THREAD)GetProcAddress(m_hDll, "SkinThread");
if(!pfnThread) return FALSE;
pfnBkCreate= (APPFACE_BKCREATE)GetProcAddress(m_hDll, "BkCreate");
if(!pfnBkCreate) return FALSE;
pfnBkDraw= (APPFACE_BKDRAW)GetProcAddress(m_hDll, "BkDraw");
if(!pfnBkDraw) return FALSE;
pfnBkDelete= (APPFACE_BKDELETE)GetProcAddress(m_hDll, "BkDelete");
if(!pfnBkDelete) return FALSE;
pfnSkinWindowExW= (APPFACE_SKINWINDOWEXW)GetProcAddress(m_hDll, "SkinWindowSetExW");
if(!pfnSkinWindowExW) return FALSE;
pfnSkinWindowEx= (APPFACE_SKINWINDOWEX)GetProcAddress(m_hDll, "SkinWindowSetEx");
if(!pfnSkinWindowEx) return FALSE;
m_bValid = TRUE ;
return TRUE ;
};
BOOL IsValid(){return m_bValid;};
//----------------------------
//We'll call these functions.
void SkinThread(){if(pfnThread) pfnThread() ;};
void SkinRemove() { if(pfnRemove) pfnRemove() ;};
BOOL SkinWindowSet(HWND hWnd,int nSkinType){if(pfnSkinWindow) return pfnSkinWindow(hWnd,nSkinType);return FALSE;} ;
HANDLE BkCreate(int nBkType) {
if(pfnBkCreate)
return pfnBkCreate(nBkType) ;
else
return NULL ;
};
void BkDelete(HANDLE h) {if(pfnBkDelete) pfnBkDelete(h) ;};
BOOL BkDraw(HANDLE bkHandle ,
HDC dcTarget ,
LPRECT rcTarget ,
int nReserved = 0) {
if(pfnBkDraw)
return pfnBkDraw(bkHandle,dcTarget,rcTarget,nReserved) ;
else
return FALSE ;
};
BOOL SkinStart(LPCTSTR SkinFile=NULL, //Source buffer
int nDefWinType = WINDOW_TYPE_AUTOFILTER , //The window was created by which development tool
LPCTSTR szCheckSum= NULL , //Checksum string,not used for the free version
int nLoadType = GTP_LOAD_FILE, //Loading type
DWORD hInst= NULL, //The HINSTANCE for the loaded module or the size of the memory block
LPCTSTR szResType =NULL //Resource type ,only used when Type is GTP_LOAD_RESOURCE
)
{
#ifdef _UNICODE
if(pfnStartW)
return pfnStartW((PCWSTR)SkinFile,nDefWinType,(PCWSTR)szCheckSum,nLoadType,hInst,(PCWSTR)szResType);
#else
if(pfnStart)
return pfnStart((char *)SkinFile,nDefWinType,(char *)szCheckSum,nLoadType,hInst,(char *)szResType);
#endif
return FALSE;
};
BOOL SkinWindowSetEx( HWND hWnd , //The target window handle
long nSkinType , //The skin type
long nID , //The resource ID in the skin
int nURFType = GTP_LOAD_FILE, //The type that indicate how to load this URF skin
LPCTSTR SkinFile = NULL , //Urf skin path
DWORD hInst = NULL , //The instance of the module or the size of memory block
LPCTSTR szResType = NULL ) //The resource type if nURFType is GTP_LOAD_RESOURCE
{
#ifdef _UNICODE
if(pfnSkinWindowExW)
return pfnSkinWindowExW(hWnd,nSkinType,nID,nURFType,(PCWSTR)SkinFile,hInst,(PCWSTR)szResType);
#else
if(pfnSkinWindowEx)
return pfnSkinWindowEx(hWnd,nSkinType,nID,nURFType,(char *)SkinFile,hInst,(char *)szResType);
#endif
return FALSE ;
};
//----------------------------
// To compatible with the previous verisons
void Remove() { SkinRemove() ;};
BOOL SkinWindow(HWND hWnd,int nSkinType){return SkinWindowSet(hWnd,nSkinType);} ;
BOOL Start(LPCTSTR SkinFile=NULL, //Source buffer
int nDefWinType = WINDOW_TYPE_AUTOFILTER , //The window was created by which development tool
LPCTSTR szCheckSum= NULL , //Checksum string,not used for the free version
int nLoadType = GTP_LOAD_FILE, //Loading type
DWORD hInst= NULL, //The HINSTANCE for the loaded module or the size of the memory block
LPCTSTR szResType =NULL //Resource type ,only used when Type is GTP_LOAD_RESOURCE
)
{
return SkinStart(SkinFile,nDefWinType,szCheckSum,nLoadType,hInst,szResType) ;
};
BOOL SkinWindowEx( HWND hWnd , //The target window handle
long nSkinType , //The skin type
long nID , //The resource ID in the skin
int nURFType = GTP_LOAD_FILE, //The type that indicate how to load this URF skin
LPCTSTR SkinFile = NULL , //Urf skin path
DWORD hInst = NULL , //The instance of the module or the size of memory block
LPCTSTR szResType = NULL ) //The resource type if nURFType is GTP_LOAD_RESOURCE
{
return SkinWindowSetEx(hWnd,nSkinType,nID,nURFType,SkinFile,hInst,szResType);
};
//----------------------------
private:
BOOL m_bValid ;
HMODULE m_hDll ;
APPFACE_START pfnStart ;
APPFACE_STARTW pfnStartW ;
APPFACE_REMOVE pfnRemove ;
APPFACE_SKINWINDOW pfnSkinWindow ;
APPFACE_THREAD pfnThread ;
APPFACE_BKCREATE pfnBkCreate ;
APPFACE_BKDRAW pfnBkDraw ;
APPFACE_BKDELETE pfnBkDelete ;
APPFACE_SKINWINDOWEX pfnSkinWindowEx ;
APPFACE_SKINWINDOWEXW pfnSkinWindowExW ;
protected:
void Release()
{
try{
if(m_hDll)
{
FreeLibrary(m_hDll) ;
m_hDll = NULL ;
m_bValid = false ;
pfnStart = NULL ;
pfnStartW= NULL ;
pfnRemove= NULL ;
pfnSkinWindow = NULL ;
pfnBkCreate = NULL ;
pfnBkDraw = NULL ;
pfnBkDelete = NULL ;
pfnSkinWindowEx = NULL;
pfnSkinWindowExW = NULL;
}
}catch(...){}
};
};
#endif //__cplusplus
#endif //__APPFACE_H__
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -