www.pudn.com > ExpBar_src.zip > internal.h


#ifndef _INC_INTERNAL_H_ 
#define _INC_INTERNAL_H_ 
#ifdef __cplusplus 
extern "C" { 
#endif 
 
#include  
#include  
#include  
 
#ifndef _USE_COLOR_HOTLIGHT 
#undef COLOR_HOTLIGHT 
#define COLOR_HOTLIGHT  COLOR_BTNTEXT 
#endif 
 
#define NUM_ANIMATION_LEVELS  10 
#define ANIMATION_DELAY_MS    20 
 
#define __strcpy            _tcscpy 
#define __strcat            _tcscat 
#define __strupr            _tcsupr 
#define __strlwr            _tcslwr 
#define __strlen            _tcslen 
#define __strstr            _tcsstr 
#define __strchr            _tcschr 
#define __strrchr           _tcsrchr 
#define __sprintf           _stprintf 
#define __strncmp           _tcsncmp 
#define __strcmp            _tcscmp 
#ifndef UNICODE 
#define __stricmp           _stricmp 
#else 
#define __stricmp           _wcsicmp 
#endif 
 
extern HINSTANCE          g_hInstDLL; 
extern BOOL               g_bXPTheme; 
extern HMODULE            g_hUxThemeDLL; 
extern UINT               g_uOSVersion; 
extern HIMAGELIST         g_hArrowIList; 
extern UINT               g_uIconWidth; 
extern UINT               g_uIconHeight; 
extern UINT               g_uNumIcons; 
extern BOOL               g_bEBI; 
extern EXPBARINFO         g_sEBI; 
 
#define MANIFEST_RESOURCE_ID            1 
 
#define WINDOWS_VERSION_MASK                            ((UINT)0x000000FFL) 
 
#define UNKNOWN_WINDOWS                                 ((UINT)0x00000000L) 
#define WINDOWS_WIN32s                                  ((UINT)0x00000001L) 
#define WINDOWS_95                                      ((UINT)0x00000002L) 
#define WINDOWS_95_OSR2                                 ((UINT)0x00000003L) 
#define WINDOWS_98                                      ((UINT)0x00000004L) 
#define WINDOWS_98_SE                                   ((UINT)0x00000005L) 
#define WINDOWS_ME                                      ((UINT)0x00000006L) 
#define WINDOWS_NT                                      ((UINT)0x00000007L) 
#define WINDOWS_2000                                    ((UINT)0x00000008L) 
#define WINDOWS_XP                                      ((UINT)0x00000009L) 
#define WINDOWS_DOTNET_SERVER_2003                      ((UINT)0x0000000AL) 
#define POST_WINDOWS_XP                                 ((UINT)0x0000000BL) 
 
#define WINDOWS_WORKSTATION                             ((UINT)0x00000100L) 
#define WINDOWS_NT_WORKSTATION_4                        ((UINT)0x00000200L)   
#define WINDOWS_HOME_EDITION                            ((UINT)0x00000400L) 
#define WINDOWS_PROFESSIONAL_EDITION                    ((UINT)0x00000800L) 
#define WINSERVER_SERVER4                               ((UINT)0x00001000L) 
#define WINSERVER_SERVER4_ENTERPRISE_EDITION            ((UINT)0x00002000L) 
#define WINSERVER_SERVER                                ((UINT)0x00004000L) 
#define WINSERVER_ADVANCED_SERVER                       ((UINT)0x00008000L) 
#define WINSERVER_STANDARD_EDITION                      ((UINT)0x00010000L) 
#define WINSERVER_WEB_EDITION                           ((UINT)0x00020000L) 
#define WINSERVER_ENTERPRISE_EDITION                    ((UINT)0x00040000L) 
#define WINSERVER_DATACENTER_EDITION                    ((UINT)0x00080000L) 
 
void APIPRIVATE PlaySoundThemeSound ( LPCTSTR lpcszRegAppSound ); 
 
BOOL APIENTRY InitGlobal ( void ); 
 
BOOL APIENTRY CleanUpGlobal ( void ); 
 
BOOL APIENTRY InitProcess ( HINSTANCE hinstDLL ); 
 
BOOL APIENTRY CleanUpProcess ( void ); 
 
BOOL APIENTRY GetLogFont ( HFONT hFont, PLOGFONT pLF ); 
 
LRESULT CALLBACK TaskLinkWndProc ( HWND     hwnd, 
                                   UINT     uMsg, 
                                   WPARAM   wParam, 
                                   LPARAM   lParam ); 
 
LRESULT CALLBACK CollapsibleHeaderWndProc ( HWND     hwnd, 
                                            UINT     uMsg, 
                                            WPARAM   wParam, 
                                            LPARAM   lParam ); 
 
LRESULT CALLBACK CBStaticWndProc ( HWND     hwnd, 
                                   UINT     uMsg, 
                                   WPARAM   wParam, 
                                   LPARAM   lParam ); 
 
LRESULT CALLBACK CBButtonWndProc ( HWND     hwnd, 
                                   UINT     uMsg, 
                                   WPARAM   wParam, 
                                   LPARAM   lParam ); 
 
LRESULT CALLBACK ColXPBarWndProc ( HWND     hwnd, 
                                   UINT     uMsg, 
                                   WPARAM   wParam, 
                                   LPARAM   lParam ); 
 
HIMAGELIST APIPRIVATE CreateArrowImageList ( HINSTANCE     hInstance, 
                                             UINT          uResourceId, 
                                             UINT          uIconWidth, 
                                             PUINT         puNumIcons, 
                                             PUINT         puIconHeight ); 
 
int APIPRIVATE Pt2FontHeight ( int iPt ); 
 
void APIENTRY CBStatic32PaintDC ( HWND hwnd, HDC hDC, POINT ptOffset, BOOL bPaintBackground, int iCtrlWidth ); 
void APIENTRY CBButtonPaintDC ( HWND hwnd, HDC hDC, POINT ptOffset, BOOL bPaintBackground, int iCtrlWidth ); 
void APIENTRY TaskLinkPaintDC ( HWND hwnd, HDC hDC, POINT ptOffset, BOOL bPaintBackground, int iCtrlWidth ); 
void APIENTRY ColHeaderPaintDC ( HWND hwnd, HDC hDC, POINT ptOffset, BOOL bPaintBackground, int iCtrlWidth ); 
 
#define PANEBORDER_LEFT       10 
#define PANEBORDER_RIGHT      10 
#define PANEBORDER_TOP        8 
#define PANEBORDER_BOTTOM     8 
 
typedef struct tagCBSTRUCT        CBSTRUCT, *PCBSTRUCT; 
typedef struct tagCBPANE          CBPANE, *PCBPANE; 
typedef struct tagPANECTRL        PANECTRL, *PPANECTRL; 
typedef struct tagBUFFERMSG       BUFFERMSG, *PBUFFERMSG; 
 
#define CBM_CHCOMMAND         (WM_USER+0x1001) 
#define CBM_DESTROYED         (WM_USER+0x1002) 
 
struct tagBUFFERMSG 
{ 
  PBUFFERMSG        pNext; 
  UINT              uMsgId; 
 
  HWND              hwnd; 
  UINT              uMsg; 
  WPARAM            wParam; 
  LPARAM            lParam; 
 
  BYTE              byData[4]; 
}; 
 
struct tagCBSTRUCT 
{ 
  int                       cbSize; 
 
  CRITICAL_SECTION          cs; 
 
  HWND                      hwndBar; 
 
  HANDLE                    hThread; 
  DWORD                     dwPWThreadId; 
  HANDLE                    hDoDestroy; 
 
  PBUFFERMSG                pHead; 
  PBUFFERMSG                pTail; 
  UINT                      uMsgId; 
 
  BOOL                      bCreateFont; 
  HFONT                     hFontNormal; 
  HFONT                     hFontSpecial; 
 
  int                       iBufferMsgCnt; 
  BOOL                      bPeekMessageActive;   // peek message loop currently active 
 
  BOOL                      bScrollVisible; 
  BOOL                      bScrolling; 
  int                       iAllPanesHeight;      // height of all panes (used to create background bitmap) 
 
  // managed by OnResize 
  RECT                      rcClient;             // size of client area dependent on bScrollVisible 
  int                       iWindowWidth; 
  int                       iWindowHeight; 
 
  int                       iWndWidthMin;         // minimum width (scrollbar visible) 
  int                       iWndWidthMax;         // maximum width (scrollbar invisible) 
  int                       iBorderLeft;          // left border window to panes       
  int                       iBorderRight;         // right border window to panes 
  int                       iBorderTB;            // top/bottom and inter-border window to panes 
  int                       iBorderTop; 
  int                       iBorderBottom; 
  int                       iPaneWidthMin;        // width of panes if scrollbar visible 
  int                       iPaneWidthMax;        // width of panes if scrollbar INvisible 
 
 
 
 
  int                       iBkBmpWidth; 
  int                       iBkBmpHeight; 
  HBITMAP                   hBkBitmap;            // background bitmap 
 
  PCBPANE                   pFirstPane; 
  BOOL                      bDisplayPanes;        // FALSE if width,height <=0 
 
}; 
 
struct tagPANECTRL 
{ 
  PPANECTRL           pParent; 
  PPANECTRL           pChildren; 
  PPANECTRL           pPrev; 
  PPANECTRL           pNext; 
 
  HWND                hwndCtrl; 
  int                 iCtrlId; 
  BOOL                bPDCControl;        // has control "paint DC capability" ? 
  BOOL                bIsHeader;          // is collapsible header ? 
  BOOL                bIsTasklink;        // is task hyperlink ? 
  BOOL                bIsComboBox;        // is combobox ? 
  BOOL                bIsComboBoxEx; 
  BOOL                bIsPushButton; 
  BOOL                bNeedsUpDown;       // up/down arrow processed, don't use it to navigate controls 
  BOOL                bExpanded;          // only meaningful if control is CollapsibleHeader32 
 
  int                 iRow; 
  int                 iCol; 
   
  int                 x; 
  int                 y; 
  int                 cx; 
  int                 cy; 
  int                 maxcy; 
  BOOL                bSameRow; 
  int                 dx; 
  int                 dy; 
 
  RECT                rcMin; 
  RECT                rcMax; 
  RECT                rcMinCurrent; 
  RECT                rcMaxCurrent; 
}; 
 
struct tagCBPANE 
{ 
  int                       cbSize; 
   
  PCBPANE                   pNext; 
  PCBPANE                   pPrev; 
 
  int                       x;                  // current x position of complete pane 
  int                       y;                  // current y position of complete pane 
 
  BOOL                      bReentrant; 
 
  HBITMAP                   hBmpDlg; 
  HWND                      hwndDlg; 
  HWND                      hwndHeader; 
 
  RECT                      rcPaneMin; 
  RECT                      rcPaneMax; 
 
  RECT                      rcDlgMin; 
  RECT                      rcDlgMax; 
 
  BOOL                      bExpanded; 
  BOOL                      bAllPDC;            // all controls have paintDC capability 
 
  PPANECTRL                 pPC; 
  HWND                      hwndDefPushButton;  // THE default push button 
  HWND                      hwndCurPushButton;  // current default push button (focus rect) 
  int                       iNumCtrls; 
 
  int                       iCurHeightMin;      // current height (min width, expanded/collapsed) 
  int                       iCurHeightMax;      // current height (max width, expanded/collapsed) 
 
  RECT                      rcHeaderMin;        // rectangle header ctrl (min size, .bottom=COLLAPSED) 
  RECT                      rcHeaderMax;        // rectangle header ctrl (max size, .bottom=COLLAPSED) 
 
  RECT                      rcPaneMinCurrent;   // rectangle pane (min size, .bottom=EXPANDED) 
  RECT                      rcPaneMaxCurrent;   // rectangle pane (max size, .bottom=EXPANDED) 
 
  RECT                      rcDlgMinCurrent; 
  RECT                      rcDlgMaxCurrent; 
 
  PANEDEF                   PD; 
}; 
 
typedef struct tagDLGDATA       DLGDATA, *PDLGDATA; 
typedef struct tagCTLDATA       CTLDATA, *PCTLDATA; 
 
struct tagDLGDATA 
{ 
  int             iHelpId;          // -1 if not defined 
  DWORD           dwStyle; 
  DWORD           dwExStyle; 
 
  int             iDlgItems;        // number of controls 
 
  TCHAR           szWndTitle[256]; 
 
  int             iPtSize;          // -1 if not defined 
  TCHAR           szTypeFace[256];   
 
  PCTLDATA        pCtrls; 
 
  int             iRows; 
  int             iCols; 
}; 
 
struct tagCTLDATA 
{ 
  int             iHelpId;          // -1 if not defined 
  DWORD           dwStyle; 
  DWORD           dwExStyle; 
  HWND            hwndCtl; 
  int             col; 
  int             row; 
  int             x; 
  int             y; 
  int             cx; 
  int             cy; 
  UINT            uId; 
  union 
  { 
    WORD          wWndClass[2]; 
    TCHAR         szWndClass[256]; 
  }; 
  union 
  { 
    WORD          wTitle[2]; 
    TCHAR         szTitle[256]; 
  }; 
  PVOID           pvExtraData;      // NULL or lParam on WM_CREATE 
}; 
 
#define ITEMSTATE_DISABLED          ((int)-1) 
#define ITEMSTATE_COLD              ((int)0) 
#define ITEMSTATE_PRESSED           ((int)1) 
#define ITEMSTATE_HOT               ((int)2) 
 
typedef struct tagTLSTRUCT          TLSTRUCT, *PTLSTRUCT; 
 
struct tagTLSTRUCT 
{ 
  int                       cbSize; 
 
  int                       iOrigWidth; 
  int                       iOrigHeight; 
 
  BOOL                      bMultiLine; 
 
  RECT                      rcText; 
  RECT                      rcIcon; 
 
//  SIZE                      siText; 
 
  int                       iState; 
 
  BOOL                      bKeyDown; 
 
  BOOL                      bTrackMouse; 
  BOOL                      bLButtonDown; 
  int                       iMouseX; 
  int                       iMouseY; 
 
  HWND                      hwndToolTip; 
  BOOL                      bEnabled; 
  BOOL                      bActive; 
  BOOL                      bFocus; 
  BOOL                      bColorSet; 
 
  int                       iHSpace; 
 
  HCURSOR                   hCursor; 
 
  HIMAGELIST                hIListNormal; 
  HIMAGELIST                hIListHot; 
  HIMAGELIST                hIListDisabled; 
  int                       iIndex; 
 
  HBRUSH                    hBackground; 
  COLORREF                  crNormal; 
  COLORREF                  crHot; 
  COLORREF                  crPressed; 
  COLORREF                  crDisabled; 
 
  HFONT                     hFontNormal; 
  HFONT                     hFontHot; 
}; 
 
#define TL_HAVE_TOOLTIP           (GetWindowLong(hwnd,GWL_STYLE) & TLS_TOOLTIP) 
#define TL_HAVE_TOOLTIP_SAFE(_p)  ((GetWindowLong(hwnd,GWL_STYLE) & TLS_TOOLTIP) && (IsWindow((_p)->hwndToolTip))) 
#define TL_HAVE_FOCUSRECT         (GetWindowLong(hwnd,GWL_STYLE) & TLS_FOCUSRECT) 
#define TL_HAVE_PLAYSOUND         (GetWindowLong(hwnd,GWL_STYLE) & TLS_PLAYSOUND) 
#define TL_HAVE_NSFOC             (GetWindowLong(hwnd,GWL_STYLE) & TLS_NOSETFOCUSONCLICK) 
#define TL_HAVE_NOAUTOSIZE        (GetWindowLong(hwnd,GWL_STYLE) & TLS_NOAUTOSIZE) 
#define TL_HAVE_DONTRELAYLBDNUP   (GetWindowLong(hwnd,GWL_STYLE) & TLS_DONTRELAYLBDNUP) 
#define TL_HAVE_BOLD              (GetWindowLong(hwnd,GWL_STYLE) & TLS_BOLD) 
#define TL_HAVE_NORMUNDERLINE     (GetWindowLong(hwnd,GWL_STYLE) & TLS_NORMUNDERLINE) 
#define TL_HAVE_HOTUNDERLINE      (GetWindowLong(hwnd,GWL_STYLE) & TLS_HOTUNDERLINE) 
 
typedef struct tagCHSTRUCT          CHSTRUCT, *PCHSTRUCT; 
 
struct tagCHSTRUCT 
{ 
  int                       cbSize; 
 
  int                       iLeftMargin; 
 
  int                       iOrigWidth; 
  int                       iOrigHeight; 
 
  int                       iState; 
  BOOL                      bExpanded; 
  BOOL                      bKeyDown; 
 
  BOOL                      bMultiLine; 
  BOOL                      bColorSet; 
 
  BOOL                      bTrackMouse; 
  BOOL                      bLButtonDown; 
  int                       iMouseX; 
  int                       iMouseY; 
 
  HWND                      hwndToolTip; 
  BOOL                      bEnabled; 
  BOOL                      bActive; 
  BOOL                      bFocus; 
 
//  HCURSOR                   hCursor; 
 
  HFONT                     hFontNormal; 
  HFONT                     hFontHot; 
 
  HPEN                      hLightPen; 
  HPEN                      hShadowPen; 
 
  CHFORMAT                  chf; 
 
  RECT                      rcIcon; 
  RECT                      rcText; 
  RECT                      rcButton; 
  RECT                      rcBackground; 
}; 
 
#define CH_HAVE_TOOLTIP           (GetWindowLong(hwnd,GWL_STYLE) & CHS_TOOLTIP) 
#define CH_HAVE_TOOLTIP_SAFE(_p)  ((GetWindowLong(hwnd,GWL_STYLE) & CHS_TOOLTIP) && (IsWindow((_p)->hwndToolTip))) 
#define CH_HAVE_FOCUSRECT         (GetWindowLong(hwnd,GWL_STYLE) & CHS_FOCUSRECT) 
#define CH_HAVE_NSFOC             (GetWindowLong(hwnd,GWL_STYLE) & CHS_NOSETFOCUSONCLICK) 
#define CH_HAVE_NOAUTOSIZE        (GetWindowLong(hwnd,GWL_STYLE) & CHS_NOAUTOSIZE) 
#define CH_HAVE_DONTRELAYLBDNUP   (GetWindowLong(hwnd,GWL_STYLE) & CHS_DONTRELAYLBDNUP) 
#define CH_HAVE_PLAYSOUND         (GetWindowLong(hwnd,GWL_STYLE) & CHS_PLAYSOUND) 
 
typedef struct tagCBSTATIC        CBSTATIC, *PCBSTATIC; 
 
struct tagCBSTATIC 
{ 
  int                       cbSize; 
 
  int                       iOrigWidth; 
  int                       iOrigHeight; 
 
  BOOL                      bEnabled; 
  HFONT                     hFont; 
  PVOID                     pvItemData; 
  SIZE                      siText; 
}; 
 
typedef struct tagCBBUTTON        CBBUTTON, *PCBBUTTON; 
 
typedef HANDLE HTHEME; 
 
struct tagCBBUTTON 
{ 
  int                       cbSize; 
 
  int                       iOrigWidth; 
  int                       iOrigHeight; 
 
  HTHEME                    hTheme; 
 
  UINT                      uButtonState; 
 
  int                       iState; 
  BOOL                      bKeyDown; 
 
  BOOL                      bMultiLine; 
 
  BOOL                      bTrackMouse; 
  BOOL                      bLButtonDown; 
  BOOL                      bLButtonDblClk; 
  int                       iMouseX; 
  int                       iMouseY; 
 
  BOOL                      bEnabled; 
  BOOL                      bFocus; 
 
  HCURSOR                   hCursor; 
 
  HFONT                     hFontNormal; 
  HFONT                     hFontHot; 
  HFONT                     hFontCheckedNormal; 
  HFONT                     hFontCheckedHot; 
  UINT                      uDescent; 
 
  RECT                      rcButton; 
  RECT                      rcText; 
}; 
 
 
 
 
 
 
 
#define XCHGCOLORREF(_x)              ((((_x)&0xFF00FF00L)|(((_x)&0x00FF0000L)>>16)|(((_x)&0x000000FFL)<<16))) 
 
void APIENTRY ShowHidePaneControls ( PCBSTRUCT pCBS, PCBPANE pCBP, BOOL bScrollVisible ); 
HBITMAP APIENTRY CreateRenderBitmap ( int iWidth, int iHeight ); 
HBITMAP APIENTRY CreateBkBitmap ( int iWidth, int iHeight ); 
void APIENTRY FillBackground ( HDC hDC, PCBSTRUCT pCBS, PCBPANE pCBP, int iWidth, int iHeight, LPRECT pRC ); 
void APIENTRY CreateBarBackground ( BOOL bForced, HWND hwnd, PCBSTRUCT pCBS, int iAllPanesHeight, BOOL bRepaint ); 
 
HBITMAP APIENTRY CreateHeaderBitmap ( PCBSTRUCT pCBS, PCBPANE pCBP, LPVOID *ppvBits, int *piWidth, int *piHeight ); 
HBITMAP APIENTRY CreatePaneBitmap ( PCBSTRUCT pCBS, PCBPANE pCBP, LPVOID *ppvBits, int *piWidth, int *piHeight ); 
 
void APIENTRY PaintDCPCRecursive ( PCBSTRUCT pCBS, HDC hDC, PPANECTRL pPC, BOOL bScrollVisible, BOOL bVisible ); 
void APIENTRY PaintDCPaneControls ( HDC hDC, PCBSTRUCT pCBS, PCBPANE pCBP, BOOL bMinSize ); 
BOOL APIENTRY CreateFadeBitmaps ( PCBSTRUCT  pCBS, 
                                  PCBPANE    pCBP,  
                                  int        iBkBitmapYOfs, 
                                  int        iNumLevels, 
                                  HBITMAP   *phBitmaps, 
                                  int       *piHeights ); 
 
void APIENTRY PeekAndProcessPaintMessages ( PCBSTRUCT pCBS ); 
void APIENTRY PeekAndEatPaintMessages ( PCBSTRUCT pCBS ); 
 
 
 
 
//////////////////////////////////////////////////////////////////////////////////////////////////////// 
 
//#if ( _WIN32_WINNT == 0x501 ) 
 
#include  
 
typedef struct _MARGINS 
{ 
    int cxLeftWidth;      // width of left border that retains its size 
    int cxRightWidth;     // width of right border that retains its size 
    int cyTopHeight;      // height of top border that retains its size 
    int cyBottomHeight;   // height of bottom border that retains its size 
} MARGINS, *PMARGINS; 
 
#define MAX_INTLIST_COUNT 10 
 
typedef struct _INTLIST 
{ 
    int iValueCount;      // number of values in iValues 
    int iValues[MAX_INTLIST_COUNT]; 
} INTLIST, *PINTLIST; 
 
typedef enum THEMESIZE 
{ 
    TS_MIN,             // minimum size 
    TS_TRUE,            // size without stretching 
    TS_DRAW,            // size that theme mgr will use to draw part 
}; 
 
#include  
 
  typedef HTHEME(__stdcall *PFNOPENTHEMEDATA)(HWND hwnd, LPCWSTR pszClassList); 
  typedef HRESULT(__stdcall *PFNCLOSETHEMEDATA)(HTHEME hTheme); 
  typedef HRESULT(__stdcall *PFNDRAWTHEMEBACKGROUND)(HTHEME hTheme, HDC hdc,  
		int iPartId, int iStateId, const RECT *pRect,  const RECT *pClipRect); 
  typedef HRESULT (__stdcall *PFNDRAWTHEMETEXT)(HTHEME hTheme, HDC hdc, int iPartId,  
		int iStateId, LPCWSTR pszText, int iCharCount, DWORD dwTextFlags,  
		DWORD dwTextFlags2, const RECT *pRect); 
	typedef HRESULT (__stdcall *PFNGETTHEMEBACKGROUNDCONTENTRECT)(HTHEME hTheme,  HDC hdc,  
		int iPartId, int iStateId,  const RECT *pBoundingRect,  
		RECT *pContentRect); 
	typedef HRESULT (__stdcall *PFNGETTHEMEBACKGROUNDEXTENT)(HTHEME hTheme,  HDC hdc, 
		int iPartId, int iStateId, const RECT *pContentRect,  
		RECT *pExtentRect); 
	typedef HRESULT(__stdcall *PFNGETTHEMEPARTSIZE)(HTHEME hTheme, HDC hdc,  
		int iPartId, int iStateId, RECT * pRect, enum THEMESIZE eSize,  SIZE *psz); 
	typedef HRESULT (__stdcall *PFNGETTHEMETEXTEXTENT)(HTHEME hTheme, HDC hdc,  
		int iPartId, int iStateId, LPCWSTR pszText, int iCharCount,  
		DWORD dwTextFlags,  const RECT *pBoundingRect,  
		RECT *pExtentRect); 
	typedef HRESULT (__stdcall *PFNGETTHEMETEXTMETRICS)(HTHEME hTheme,  HDC hdc,  
		int iPartId, int iStateId,  TEXTMETRIC* ptm); 
	typedef HRESULT (__stdcall *PFNGETTHEMEBACKGROUNDREGION)(HTHEME hTheme,  HDC hdc,   
		int iPartId, int iStateId, const RECT *pRect,  HRGN *pRegion); 
	typedef HRESULT (__stdcall *PFNHITTESTTHEMEBACKGROUND)(HTHEME hTheme,  HDC hdc, int iPartId,  
		int iStateId, DWORD dwOptions, const RECT *pRect,  HRGN hrgn,  
		POINT ptTest,  WORD *pwHitTestCode); 
	typedef HRESULT (__stdcall *PFNDRAWTHEMEEDGE)(HTHEME hTheme, HDC hdc, int iPartId, int iStateId,  
		const RECT *pDestRect, UINT uEdge, UINT uFlags,   RECT *pContentRect); 
	typedef HRESULT (__stdcall *PFNDRAWTHEMEICON)(HTHEME hTheme, HDC hdc, int iPartId,  
		int iStateId, const RECT *pRect, HIMAGELIST himl, int iImageIndex); 
	typedef BOOL (__stdcall *PFNISTHEMEPARTDEFINED)(HTHEME hTheme, int iPartId,  
		int iStateId); 
	typedef BOOL (__stdcall *PFNISTHEMEBACKGROUNDPARTIALLYTRANSPARENT)(HTHEME hTheme,  
		int iPartId, int iStateId); 
	typedef HRESULT (__stdcall *PFNGETTHEMECOLOR)(HTHEME hTheme, int iPartId,  
		int iStateId, int iPropId,  COLORREF *pColor); 
	typedef HRESULT (__stdcall *PFNGETTHEMEMETRIC)(HTHEME hTheme,  HDC hdc, int iPartId,  
		int iStateId, int iPropId,  int *piVal); 
	typedef HRESULT (__stdcall *PFNGETTHEMESTRING)(HTHEME hTheme, int iPartId,  
		int iStateId, int iPropId,  LPWSTR pszBuff, int cchMaxBuffChars); 
	typedef HRESULT (__stdcall *PFNGETTHEMEBOOL)(HTHEME hTheme, int iPartId,  
		int iStateId, int iPropId,  BOOL *pfVal); 
	typedef HRESULT (__stdcall *PFNGETTHEMEINT)(HTHEME hTheme, int iPartId,  
		int iStateId, int iPropId,  int *piVal); 
	typedef HRESULT (__stdcall *PFNGETTHEMEENUMVALUE)(HTHEME hTheme, int iPartId,  
		int iStateId, int iPropId,  int *piVal); 
	typedef HRESULT (__stdcall *PFNGETTHEMEPOSITION)(HTHEME hTheme, int iPartId,  
		int iStateId, int iPropId,  POINT *pPoint); 
	typedef HRESULT (__stdcall *PFNGETTHEMEFONT)(HTHEME hTheme,  HDC hdc, int iPartId,  
		int iStateId, int iPropId,  LOGFONT *pFont); 
	typedef HRESULT (__stdcall *PFNGETTHEMERECT)(HTHEME hTheme, int iPartId,  
		int iStateId, int iPropId,  RECT *pRect); 
	typedef HRESULT (__stdcall *PFNGETTHEMEMARGINS)(HTHEME hTheme,  HDC hdc, int iPartId,  
		int iStateId, int iPropId,  RECT *prc,  MARGINS *pMargins); 
	typedef HRESULT (__stdcall *PFNGETTHEMEINTLIST)(HTHEME hTheme, int iPartId,  
		int iStateId, int iPropId,  INTLIST *pIntList); 
	typedef HRESULT (__stdcall *PFNGETTHEMEPROPERTYORIGIN)(HTHEME hTheme, int iPartId,  
		int iStateId, int iPropId,  enum PROPERTYORIGIN *pOrigin); 
	typedef HRESULT (__stdcall *PFNSETWINDOWTHEME)(HWND hwnd, LPCWSTR pszSubAppName,  
		LPCWSTR pszSubIdList); 
	typedef HRESULT (__stdcall *PFNGETTHEMEFILENAME)(HTHEME hTheme, int iPartId,  
		int iStateId, int iPropId,  LPWSTR pszThemeFileName, int cchMaxBuffChars); 
	typedef COLORREF (__stdcall *PFNGETTHEMESYSCOLOR)(HTHEME hTheme, int iColorId); 
	typedef HBRUSH (__stdcall *PFNGETTHEMESYSCOLORBRUSH)(HTHEME hTheme, int iColorId); 
	typedef BOOL (__stdcall *PFNGETTHEMESYSBOOL)(HTHEME hTheme, int iBoolId); 
	typedef int (__stdcall *PFNGETTHEMESYSSIZE)(HTHEME hTheme, int iSizeId); 
	typedef HRESULT (__stdcall *PFNGETTHEMESYSFONT)(HTHEME hTheme, int iFontId,  LOGFONT *plf); 
	typedef HRESULT (__stdcall *PFNGETTHEMESYSSTRING)(HTHEME hTheme, int iStringId,  
		LPWSTR pszStringBuff, int cchMaxStringChars); 
	typedef HRESULT (__stdcall *PFNGETTHEMESYSINT)(HTHEME hTheme, int iIntId, int *piValue); 
	typedef BOOL (__stdcall *PFNISTHEMEACTIVE)(); 
	typedef BOOL(__stdcall *PFNISAPPTHEMED)(); 
	typedef HTHEME (__stdcall *PFNGETWINDOWTHEME)(HWND hwnd); 
	typedef HRESULT (__stdcall *PFNENABLETHEMEDIALOGTEXTURE)(HWND hwnd, DWORD dwFlags); 
	typedef BOOL (__stdcall *PFNISTHEMEDIALOGTEXTUREENABLED)(HWND hwnd); 
	typedef DWORD (__stdcall *PFNGETTHEMEAPPPROPERTIES)(); 
	typedef void (__stdcall *PFNSETTHEMEAPPPROPERTIES)(DWORD dwFlags); 
	typedef HRESULT (__stdcall *PFNGETCURRENTTHEMENAME)( 
		LPWSTR pszThemeFileName, int cchMaxNameChars,  
		LPWSTR pszColorBuff, int cchMaxColorChars, 
		LPWSTR pszSizeBuff, int cchMaxSizeChars); 
	typedef HRESULT (__stdcall *PFNGETTHEMEDOCUMENTATIONPROPERTY)(LPCWSTR pszThemeName, 
		LPCWSTR pszPropertyName,  LPWSTR pszValueBuff, int cchMaxValChars); 
	typedef HRESULT (__stdcall *PFNDRAWTHEMEPARENTBACKGROUND)(HWND hwnd, HDC hdc,  RECT* prc); 
	typedef HRESULT (__stdcall *PFNENABLETHEMING)(BOOL fEnable); 
 
  HTHEME __stdcall OpenThemeData(HWND hwnd, LPCWSTR pszClassList); 
	HRESULT __stdcall CloseThemeData(HTHEME hTheme); 
	HRESULT __stdcall DrawThemeBackground(HTHEME hTheme, HDC hdc,  
		int iPartId, int iStateId, const RECT *pRect, const RECT *pClipRect); 
	HRESULT __stdcall DrawThemeText(HTHEME hTheme, HDC hdc, int iPartId,  
		int iStateId, LPCWSTR pszText, int iCharCount, DWORD dwTextFlags,  
		DWORD dwTextFlags2, const RECT *pRect); 
	HRESULT __stdcall GetThemeBackgroundContentRect(HTHEME hTheme,  HDC hdc,  
		int iPartId, int iStateId,  const RECT *pBoundingRect,  
		RECT *pContentRect); 
	HRESULT __stdcall GetThemeBackgroundExtent(HTHEME hTheme,  HDC hdc, 
		int iPartId, int iStateId, const RECT *pContentRect,  
		RECT *pExtentRect); 
	HRESULT __stdcall GetThemePartSize(HTHEME hTheme, HDC hdc,  
		int iPartId, int iStateId, RECT * pRect, enum THEMESIZE eSize, SIZE *psz); 
	HRESULT __stdcall GetThemeTextExtent(HTHEME hTheme, HDC hdc,  
		int iPartId, int iStateId, LPCWSTR pszText, int iCharCount,  
		DWORD dwTextFlags,  const RECT *pBoundingRect,  
		RECT *pExtentRect); 
	HRESULT __stdcall GetThemeTextMetrics(HTHEME hTheme,  HDC hdc,  
		int iPartId, int iStateId,  TEXTMETRIC* ptm); 
	HRESULT __stdcall GetThemeBackgroundRegion(HTHEME hTheme,  HDC hdc,   
		int iPartId, int iStateId, const RECT *pRect,  HRGN *pRegion); 
	HRESULT __stdcall HitTestThemeBackground(HTHEME hTheme,  HDC hdc, int iPartId,  
		int iStateId, DWORD dwOptions, const RECT *pRect,  HRGN hrgn,  
		POINT ptTest,  WORD *pwHitTestCode); 
	HRESULT __stdcall DrawThemeEdge(HTHEME hTheme, HDC hdc, int iPartId, int iStateId,  
		const RECT *pDestRect, UINT uEdge, UINT uFlags,   RECT *pContentRect); 
	HRESULT __stdcall DrawThemeIcon(HTHEME hTheme, HDC hdc, int iPartId,  
		int iStateId, const RECT *pRect, HIMAGELIST himl, int iImageIndex); 
	BOOL __stdcall IsThemePartDefined(HTHEME hTheme, int iPartId,  
		int iStateId); 
	BOOL __stdcall IsThemeBackgroundPartiallyTransparent(HTHEME hTheme,  
		int iPartId, int iStateId); 
	HRESULT __stdcall GetThemeColor(HTHEME hTheme, int iPartId,  
		int iStateId, int iPropId,  COLORREF *pColor); 
	HRESULT __stdcall GetThemeMetric(HTHEME hTheme,  HDC hdc, int iPartId,  
		int iStateId, int iPropId,  int *piVal); 
	HRESULT __stdcall GetThemeString(HTHEME hTheme, int iPartId,  
		int iStateId, int iPropId,  LPWSTR pszBuff, int cchMaxBuffChars); 
	HRESULT __stdcall GetThemeBool(HTHEME hTheme, int iPartId,  
		int iStateId, int iPropId,  BOOL *pfVal); 
	HRESULT __stdcall GetThemeInt(HTHEME hTheme, int iPartId,  
		int iStateId, int iPropId,  int *piVal); 
	HRESULT __stdcall GetThemeEnumValue(HTHEME hTheme, int iPartId,  
		int iStateId, int iPropId,  int *piVal); 
	HRESULT __stdcall GetThemePosition(HTHEME hTheme, int iPartId,  
		int iStateId, int iPropId,  POINT *pPoint); 
	HRESULT __stdcall GetThemeFont(HTHEME hTheme,  HDC hdc, int iPartId,  
		int iStateId, int iPropId,  LOGFONT *pFont); 
	HRESULT __stdcall GetThemeRect(HTHEME hTheme, int iPartId,  
		int iStateId, int iPropId,  RECT *pRect); 
	HRESULT __stdcall GetThemeMargins(HTHEME hTheme,  HDC hdc, int iPartId,  
		int iStateId, int iPropId,  RECT *prc,  MARGINS *pMargins); 
	HRESULT __stdcall GetThemeIntList(HTHEME hTheme, int iPartId,  
		int iStateId, int iPropId,  INTLIST *pIntList); 
	HRESULT __stdcall GetThemePropertyOrigin(HTHEME hTheme, int iPartId,  
		int iStateId, int iPropId,  enum PROPERTYORIGIN *pOrigin); 
	HRESULT __stdcall SetWindowTheme(HWND hwnd, LPCWSTR pszSubAppName,  
		LPCWSTR pszSubIdList); 
	HRESULT __stdcall GetThemeFilename(HTHEME hTheme, int iPartId,  
		int iStateId, int iPropId,  LPWSTR pszThemeFileName, int cchMaxBuffChars); 
	COLORREF __stdcall GetThemeSysColor(HTHEME hTheme, int iColorId); 
	HBRUSH __stdcall GetThemeSysColorBrush(HTHEME hTheme, int iColorId); 
	BOOL __stdcall GetThemeSysBool(HTHEME hTheme, int iBoolId); 
	int __stdcall GetThemeSysSize(HTHEME hTheme, int iSizeId); 
	HRESULT __stdcall GetThemeSysFont(HTHEME hTheme, int iFontId,  LOGFONT *plf); 
	HRESULT __stdcall GetThemeSysString(HTHEME hTheme, int iStringId,  
		LPWSTR pszStringBuff, int cchMaxStringChars); 
	HRESULT __stdcall GetThemeSysInt(HTHEME hTheme, int iIntId, int *piValue); 
	BOOL __stdcall IsThemeActive(); 
	BOOL __stdcall IsAppThemed();	 
	HTHEME __stdcall GetWindowTheme(HWND hwnd); 
	HRESULT __stdcall EnableThemeDialogTexture(HWND hwnd, DWORD dwFlags); 
	BOOL __stdcall IsThemeDialogTextureEnabled(HWND hwnd); 
	DWORD __stdcall GetThemeAppProperties(); 
	void __stdcall SetThemeAppProperties(DWORD dwFlags); 
	HRESULT __stdcall GetCurrentThemeName( 
		LPWSTR pszThemeFileName, int cchMaxNameChars,  
		LPWSTR pszColorBuff, int cchMaxColorChars, 
		LPWSTR pszSizeBuff, int cchMaxSizeChars); 
	HRESULT __stdcall GetThemeDocumentationProperty(LPCWSTR pszThemeName, 
		LPCWSTR pszPropertyName,  LPWSTR pszValueBuff, int cchMaxValChars); 
	HRESULT __stdcall DrawThemeParentBackground(HWND hwnd, HDC hdc,  RECT* prc); 
	HRESULT __stdcall EnableTheming(BOOL fEnable); 
//#endif 
 
#define TOK_UNKNOWN         0x00000000L 
#define TOK_STRING          0x00000001L 
#define TOK_LT              0x00000002L 
#define TOK_GT              0x00000003L 
#define TOK_EQ              0x00000004L 
#define TOK_LP              0x00000005L 
#define TOK_RP              0x00000006L 
#define TOK_LB              0x00000007L 
#define TOK_RB              0x00000008L 
#define TOK_LC              0x00000009L 
#define TOK_RC              0x0000000AL 
#define TOK_COLON           0x0000000BL 
#define TOK_SEMICOLON       0x0000000CL 
#define TOK_COMMA           0x0000000DL 
#define TOK_OR              0x0000000EL 
#define TOK_MINUS           0x0000000FL 
#define TOK_PLUS            0x00000010L 
#define TOK_HTMLCOLOR       0x00000011L 
#define TOK_INTEGER         0x00000012L 
#define TOK_SLASH           0x00000013L 
 
typedef struct tagTOKEN           TOKEN, *PTOKEN; 
 
struct tagTOKEN 
{ 
  PTOKEN                    pPrev; 
  PTOKEN                    pNext; 
  UINT                      uToken; 
  UINT                      uDataSize; 
  BYTE                      byData[4]; 
}; 
 
#define ELEMSPEC_STRING               0 
#define ELEMSPEC_ATOM                 1 
 
typedef struct tagELEMSPECIFIER       ELEMSPEC, *PELEMSPEC; 
 
struct tagELEMSPECIFIER 
{ 
  UINT        uType; 
  char        szString[256]; 
}; 
 
typedef struct tagTOKENDATA           TOKDATA, *PTOKDATA; 
 
#define TD_ERROR                      0xFFFFFFFFL 
#define TD_UNKNOWN                    0x00000000L 
#define TD_INTEGER                    0x00000001L 
#define TD_INTEGER_PT                 0x00000002L 
#define TD_INTEGER_RP                 0x00000003L 
#define TD_RGB                        0x00000004L 
#define TD_ARGB                       0x00000005L 
#define TD_ALIGNMENT                  0x00000006L 
#define TD_CURSOR                     0x00000007L 
#define TD_FONTSTYLE                  0x00000008L 
#define TD_STRING                     0x00000009L 
#define TD_GRADIENT                   0x0000000AL 
#define TD_RECT                       0x0000000BL 
#define TD_BITMAP                     0x0000000CL 
#define TD_SYSMETRIC                  0x0000000DL 
#define TD_SYSMETRICSTR               0x0000000EL 
 
struct tagTOKENDATA 
{ 
  UINT        uType; 
  union 
  { 
    int               iValue; 
    COLORREF          crRGB; 
    COLORREF          crARGB;         // alpha: 0 = opaque, 255 = transparent (is that right?) 
    UINT              uAlign; 
    LPCTSTR           lpCursorName; 
    UINT              uFontStyle; 
    TCHAR             szString[MAX_PATH]; 
    struct 
    { 
      COLORREF        crARGB1; 
      COLORREF        crARGB2; 
      int             iValue; 
    } gradient; 
    struct 
    { 
      UINT            uIntTypes[4]; 
      RECT            rcRect; 
    } rect; 
    struct 
    { 
      HBITMAP         hBitmap;        // DIB section 
      int             biCompression; 
      BOOL            bColorIdx; 
      union 
      { 
        COLORREF      crTransRGB; 
        int           iTransIdx; 
      }; 
    } bitmap; 
  }; 
}; 
 
#ifdef __cplusplus 
} 
#endif 
#endif