ifndef _INC_COMMCTRL
define _INC_COMMCTRL

ifndef _WIN32_IE
define _WIN32_IE 0x0400
elseif (_WIN32_IE LT 0x0400) AND defined(_WIN32_WINNT) AND (_WIN32_WINNT GE 0x0500)
.err <_WIN32_IE setting conflicts with _WIN32_WINNT setting>
endif

ifndef _HRESULT_DEFINED
define _HRESULT_DEFINED
HRESULT typedef sdword
endif
ifndef HKEY
HKEY	typedef HANDLE
endif

ifndef NOUSER

.pragma comment(lib, comctl32)

include prsht.inc

ifndef SNDMSG
define SNDMSG <SendMessage>
endif

InitCommonControls proto WINAPI

if (_WIN32_IE GE 0x0300)
INITCOMMONCONTROLSEX	STRUC
dwSize			dd ?
dwICC			dd ?
INITCOMMONCONTROLSEX	ENDS
LPINITCOMMONCONTROLSEX	typedef ptr INITCOMMONCONTROLSEX

define ICC_LISTVIEW_CLASSES	0x00000001
define ICC_TREEVIEW_CLASSES	0x00000002
define ICC_BAR_CLASSES		0x00000004
define ICC_TAB_CLASSES		0x00000008
define ICC_UPDOWN_CLASS		0x00000010
define ICC_PROGRESS_CLASS	0x00000020
define ICC_HOTKEY_CLASS		0x00000040
define ICC_ANIMATE_CLASS	0x00000080
define ICC_WIN95_CLASSES	0x000000FF
define ICC_DATE_CLASSES		0x00000100
define ICC_USEREX_CLASSES	0x00000200
define ICC_COOL_CLASSES		0x00000400
if (_WIN32_IE GE 0x0400)
define ICC_INTERNET_CLASSES	0x00000800
define ICC_PAGESCROLLER_CLASS	0x00001000
define ICC_NATIVEFNTCTL_CLASS	0x00002000
endif
if (_WIN32_WINNT GE 0x0501)
define ICC_STANDARD_CLASSES	0x00004000
define ICC_LINK_CLASS		0x00008000
endif
InitCommonControlsEx proto WINAPI :LPINITCOMMONCONTROLSEX
endif

define ODT_HEADER		100
define ODT_TAB			101
define ODT_LISTVIEW		102

define LVM_FIRST		0x1000
define TV_FIRST			0x1100
define HDM_FIRST		0x1200
define TCM_FIRST		0x1300

if (_WIN32_IE GE 0x0400)
define PGM_FIRST		0x1400
if (_WIN32_WINNT GE 0x0501)
define ECM_FIRST		0x1500
define BCM_FIRST		0x1600
define CBM_FIRST		0x1700
endif
define CCM_FIRST		0x2000
define CCM_LAST			(CCM_FIRST + 0x200)

define CCM_SETBKCOLOR		(CCM_FIRST + 1)

COLORSCHEME		STRUC
dwSize			dd ?
clrBtnHighlight		COLORREF ?
clrBtnShadow		COLORREF ?
COLORSCHEME		ENDS
LPCOLORSCHEME		typedef ptr COLORSCHEME

define CCM_SETCOLORSCHEME	(CCM_FIRST + 2)
define CCM_GETCOLORSCHEME	(CCM_FIRST + 3)
define CCM_GETDROPTARGET	(CCM_FIRST + 4)
define CCM_SETUNICODEFORMAT	(CCM_FIRST + 5)
define CCM_GETUNICODEFORMAT	(CCM_FIRST + 6)

if (_WIN32_IE GE 0x0500)
if (_WIN32_WINNT GE 0x0501)
define COMCTL32_VERSION	 6
else
define COMCTL32_VERSION	 5
endif
define CCM_SETVERSION		(CCM_FIRST + 0x7)
define CCM_GETVERSION		(CCM_FIRST + 0x8)
define CCM_SETNOTIFYWINDOW	(CCM_FIRST + 0x9)
if (_WIN32_WINNT GE 0x0501)
define CCM_SETWINDOWTHEME	(CCM_FIRST + 0xb)
define CCM_DPISCALE		(CCM_FIRST + 0xc)
endif
endif

endif

if (_WIN32_IE GE 0x0400)
define INFOTIPSIZE 1024
endif

HANDLE_WM_NOTIFY macro hwnd, wParam, lParam, fn
	exitm<fn(hwnd, int_t ptr wParam, lParam)>
	endm
FORWARD_WM_NOTIFY macro hwnd, idFrom, pnmhdr, fn
	exitm<fn(hwnd, WM_NOTIFY, int_t ptr (idFrom), pnmhdr)>
	endm

define NM_OUTOFMEMORY		(NM_FIRST-1)
define NM_CLICK			(NM_FIRST-2)
define NM_DBLCLK		(NM_FIRST-3)
define NM_RETURN		(NM_FIRST-4)
define NM_RCLICK		(NM_FIRST-5)
define NM_RDBLCLK		(NM_FIRST-6)
define NM_SETFOCUS		(NM_FIRST-7)
define NM_KILLFOCUS		(NM_FIRST-8)
if (_WIN32_IE GE 0x0300)
define NM_CUSTOMDRAW		(NM_FIRST-12)
define NM_HOVER			(NM_FIRST-13)
endif
if (_WIN32_IE GE 0x0400)
define NM_NCHITTEST		(NM_FIRST-14)
define NM_KEYDOWN		(NM_FIRST-15)
define NM_RELEASEDCAPTURE	(NM_FIRST-16)
define NM_SETCURSOR		(NM_FIRST-17)
define NM_CHAR			(NM_FIRST-18)
endif
if (_WIN32_IE GE 0x0401)
define NM_TOOLTIPSCREATED	(NM_FIRST-19)
endif
if (_WIN32_IE GE 0x0500)
define NM_LDOWN			(NM_FIRST-20)
define NM_RDOWN			(NM_FIRST-21)
define NM_THEMECHANGED		(NM_FIRST-22)
endif
if _WIN32_WINNT GE 0x0600
define NM_FONTCHANGED		(NM_FIRST-23)
define NM_CUSTOMTEXT		(NM_FIRST-24)
define NM_TVSTATEIMAGECHANGING	(NM_FIRST-24)
endif

ifndef CCSIZEOF_STRUCT
CCSIZEOF_STRUCT macro structname, member
	exitm<structname.member>
	endm
endif

if (_WIN32_IE GE 0x0401)
NMTOOLTIPSCREATED	STRUC
hdr			NMHDR <>
hwndToolTips		HWND ?
NMTOOLTIPSCREATED	ENDS
LPNMTOOLTIPSCREATED	typedef ptr NMTOOLTIPSCREATED
endif

if (_WIN32_IE GE 0x0400)

NMMOUSE			STRUC
hdr			NMHDR <>
dwItemSpec		dd ?
dwItemData		dd ?
pt			POINT <>
dwHitInfo		dd ?
NMMOUSE			ENDS
LPNMMOUSE		typedef ptr NMMOUSE

NMCLICK			typedef NMMOUSE
LPNMCLICK		typedef LPNMMOUSE

NMOBJECTNOTIFY		STRUC
hdr			NMHDR <>
iItem			SINT ?
ifdef __IID_DEFINED__
piid			LPIID ?
else
piid			LPVOID ?
endif
pObject			LPVOID ?
hResult			HRESULT ?
dwFlags			dd ?
NMOBJECTNOTIFY		ENDS
LPNMOBJECTNOTIFY	typedef ptr NMOBJECTNOTIFY

NMKEY			STRUC
hdr			NMHDR <>
nVKey			UINT ?
uFlags			UINT ?
NMKEY			ENDS
LPNMKEY			typedef ptr NMKEY

NMCHAR			STRUC
hdr			NMHDR <>
_ch			UINT ?
dwItemPrev		dd ?
dwItemNext		dd ?
NMCHAR			ENDS
LPNMCHAR		typedef ptr NMCHAR

endif

if (_WIN32_IE GE 0x0600)
NMCUSTOMTEXT		STRUC
hdr			NMHDR <>
hDC			HDC ?
lpString		LPCWSTR ?
nCount			SINT ?
lpRect			LPRECT ?
uFormat			UINT ?
fLink			BOOL ?
NMCUSTOMTEXT		ENDS
LPNMCUSTOMTEXT		typedef ptr NMCUSTOMTEXT
endif

define NM_FIRST			(0-0)
define NM_LAST			(0-99)
define LVN_FIRST		(0-100)
define LVN_LAST			(0-199)
define HDN_FIRST		(0-300)
define HDN_LAST			(0-399)
define TVN_FIRST		(0-400)
define TVN_LAST			(0-499)
define TTN_FIRST		(0-520)
define TTN_LAST			(0-549)
define TCN_FIRST		(0-550)
define TCN_LAST			(0-580)
define CDN_FIRST		(0-601)
define CDN_LAST			(0-699)
define TBN_FIRST		(0-700)
define TBN_LAST			(0-720)
define UDN_FIRST		(0-721)
define UDN_LAST			(0-729)
define DTN_FIRST		(0-740)
if (_WIN32_IE GE 0x0300)
define DTN_LAST			(0-745)
define MCN_FIRST		(0-746)
define MCN_LAST			(0-752)
define DTN_FIRST2		(0-753)
define DTN_LAST2		(0-799)
define CBEN_FIRST		(0-800)
define CBEN_LAST		(0-830)
define RBN_FIRST		(0-831)
define RBN_LAST			(0-859)
endif

if (_WIN32_IE GE 0x0400)
define IPN_FIRST		(0-860)
define IPN_LAST			(0-879)
define SBN_FIRST		(0-880)
define SBN_LAST			(0-899)
define PGN_FIRST		(0-900)
define PGN_LAST			(0-950)
endif

if (_WIN32_IE GE 0x0500)
ifndef WMN_FIRST
define WMN_FIRST		(0-1000)
define WMN_LAST			(0-1200)
endif
endif
if (_WIN32_WINNT GE 0x0501)
define BCN_FIRST		(0-1250)
define BCN_LAST			(0-1350)
endif
if (_WIN32_WINNT GE 0x0600)
define TRBN_FIRST		(0-1501)
define TRBN_LAST		(0-1519)
endif

define MSGF_COMMCTRL_BEGINDRAG	0x4200
define MSGF_COMMCTRL_SIZEHEADER 0x4201
define MSGF_COMMCTRL_DRAGSELECT 0x4202
define MSGF_COMMCTRL_TOOLBARCUST 0x4203

if (_WIN32_IE GE 0x0300)
define CDRF_DODEFAULT		0x00000000
define CDRF_NEWFONT		0x00000002
define CDRF_SKIPDEFAULT		0x00000004
define CDRF_DOERASE		0x00000008
define CDRF_SKIPPOSTPAINT	0x00000100

define CDRF_NOTIFYPOSTPAINT	0x00000010
define CDRF_NOTIFYITEMDRAW	0x00000020
if (_WIN32_IE GE 0x0400)
define CDRF_NOTIFYSUBITEMDRAW	0x00000020
endif
define CDRF_NOTIFYPOSTERASE	0x00000040

define CDDS_PREPAINT		0x00000001
define CDDS_POSTPAINT		0x00000002
define CDDS_PREERASE		0x00000003
define CDDS_POSTERASE		0x00000004
define CDDS_ITEM		0x00010000
define CDDS_ITEMPREPAINT	(CDDS_ITEM or CDDS_PREPAINT)
define CDDS_ITEMPOSTPAINT	(CDDS_ITEM or CDDS_POSTPAINT)
define CDDS_ITEMPREERASE	(CDDS_ITEM or CDDS_PREERASE)
define CDDS_ITEMPOSTERASE	(CDDS_ITEM or CDDS_POSTERASE)
if (_WIN32_IE GE 0x0400)
define CDDS_SUBITEM		0x00020000
endif

define CDIS_SELECTED		0x0001
define CDIS_GRAYED		0x0002
define CDIS_DISABLED		0x0004
define CDIS_CHECKED		0x0008
define CDIS_FOCUS		0x0010
define CDIS_DEFAULT		0x0020
define CDIS_HOT			0x0040
define CDIS_MARKED		0x0080
define CDIS_INDETERMINATE	0x0100
if (_WIN32_WINNT GE 0x0501)
define CDIS_SHOWKEYBOARDCUES	0x0200
endif
if (_WIN32_WINNT GE 0x0600)
define CDIS_NEARHOT		0x0400
define CDIS_OTHERSIDEHOT	0x0800
define CDIS_DROPHILITED		0x1000
endif

NMCUSTOMDRAW		STRUC
hdr			NMHDR <>
dwDrawStage		dd ?
hdc			HDC ?
rc			RECT <>
dwItemSpec		dd ?
uItemState		UINT ?
lItemlParam		LPARAM ?
NMCUSTOMDRAW		ENDS
LPNMCUSTOMDRAW		typedef ptr NMCUSTOMDRAW

NMTTCUSTOMDRAW		STRUC
nmcd			NMCUSTOMDRAW <>
uDrawFlags		UINT ?
NMTTCUSTOMDRAW		ENDS
LPNMTTCUSTOMDRAW	typedef ptr NMTTCUSTOMDRAW

NMCUSTOMSPLITRECTINFO	STRUC
hdr			NMHDR <>
rcClient		RECT <>
rcButton		RECT <>
rcSplit			RECT <>
NMCUSTOMSPLITRECTINFO	ENDS
LPNMCUSTOMSPLITRECTINFO typedef ptr NMCUSTOMSPLITRECTINFO

define NM_GETCUSTOMSPLITRECT (BCN_FIRST + 0x0003)

endif

ifndef NOIMAGEAPIS

define CLR_NONE		0xFFFFFFFF
define CLR_DEFAULT	0xFF000000

HIMAGELIST typedef ptr IMAGELIST

ifndef IMAGELISTDRAWPARAMS
if (_WIN32_IE GE 0x0300)
IMAGELISTDRAWPARAMS	STRUC
cbSize			dd ?
himl			HIMAGELIST ?
i			SINT ?
hdcDst			HDC ?
x			SINT ?
y			SINT ?
_cx			SINT ?
cy			SINT ?
xBitmap			SINT ?
yBitmap			SINT ?
rgbBk			COLORREF ?
rgbFg			COLORREF ?
fStyle			UINT ?
dwRop			dd ?
if (_WIN32_IE GE 0x0501)
fState			dd ?
_Frame			dd ?
crEffect		COLORREF ?
endif
IMAGELISTDRAWPARAMS	ENDS
LPIMAGELISTDRAWPARAMS	typedef ptr IMAGELISTDRAWPARAMS

IMAGELISTDRAWPARAMS_V3_SIZE equ CCSIZEOF_STRUCT(IMAGELISTDRAWPARAMS, dwRop)

endif ;; (_WIN32_IE GE 0x0300)
endif ;; IMAGELISTDRAWPARAMS

define ILC_MASK			0x00000001
define ILC_COLOR		0x00000000
define ILC_COLORDDB		0x000000FE
define ILC_COLOR4		0x00000004
define ILC_COLOR8		0x00000008
define ILC_COLOR16		0x00000010
define ILC_COLOR24		0x00000018
define ILC_COLOR32		0x00000020
define ILC_PALETTE		0x00000800
if (_WIN32_WINNT GE 0x0501)
define ILC_MIRROR		0x00002000
define ILC_PERITEMMIRROR	0x00008000
endif
if _WIN32_WINNT GE 0x0600
define ILC_ORIGINALSIZE		0x00010000
define ILC_HIGHQUALITYSCALE	0x00020000
endif

ImageList_Create proto WINAPI :sdword, :sdword, :UINT, :sdword, :sdword
ImageList_Destroy proto WINAPI :HIMAGELIST
ImageList_GetImageCount proto WINAPI :HIMAGELIST
if (_WIN32_IE GE 0x0300)
ImageList_SetImageCount proto WINAPI :HIMAGELIST, :UINT
endif
ImageList_Add proto WINAPI :HIMAGELIST, :HBITMAP, :HBITMAP
ImageList_ReplaceIcon proto WINAPI :HIMAGELIST, :sdword, :HICON
ImageList_SetBkColor proto WINAPI :HIMAGELIST, :COLORREF
ImageList_GetBkColor proto WINAPI :HIMAGELIST
ImageList_SetOverlayImage proto WINAPI :HIMAGELIST, :sdword, :sdword

ImageList_AddIcon macro himl, hicon
	exitm<ImageList_ReplaceIcon(himl, -1, hicon)>
	endm

define ILD_NORMAL		0x00000000
define ILD_TRANSPARENT		0x00000001
define ILD_MASK			0x00000010
define ILD_IMAGE		0x00000020
if (_WIN32_IE GE 0x0300)
define ILD_ROP			0x00000040
endif
define ILD_BLEND25		0x00000002
define ILD_BLEND50		0x00000004
define ILD_OVERLAYMASK		0x00000F00
INDEXTOOVERLAYMASK macro i
	exitm<(i SHL 8)>
	endm
define ILD_PRESERVEALPHA	0x00001000
define ILD_SCALE		0x00002000
define ILD_DPISCALE		0x00004000
if _WIN32_WINNT GE 0x0600
define ILD_ASYNC		0x00008000
endif
define ILD_SELECTED		ILD_BLEND50
define ILD_FOCUS		ILD_BLEND25
define ILD_BLEND		ILD_BLEND50
define CLR_HILIGHT		CLR_DEFAULT

define ILS_NORMAL		0x00000000
define ILS_GLOW			0x00000001
define ILS_SHADOW		0x00000002
define ILS_SATURATE		0x00000004
define ILS_ALPHA		0x00000008
if _WIN32_WINNT GE 0x0600
define ILGT_NORMAL		0x00000000
define ILGT_ASYNC		0x00000001
endif

ImageList_Draw proto WINAPI :HIMAGELIST, :sdword, :HDC, :sdword, :sdword, :UINT

ifdef _WIN32

if _WIN32_WINNT GE 0x0600
define HBITMAP_CALLBACK		(-1)
endif

ImageList_Replace proto WINAPI :HIMAGELIST, :sdword, :HBITMAP, :HBITMAP
ImageList_AddMasked proto WINAPI :HIMAGELIST, :HBITMAP, :COLORREF
ImageList_DrawEx proto WINAPI :HIMAGELIST, :sdword, :HDC, :sdword, :sdword, :sdword, :sdword, :COLORREF, :COLORREF, :UINT
if (_WIN32_IE GE 0x0300)
ImageList_DrawIndirect proto WINAPI :ptr
endif
ImageList_Remove proto WINAPI :HIMAGELIST, :sdword
ImageList_GetIcon proto WINAPI :HIMAGELIST, :sdword, :UINT
ImageList_LoadImageA proto WINAPI :HINSTANCE, :LPCSTR, :sdword, :sdword, :COLORREF, :UINT, :UINT
ImageList_LoadImageW proto WINAPI :HINSTANCE, :LPCWSTR, :sdword, :sdword, :COLORREF, :UINT, :UINT
ifdef _UNICODE
define ImageList_LoadImage <ImageList_LoadImageW>
else
define ImageList_LoadImage <ImageList_LoadImageA>
endif

if (_WIN32_IE GE 0x0300)
define ILCF_MOVE 0x00000000
define ILCF_SWAP 0x00000001
ImageList_Copy proto WINAPI :HIMAGELIST, :sdword, :HIMAGELIST, :sdword, :UINT
endif
ImageList_BeginDrag proto WINAPI :HIMAGELIST, :sdword, :sdword, :sdword
ImageList_EndDrag proto WINAPI
ImageList_DragEnter proto WINAPI :HWND, :sdword, :sdword
ImageList_DragLeave proto WINAPI :HWND
ImageList_DragMove proto WINAPI :sdword, :sdword
ImageList_SetDragCursorImage proto WINAPI :HIMAGELIST, :sdword, :sdword, :sdword
ImageList_DragShowNolock proto WINAPI :BOOL
ImageList_GetDragImage proto WINAPI :ptr, :ptr


ImageList_RemoveAll macro himl
	exitm<Imageist_Remove(himl, -1)>
	endm
ImageList_ExtractIcon macro hi, himl, i
	exitm<Imageist_GetIcon(himl, i, 0)>
	endm
ImageList_LoadBitmap macro hi, lpbmp, _cx, cGrow, crMask
	exitm<ImageList_LoadImage(hi, lpbmp, _cx, cGrow, crMask, IMAGE_BITMAP, 0)>
	endm

ImageList_Read proto WINAPI :ptr
ImageList_Write proto WINAPI :HIMAGELIST, :ptr

if (_WIN32_WINNT GE 0x0501)
define ILP_NORMAL	   0
define ILP_DOWNLEVEL	   1
ImageList_ReadEx proto WINAPI :DWORD, :ptr, :REFIID, :ptr
ImageList_WriteEx proto WINAPI :HIMAGELIST, :DWORD, :ptr
endif

ifndef IMAGEINFO
IMAGEINFO		STRUC
hbmImage		HBITMAP ?
hbmMask			HBITMAP ?
Unused1			SINT ?
Unused2			SINT ?
rcImage			RECT <>
IMAGEINFO		ENDS
LPIMAGEINFO		typedef ptr IMAGEINFO
endif

ImageList_GetIconSize proto WINAPI :HIMAGELIST, :ptr, :ptr
ImageList_SetIconSize proto WINAPI :HIMAGELIST, :sdword, :sdword
ImageList_GetImageInfo proto WINAPI :HIMAGELIST, :sdword, :ptr
ImageList_Merge proto WINAPI :HIMAGELIST, :sdword, :HIMAGELIST, :sdword, :sdword, :sdword
if (_WIN32_IE GE 0x0400)
ImageList_Duplicate proto WINAPI :HIMAGELIST
endif

endif ;; _WIN32

if (_WIN32_WINNT GE 0x0501)
HIMAGELIST_QueryInterface proto WINAPI :HIMAGELIST, :REFIID, :ptr ptr

IImageListToHIMAGELIST macro himl
	exitm<himl>
	endm
endif

endif ;; NOIMAGEAPIS

ifndef NOHEADER

ifdef _WIN32
define WC_HEADER <"SysHeader32">
else
define WC_HEADER <"SysHeader">
endif

define HDS_HORZ			0x0000
define HDS_BUTTONS		0x0002
if (_WIN32_IE GE 0x0300)
define HDS_HOTTRACK		0x0004
endif
define HDS_HIDDEN		0x0008
if (_WIN32_IE GE 0x0300)
define HDS_DRAGDROP		0x0040
define HDS_FULLDRAG		0x0080
endif
if (_WIN32_IE GE 0x0500)
define HDS_FILTERBAR		0x0100
endif
if (_WIN32_WINNT GE 0x0501)
define HDS_FLAT			0x0200
endif
if _WIN32_WINNT GE 0x0600
define HDS_CHECKBOXES		0x0400
define HDS_NOSIZING		0x0800
define HDS_OVERFLOW		0x1000
endif

if (_WIN32_IE GE 0x0500)

define HDFT_ISSTRING		0x0000
define HDFT_ISNUMBER		0x0001
define HDFT_ISDATE		0x0002

define HDFT_HASNOVALUE		0x8000

HD_TEXTFILTERA		STRUC
pszText			LPSTR ?
cchTextMax		SINT ?
HD_TEXTFILTERA		ENDS
LPHD_TEXTFILTERA	typedef ptr HD_TEXTFILTERA
HD_TEXTFILTERW		STRUC
pszText			LPSTR ?
cchTextMax		SINT ?
HD_TEXTFILTERW		ENDS
LPHD_TEXTFILTERW	typedef ptr HD_TEXTFILTERW

ifdef _UNICODE
define HD_TEXTFILTER	<HD_TEXTFILTERW>
define HDTEXTFILTER	<HD_TEXTFILTERW>
define LPHD_TEXTFILTER	<LPHD_TEXTFILTERW>
define LPHDTEXTFILTER	<LPHD_TEXTFILTERW>
else
define HD_TEXTFILTER	<HD_TEXTFILTERA>
define HDTEXTFILTER	<HD_TEXTFILTERA>
define LPHD_TEXTFILTER	<LPHD_TEXTFILTERA>
define LPHDTEXTFILTER	<LPHD_TEXTFILTERA>
endif

endif ;; (_WIN32_IE GE 0x0500)

define HD_ITEMA		<HDITEMA>
define HD_ITEMW		<HDITEMW>
define HD_ITEM		<HDITEM>

HDITEMA			STRUC
mask			UINT ?
cxy			SINT ?
pszText			LPSTR ?
hbm			HBITMAP ?
cchTextMax		SINT ?
fmt			SINT ?
lParam			LPARAM ?
if (_WIN32_IE GE 0x0300)
iImage			SINT ?
iOrder			SINT ?
endif
if (_WIN32_IE GE 0x0500)
type			UINT ?
pvFilter		PVOID ?
endif
if (_WIN32_WINNT GE 0x0600)
state			UINT ?
endif
HDITEMA			ENDS
LPHDITEMA		typedef ptr HDITEMA

HDITEMW			STRUC
mask			UINT ?
cxy			SINT ?
pszText			LPWSTR ?
hbm			HBITMAP ?
cchTextMax		SINT ?
fmt			SINT ?
lParam			LPARAM ?
if (_WIN32_IE GE 0x0300)
iImage			SINT ?
iOrder			SINT ?
endif
if (_WIN32_IE GE 0x0500)
type			UINT ?
pvFilter		PVOID ?
endif
if (_WIN32_WINNT GE 0x0600)
state			UINT ?
endif
HDITEMW			ENDS
LPHDITEMW		typedef ptr HDITEMW

define HDITEMA_V1_SIZE	CCSIZEOF_STRUCT(HDITEMA, lParam)
define HDITEMW_V1_SIZE	CCSIZEOF_STRUCT(HDITEMW, lParam)

ifdef _UNICODE
HDITEM			typedef HDITEMW
LPHDITEM		typedef LPHDITEMW
define HDITEM_V1_SIZE	HDITEMW_V1_SIZE
else
HDITEM			typedef HDITEMA
LPHDITEM		typedef LPHDITEMA
define HDITEM_V1_SIZE	HDITEMA_V1_SIZE
endif

define HDI_WIDTH		0x0001
define HDI_HEIGHT		HDI_WIDTH
define HDI_TEXT			0x0002
define HDI_FORMAT		0x0004
define HDI_LPARAM		0x0008
define HDI_BITMAP		0x0010
if (_WIN32_IE GE 0x0300)
define HDI_IMAGE		0x0020
define HDI_DI_SETITEM		0x0040
define HDI_ORDER		0x0080
endif
if (_WIN32_IE GE 0x0500)
define HDI_FILTER		0x0100
endif
if _WIN32_WINNT GE 0x0600
define HDI_STATE		0x0200
endif

define HDF_LEFT			0x0000
define HDF_RIGHT		0x0001
define HDF_CENTER		0x0002
define HDF_JUSTIFYMASK		0x0003
define HDF_RTLREADING		0x0004

define HDF_BITMAP		0x2000
define HDF_STRING		0x4000
define HDF_OWNERDRAW		0x8000
if (_WIN32_IE GE 0x0300)
define HDF_IMAGE		0x0800
define HDF_BITMAP_ON_RIGHT	0x1000
endif
if (_WIN32_WINNT GE 0x0501)
define HDF_SORTUP		0x0400
define HDF_SORTDOWN		0x0200
endif

if (_WIN32_WINNT GE 0x0600)
define HDF_CHECKBOX		0x0040
define HDF_CHECKED		0x0080
define HDF_FIXEDWIDTH		0x0100
define HDF_SPLITBUTTON		0x1000000
endif

if _WIN32_WINNT GE 0x0600
define HDIS_FOCUSED		0x00000001
endif

define HDM_GETITEMCOUNT		(HDM_FIRST + 0)
Header_GetItemCount macro hwndHD
	exitm<SNDMSG(hwndHD, HDM_GETITEMCOUNT, 0, 0)>
	endm

define HDM_INSERTITEMA		(HDM_FIRST + 1)
define HDM_INSERTITEMW		(HDM_FIRST + 10)
ifdef _UNICODE
define HDM_INSERTITEM		HDM_INSERTITEMW
else
define HDM_INSERTITEM		HDM_INSERTITEMA
endif

Header_InsertItem macro hwndHD, i, phdi
	exitm<SNDMSG(hwndHD, HDM_INSERTITEM, i, phdi)>
	endm

define HDM_DELETEITEM		(HDM_FIRST + 2)
Header_DeleteItem macro hwndHD, i
	exitm<SNDMSG(hwndHD, HDM_DEETEITEM, i, 0)>
	endm

define HDM_GETITEMA		(HDM_FIRST + 3)
define HDM_GETITEMW		(HDM_FIRST + 11)
ifdef _UNICODE
define HDM_GETITEM		HDM_GETITEMW
else
define HDM_GETITEM		HDM_GETITEMA
endif

Header_GetItem macro hwndHD, i, phdi
	exitm<SNDMSG(hwndHD, HDM_GETITEM, i, phdi)>
	endm

define HDM_SETITEMA		(HDM_FIRST + 4)
define HDM_SETITEMW		(HDM_FIRST + 12)
ifdef _UNICODE
define HDM_SETITEM		HDM_SETITEMW
else
define HDM_SETITEM		HDM_SETITEMA
endif

Header_SetItem macro hwndHD, i, phdi
	exitm<SNDMSG(hwndHD, HDM_SETITEM, i, phdi)>
	endm

define HD_LAYOUT <HDAYOUT>

HDLAYOUT		STRUC
prc			LPRECT ?
pwpos			LPWINDOWPOS ?
HDLAYOUT		ENDS
LPHDLAYOUT		typedef ptr HDLAYOUT

define HDM_LAYOUT		(HDM_FIRST + 5)
Header_Layout macro hwndHD, playout
	exitm<SNDMSG(hwndHD, HDM_LAYOUT, 0, playout)>
	endm

define HHT_NOWHERE		0x0001
define HHT_ONHEADER		0x0002
define HHT_ONDIVIDER		0x0004
define HHT_ONDIVOPEN		0x0008
if (_WIN32_IE GE 0x0500)
define HHT_ONFILTER		0x0010
define HHT_ONFILTERBUTTON	0x0020
endif
define HHT_ABOVE		0x0100
define HHT_BELOW		0x0200
define HHT_TORIGHT		0x0400
define HHT_TOLEFT		0x0800
if _WIN32_WINNT GE 0x0600
define HHT_ONITEMSTATEICON	0x1000
define HHT_ONDROPDOWN		0x2000
define HHT_ONOVERFLOW		0x4000
endif

define HD_HITTESTINFO	<HDHITTESTINFO>

HDHITTESTINFO		STRUC
pt			POINT <>
flags			UINT ?
iItem			SINT ?
HDHITTESTINFO		ENDS
LPHDHITTESTINFO		typedef ptr HDHITTESTINFO

define HDSIL_NORMAL	0
define HDSIL_STATE	1
define HDM_HITTEST	(HDM_FIRST + 6)

if (_WIN32_IE GE 0x0300)

define HDM_GETITEMRECT	(HDM_FIRST + 7)
Header_GetItemRect macro hwnd, iItem, lprc
	exitm<SNDMSG(hwnd, HDM_GETITEMRECT, iItem, lprc)>
	endm

define HDM_SETIMAGELIST (HDM_FIRST + 8)
Header_SetImageList macro hwnd, himl
	exitm<SNDMSG(hwnd, HDM_SETIMAGEIST, 0, himl)>
	endm
Header_SetStateImageList macro hwnd, himl
	exitm<SNDMSG(hwnd, HDM_SETIMAGELIST, HDSIL_STATE, himl)>
	endm

define HDM_GETIMAGELIST (HDM_FIRST + 9)
Header_GetImageList macro hwnd
	exitm<SNDMSG(hwnd, HDM_GETIMAGEIST, 0, 0)>
	endm
Header_GetStateImageList macro hwnd
	exitm<SNDMSG(hwnd, HDM_GETIMAGELIST, HDSIL_STATE, 0)>
	endm

define HDM_ORDERTOINDEX		(HDM_FIRST + 15)
Header_OrderToIndex macro hwnd, i
	exitm<SNDMSG(hwnd, HDM_ORDERTOINDEX, i, 0)>
	endm

define HDM_CREATEDRAGIMAGE	(HDM_FIRST + 16)
Header_CreateDragImage macro hwnd, i
	exitm<SNDMSG(hwnd, HDM_CREATEDRAGIMAGE, i, 0)>
	endm

define HDM_GETORDERARRAY	(HDM_FIRST + 17)
Header_GetOrderArray macro hwnd, iCount, lpi
	exitm<SNDMSG(hwnd, HDM_GETORDERARRAY, iCount, lpi)>
	endm

define HDM_SETORDERARRAY	(HDM_FIRST + 18)
Header_SetOrderArray macro hwnd, iCount, lpi
	exitm<SNDMSG(hwnd, HDM_SETORDERARRAY, iCount, lpi)>
	endm

define HDM_SETHOTDIVIDER	(HDM_FIRST + 19)
Header_SetHotDivider macro hwnd, fPos, w
	exitm<SNDMSG(hwnd, HDM_SETHOTDIVIDER, fPos, w)>
	endm
endif

if (_WIN32_IE GE 0x0500)

define HDM_SETBITMAPMARGIN	(HDM_FIRST + 20)
Header_SetBitmapMargin macro hwnd, iWidth
	exitm<SNDMSG(hwnd, HDM_SETBITMAPMARGIN, iWidth, 0)>
	endm

define HDM_GETBITMAPMARGIN	(HDM_FIRST + 21)
Header_GetBitmapMargin macro hwnd
	exitm<SNDMSG(hwnd, HDM_GETBITMAPMARGIN, 0, 0)>
	endm
endif

if (_WIN32_IE GE 0x0400)
define HDM_SETUNICODEFORMAT	CCM_SETUNICODEFORMAT
Header_SetUnicodeFormat macro hwnd, fUnicode
	exitm<SNDMSG(hwnd, HDM_SETUNICODEFORMAT, fUnicode, 0)>
	endm

define HDM_GETUNICODEFORMAT	CCM_GETUNICODEFORMAT
Header_GetUnicodeFormat macro hwnd
	exitm<SNDMSG(hwnd, HDM_GETUNICODEFORMAT, 0, 0)>
	endm
endif
define HDM_SETFILTERCHANGETIMEOUT	(HDM_FIRST+22)
define HDM_EDITFILTER			(HDM_FIRST+23)
define HDM_CLEARFILTER			(HDM_FIRST+24)
if (_WIN32_IE ge 0x0600)
define HDM_TRANSLATEACCELERATOR		CCM_TRANSLATEACCELERATOR
endif
if (NTDDI_VERSION ge NTDDI_VISTA)
define HDM_GETITEMDROPDOWNRECT		(HDM_FIRST+25)
define HDM_GETOVERFLOWRECT		(HDM_FIRST+26)
define HDM_GETFOCUSEDITEM		(HDM_FIRST+27)
define HDM_SETFOCUSEDITEM		(HDM_FIRST+28)
endif

define HDN_ITEMCHANGINGA	(HDN_FIRST-0)
define HDN_ITEMCHANGINGW	(HDN_FIRST-20)
define HDN_ITEMCHANGEDA		(HDN_FIRST-1)
define HDN_ITEMCHANGEDW		(HDN_FIRST-21)
define HDN_ITEMCLICKA		(HDN_FIRST-2)
define HDN_ITEMCLICKW		(HDN_FIRST-22)
define HDN_ITEMDBLCLICKA	(HDN_FIRST-3)
define HDN_ITEMDBLCLICKW	(HDN_FIRST-23)
define HDN_DIVIDERDBLCLICKA	(HDN_FIRST-5)
define HDN_DIVIDERDBLCLICKW	(HDN_FIRST-25)
define HDN_BEGINTRACKA		(HDN_FIRST-6)
define HDN_BEGINTRACKW		(HDN_FIRST-26)
define HDN_ENDTRACKA		(HDN_FIRST-7)
define HDN_ENDTRACKW		(HDN_FIRST-27)
define HDN_TRACKA		(HDN_FIRST-8)
define HDN_TRACKW		(HDN_FIRST-28)
if (_WIN32_IE GE 0x0300)
define HDN_GETDISPINFOA		(HDN_FIRST-9)
define HDN_GETDISPINFOW		(HDN_FIRST-29)
define HDN_BEGINDRAG		(HDN_FIRST-10)
define HDN_ENDDRAG		(HDN_FIRST-11)
endif
if (_WIN32_IE GE 0x0500)
define HDN_FILTERCHANGE		(HDN_FIRST-12)
define HDN_FILTERBTNCLICK	(HDN_FIRST-13)
endif
if (_WIN32_IE GE 0x0600)
define HDN_BEGINFILTEREDIT	(HDN_FIRST-14)
define HDN_ENDFILTEREDIT	(HDN_FIRST-15)
endif
if _WIN32_WINNT GE 0x0600
define HDN_ITEMSTATEICONCLICK	(HDN_FIRST-16)
define HDN_ITEMKEYDOWN		(HDN_FIRST-17)
define HDN_DROPDOWN		(HDN_FIRST-18)
define HDN_OVERFLOWCLICK	(HDN_FIRST-19)
endif

ifdef _UNICODE
define HDN_ITEMCHANGING		HDN_ITEMCHANGINGW
define HDN_ITEMCHANGED		HDN_ITEMCHANGEDW
define HDN_ITEMCLICK		HDN_ITEMCLICKW
define HDN_ITEMDBLCLICK		HDN_ITEMDBLCLICKW
define HDN_DIVIDERDBLCLICK	HDN_DIVIDERDBLCLICKW
define HDN_BEGINTRACK		HDN_BEGINTRACKW
define HDN_ENDTRACK		HDN_ENDTRACKW
define HDN_TRACK		HDN_TRACKW
if (_WIN32_IE GE 0x0300)
define HDN_GETDISPINFO		HDN_GETDISPINFOW
endif
else
define HDN_ITEMCHANGING		HDN_ITEMCHANGINGA
define HDN_ITEMCHANGED		HDN_ITEMCHANGEDA
define HDN_ITEMCLICK		HDN_ITEMCLICKA
define HDN_ITEMDBLCLICK		HDN_ITEMDBLCLICKA
define HDN_DIVIDERDBLCLICK	HDN_DIVIDERDBLCLICKA
define HDN_BEGINTRACK		HDN_BEGINTRACKA
define HDN_ENDTRACK		HDN_ENDTRACKA
define HDN_TRACK		HDN_TRACKA
if (_WIN32_IE GE 0x0300)
define HDN_GETDISPINFO		HDN_GETDISPINFOA
endif
endif ;; _UNICODE

NMHEADERA		STRUC
hdr			NMHDR <>
iItem			SINT ?
iButton			SINT ?
pitem			LPHDITEMA ?
NMHEADERA		ENDS
LPNMHEADERA		typedef ptr NMHEADERA

NMHEADERW		STRUC
hdr			NMHDR <>
iItem			SINT ?
iButton			SINT ?
pitem			LPHDITEMW ?
NMHEADERW		ENDS
LPNMHEADERW		typedef ptr NMHEADERW

ifdef _UNICODE
NMHEADER		typedef NMHEADERW
LPNMHEADER		typedef LPNMHEADERW
else
NMHEADER		typedef NMHEADERA
LPNMHEADER		typedef LPNMHEADERA
endif
HD_NOTIFYA		typedef NMHEADERA
HD_NOTIFYW		typedef NMHEADERW
HD_NOTIFY		typedef NMHEADER

NMHDDISPINFOW		STRUC
hdr			NMHDR <>
iItem			SINT ?
mask			UINT ?
pszText			LPWSTR ?
cchTextMax		SINT ?
iImage			SINT ?
lParam			LPARAM ?
NMHDDISPINFOW		ENDS
LPNMHDDISPINFOW		typedef ptr NMHDDISPINFOW

NMHDDISPINFOA		STRUC
hdr			NMHDR <>
iItem			SINT ?
mask			UINT ?
pszText			LPSTR ?
cchTextMax		SINT ?
iImage			SINT ?
lParam			LPARAM ?
NMHDDISPINFOA		ENDS
LPNMHDDISPINFOA		typedef ptr NMHDDISPINFOA

ifdef _UNICODE
NMHDDISPINFO		typedef NMHDDISPINFOW
LPNMHDDISPINFO		typedef LPNMHDDISPINFOW
else
NMHDDISPINFO		typedef NMHDDISPINFOA
LPNMHDDISPINFO		typedef LPNMHDDISPINFOA
endif

endif ;; NOHEADER

ifndef NOTOOLBAR

ifdef _WIN32
define TOOLBARCLASSNAME <"ToolbarWindow32">
else
define TOOLBARCLASSNAME <"ToolbarWindow">
endif

TBBUTTON		STRUC
iBitmap			SINT ?
idCommand		SINT ?
fsState			db ?
fsStyle			db ?
ifdef _WIN64
bReserved		db 6 dup(?)
else
ifdef _WIN32
bReserved		db 2 dup(?)
endif
endif
dwData			dd ?
iString			SINT ?
TBBUTTON		ENDS
PTBBUTTON		typedef ptr TBBUTTON
LPTBBUTTON		typedef ptr TBBUTTON
LPCTBBUTTON		typedef ptr TBBUTTON

COLORMAP		STRUC
from			COLORREF ?
to			COLORREF ?
COLORMAP		ENDS
LPCOLORMAP		typedef ptr COLORMAP

CreateToolbarEx proto WINAPI :HWND, :DWORD, :UINT, :sdword, :HINSTANCE, :UINT_PTR, :LPCTBBUTTON, :sdword, :sdword, :sdword, :sdword, :sdword, :UINT
CreateMappedBitmap proto WINAPI :HINSTANCE, :INT_PTR, :UINT, :LPCOLORMAP, :sdword

define CMB_MASKED		0x02
define TBSTATE_CHECKED		0x01
define TBSTATE_PRESSED		0x02
define TBSTATE_ENABLED		0x04
define TBSTATE_HIDDEN		0x08
define TBSTATE_INDETERMINATE	0x10
define TBSTATE_WRAP		0x20
if (_WIN32_IE GE 0x0300)
define TBSTATE_ELLIPSES		0x40
endif
if (_WIN32_IE GE 0x0400)
define TBSTATE_MARKED		0x80
endif

define TBSTYLE_BUTTON		0x0000
define TBSTYLE_SEP		0x0001
define TBSTYLE_CHECK		0x0002
define TBSTYLE_GROUP		0x0004
define TBSTYLE_CHECKGROUP	(TBSTYLE_GROUP or TBSTYLE_CHECK)
if (_WIN32_IE GE 0x0300)
define TBSTYLE_DROPDOWN		0x0008
endif
if (_WIN32_IE GE 0x0400)
define TBSTYLE_AUTOSIZE		0x0010
define TBSTYLE_NOPREFIX		0x0020
endif

define TBSTYLE_TOOLTIPS		0x0100
define TBSTYLE_WRAPABLE		0x0200
define TBSTYLE_ALTDRAG		0x0400
if (_WIN32_IE GE 0x0300)
define TBSTYLE_FLAT		0x0800
define TBSTYLE_LIST		0x1000
define TBSTYLE_CUSTOMERASE	0x2000
endif
if (_WIN32_IE GE 0x0400)
define TBSTYLE_REGISTERDROP	0x4000
define TBSTYLE_TRANSPARENT	0x8000
define TBSTYLE_EX_DRAWDDARROWS	0x00000001
endif

define BTNS_BUTTON		TBSTYLE_BUTTON
define BTNS_SEP			TBSTYLE_SEP
define BTNS_CHECK		TBSTYLE_CHECK
define BTNS_GROUP		TBSTYLE_GROUP
define BTNS_CHECKGROUP		TBSTYLE_CHECKGROUP
define BTNS_DROPDOWN		TBSTYLE_DROPDOWN
define BTNS_AUTOSIZE		TBSTYLE_AUTOSIZE
define BTNS_NOPREFIX		TBSTYLE_NOPREFIX
define BTNS_SHOWTEXT		0x0040
define BTNS_WHOLEDROPDOWN	0x0080

define TBSTYLE_EX_MIXEDBUTTONS		   0x00000008
define TBSTYLE_EX_HIDECLIPPEDBUTTONS	   0x00000010
define TBSTYLE_EX_MULTICOLUMN		   0x00000002
define TBSTYLE_EX_VERTICAL		   0x00000004
if (NTDDI_VERSION GE NTDDI_WINXP)
define TBSTYLE_EX_DOUBLEBUFFER		   0x00000080
endif

if (_WIN32_IE GE 0x0400)
NMTBCUSTOMDRAW		STRUC
nmcd			NMCUSTOMDRAW <>
hbrMonoDither		HBRUSH ?
hbrLines		HBRUSH ?
hpenLines		HPEN ?
clrText			COLORREF ?
clrMark			COLORREF ?
clrTextHighlight	COLORREF ?
clrBtnFace		COLORREF ?
clrBtnHighlight		COLORREF ?
clrHighlightHotTrack	COLORREF ?
rcText			RECT <>
nStringBkMode		SINT ?
nHLStringBkMode		SINT ?
if (NTDDI_VERSION ge NTDDI_WINXP)
iListGap		SINT ?
endif
NMTBCUSTOMDRAW		ENDS
LPNMTBCUSTOMDRAW	typedef ptr NMTBCUSTOMDRAW

define TBCDRF_NOEDGES		0x00010000
define TBCDRF_HILITEHOTTRACK	0x00020000
define TBCDRF_NOOFFSET		0x00040000
define TBCDRF_NOMARK		0x00080000
define TBCDRF_NOETCHEDEFFECT	0x00100000
endif
if (_WIN32_IE GE 0x0500)
define TBCDRF_BLENDICON		0x00200000
define TBCDRF_NOBACKGROUND	0x00400000
endif
if _WIN32_WINNT GE 0x0600
define TBCDRF_USECDCOLORS	0x00800000
endif

define TB_ENABLEBUTTON		(WM_USER + 1)
define TB_CHECKBUTTON		(WM_USER + 2)
define TB_PRESSBUTTON		(WM_USER + 3)
define TB_HIDEBUTTON		(WM_USER + 4)
define TB_INDETERMINATE		(WM_USER + 5)
if (_WIN32_IE GE 0x0400)
define TB_MARKBUTTON		(WM_USER + 6)
endif
define TB_ISBUTTONENABLED	(WM_USER + 9)
define TB_ISBUTTONCHECKED	(WM_USER + 10)
define TB_ISBUTTONPRESSED	(WM_USER + 11)
define TB_ISBUTTONHIDDEN	(WM_USER + 12)
define TB_ISBUTTONINDETERMINATE (WM_USER + 13)
if (_WIN32_IE GE 0x0400)
define TB_ISBUTTONHIGHLIGHTED	(WM_USER + 14)
endif
define TB_SETSTATE		(WM_USER + 17)
define TB_GETSTATE		(WM_USER + 18)
define TB_ADDBITMAP		(WM_USER + 19)

ifdef _WIN32
TBADDBITMAP		STRUC
hInst			HINSTANCE ?
nID			UINT_PTR ?
TBADDBITMAP		ENDS
LPTBADDBITMAP		typedef ptr TBADDBITMAP

define HINST_COMMCTRL		(-1)
define IDB_STD_SMALL_COLOR	0
define IDB_STD_LARGE_COLOR	1
define IDB_VIEW_SMALL_COLOR	4
define IDB_VIEW_LARGE_COLOR	5
if (_WIN32_IE GE 0x0300)
define IDB_HIST_SMALL_COLOR	8
define IDB_HIST_LARGE_COLOR	9
endif
if (_WIN32_WINNT GE 0x600)
define IDB_HIST_NORMAL		12
define IDB_HIST_HOT		13
define IDB_HIST_DISABLED	14
define IDB_HIST_PRESSED		15
endif

define STD_CUT			0
define STD_COPY			1
define STD_PASTE		2
define STD_UNDO			3
define STD_REDOW		4
define STD_DELETE		5
define STD_FILENEW		6
define STD_FILEOPEN		7
define STD_FILESAVE		8
define STD_PRINTPRE		9
define STD_PROPERTIES		10
define STD_HELP			11
define STD_FIND			12
define STD_REPLACE		13
define STD_PRINT		14

define VIEW_LARGEICONS		0
define VIEW_SMALLICONS		1
define VIEW_LIST		2
define VIEW_DETAILS		3
define VIEW_SORTNAME		4
define VIEW_SORTSIZE		5
define VIEW_SORTDATE		6
define VIEW_SORTTYPE		7
define VIEW_PARENTFOLDER	8
define VIEW_NETCONNECT		9
define VIEW_NETDISCONNECT	10
define VIEW_NEWFOLDER		11
if (_WIN32_IE GE 0x0400)
define VIEW_VIEWMENU		12
endif

if (_WIN32_IE GE 0x0300)
define HIST_BACK		0
define HIST_FORWARD		1
define HIST_FAVORITES		2
define HIST_ADDTOFAVORITES	3
define HIST_VIEWTREE		4
endif

endif ;; _WIN32

if (_WIN32_IE GE 0x0400)
define TB_ADDBUTTONSA		(WM_USER + 20)
define TB_INSERTBUTTONA		(WM_USER + 21)
else
define TB_ADDBUTTONS		(WM_USER + 20)
define TB_INSERTBUTTON		(WM_USER + 21)
endif

define TB_DELETEBUTTON		(WM_USER + 22)
define TB_GETBUTTON		(WM_USER + 23)
define TB_BUTTONCOUNT		(WM_USER + 24)
define TB_COMMANDTOINDEX	(WM_USER + 25)

ifdef _WIN32

TBSAVEPARAMSA		STRUC
hkr			HKEY ?
pszSubKey		LPCSTR ?
pszValueName		LPCSTR ?
TBSAVEPARAMSA		ENDS
LPTBSAVEPARAMSA		typedef ptr TBSAVEPARAMSA

TBSAVEPARAMSW		STRUC
hkr			HKEY ?
pszSubKey		LPCWSTR ?
pszValueName		LPCWSTR ?
TBSAVEPARAMSW		ENDS
LPTBSAVEPARAMSW		typedef ptr TBSAVEPARAMSW

ifdef _UNICODE
TBSAVEPARAMS		typedef TBSAVEPARAMSW
LPTBSAVEPARAMS		typedef LPTBSAVEPARAMSW
else
TBSAVEPARAMS		typedef TBSAVEPARAMSA
LPTBSAVEPARAMS		typedef LPTBSAVEPARAMSA
endif

endif ;; _WIN32

define TB_SAVERESTOREA		(WM_USER + 26)
define TB_SAVERESTOREW		(WM_USER + 76)
define TB_CUSTOMIZE		(WM_USER + 27)
define TB_ADDSTRINGA		(WM_USER + 28)
define TB_ADDSTRINGW		(WM_USER + 77)
define TB_GETITEMRECT		(WM_USER + 29)
define TB_BUTTONSTRUCTSIZE	(WM_USER + 30)
define TB_SETBUTTONSIZE		(WM_USER + 31)
define TB_SETBITMAPSIZE		(WM_USER + 32)
define TB_AUTOSIZE		(WM_USER + 33)
define TB_GETTOOLTIPS		(WM_USER + 35)
define TB_SETTOOLTIPS		(WM_USER + 36)
define TB_SETPARENT		(WM_USER + 37)
define TB_SETROWS		(WM_USER + 39)
define TB_GETROWS		(WM_USER + 40)
define TB_SETCMDID		(WM_USER + 42)
define TB_CHANGEBITMAP		(WM_USER + 43)
define TB_GETBITMAP		(WM_USER + 44)
define TB_GETBUTTONTEXTA	(WM_USER + 45)
define TB_GETBUTTONTEXTW	(WM_USER + 75)
define TB_REPLACEBITMAP		(WM_USER + 46)
if (_WIN32_IE GE 0x0300)
define TB_SETINDENT		(WM_USER + 47)
define TB_SETIMAGELIST		(WM_USER + 48)
define TB_GETIMAGELIST		(WM_USER + 49)
define TB_LOADIMAGES		(WM_USER + 50)
define TB_GETRECT		(WM_USER + 51)
define TB_SETHOTIMAGELIST	(WM_USER + 52)
define TB_GETHOTIMAGELIST	(WM_USER + 53)
define TB_SETDISABLEDIMAGELIST	(WM_USER + 54)
define TB_GETDISABLEDIMAGELIST	(WM_USER + 55)
define TB_SETSTYLE		(WM_USER + 56)
define TB_GETSTYLE		(WM_USER + 57)
define TB_GETBUTTONSIZE		(WM_USER + 58)
define TB_SETBUTTONWIDTH	(WM_USER + 59)
define TB_SETMAXTEXTROWS	(WM_USER + 60)
define TB_GETTEXTROWS		(WM_USER + 61)
endif
ifdef _UNICODE
define TB_GETBUTTONTEXT		TB_GETBUTTONTEXTW
define TB_SAVERESTORE		TB_SAVERESTOREW
define TB_ADDSTRING		TB_ADDSTRINGW
else
define TB_GETBUTTONTEXT		TB_GETBUTTONTEXTA
define TB_SAVERESTORE		TB_SAVERESTOREA
define TB_ADDSTRING		TB_ADDSTRINGA
endif

if (_WIN32_IE GE 0x0400)
define TB_GETOBJECT		(WM_USER + 62)
define TB_GETHOTITEM		(WM_USER + 71)
define TB_SETHOTITEM		(WM_USER + 72)
define TB_SETANCHORHIGHLIGHT	(WM_USER + 73)
define TB_GETANCHORHIGHLIGHT	(WM_USER + 74)
define TB_MAPACCELERATORA	(WM_USER + 78)

TBINSERTMARK		STRUC
iButton			SINT ?
dwFlags			UINT ?
TBINSERTMARK		ENDS
LPTBINSERTMARK		typedef ptr TBINSERTMARK

define TBIMHT_AFTER		0x00000001
define TBIMHT_BACKGROUND	0x00000002

define TB_GETINSERTMARK		(WM_USER + 79)
define TB_SETINSERTMARK		(WM_USER + 80)
define TB_INSERTMARKHITTEST	(WM_USER + 81)
define TB_MOVEBUTTON		(WM_USER + 82)
define TB_GETMAXSIZE		(WM_USER + 83)
define TB_SETEXTENDEDSTYLE	(WM_USER + 84)
define TB_GETEXTENDEDSTYLE	(WM_USER + 85)
define TB_GETPADDING		(WM_USER + 86)
define TB_SETPADDING		(WM_USER + 87)
define TB_SETINSERTMARKCOLOR	(WM_USER + 88)
define TB_GETINSERTMARKCOLOR	(WM_USER + 89)

define TB_SETCOLORSCHEME	CCM_SETCOLORSCHEME
define TB_GETCOLORSCHEME	CCM_GETCOLORSCHEME

define TB_SETUNICODEFORMAT	CCM_SETUNICODEFORMAT
define TB_GETUNICODEFORMAT	CCM_GETUNICODEFORMAT

define TB_MAPACCELERATORW	(WM_USER + 90)
ifdef _UNICODE
define TB_MAPACCELERATOR	TB_MAPACCELERATORW
else
define TB_MAPACCELERATOR	TB_MAPACCELERATORA
endif

endif

TBREPLACEBITMAP		STRUC
hInstOld		HINSTANCE ?
nIDOld			UINT_PTR ?
hInstNew		HINSTANCE ?
nIDNew			UINT_PTR ?
nButtons		SINT ?
TBREPLACEBITMAP		ENDS
LPTBREPLACEBITMAP	typedef ptr TBREPLACEBITMAP

ifdef _WIN32

define TBBF_LARGE		0x0001

define TB_GETBITMAPFLAGS	(WM_USER + 41)

if (_WIN32_IE GE 0x0400)

define TBIF_IMAGE		0x00000001
define TBIF_TEXT		0x00000002
define TBIF_STATE		0x00000004
define TBIF_STYLE		0x00000008
define TBIF_LPARAM		0x00000010
define TBIF_COMMAND		0x00000020
define TBIF_SIZE		0x00000040

if (_WIN32_IE GE 0x0500)
define TBIF_BYINDEX		0x80000000
endif

TBBUTTONINFOA		STRUC
cbSize			UINT ?
dwMask			dd ?
idCommand		SINT ?
iImage			SINT ?
fsState			db ?
fsStyle			db ?
_cx			dw ?
lParam			dd ?
pszText			LPSTR ?
cchText			SINT ?
TBBUTTONINFOA		ENDS
LPTBBUTTONINFOA		typedef ptr TBBUTTONINFOA

TBBUTTONINFOW		STRUC
cbSize			UINT ?
dwMask			dd ?
idCommand		SINT ?
iImage			SINT ?
fsState			db ?
fsStyle			db ?
_cx			dw ?
lParam			dd ?
pszText			LPWSTR ?
cchText			SINT ?
TBBUTTONINFOW		ENDS
LPTBBUTTONINFOW		typedef ptr TBBUTTONINFOW

ifdef _UNICODE
TBBUTTONINFO		typedef TBBUTTONINFOW
LPTBBUTTONINFO		typedef LPTBBUTTONINFOW
else
TBBUTTONINFO		typedef TBBUTTONINFOA
LPTBBUTTONINFO		typedef LPTBBUTTONINFOA
endif

define TB_GETBUTTONINFOW	(WM_USER + 63)
define TB_SETBUTTONINFOW	(WM_USER + 64)
define TB_GETBUTTONINFOA	(WM_USER + 65)
define TB_SETBUTTONINFOA	(WM_USER + 66)
ifdef _UNICODE
define TB_GETBUTTONINFO		TB_GETBUTTONINFOW
define TB_SETBUTTONINFO		TB_SETBUTTONINFOW
else
define TB_GETBUTTONINFO		TB_GETBUTTONINFOA
define TB_SETBUTTONINFO		TB_SETBUTTONINFOA
endif

define TB_INSERTBUTTONW		(WM_USER + 67)
define TB_ADDBUTTONSW		(WM_USER + 68)
define TB_HITTEST		(WM_USER + 69)
ifdef _UNICODE
define TB_INSERTBUTTON		TB_INSERTBUTTONW
define TB_ADDBUTTONS		TB_ADDBUTTONSW
else
define TB_INSERTBUTTON		TB_INSERTBUTTONA
define TB_ADDBUTTONS		TB_ADDBUTTONSA
endif

define TB_SETDRAWTEXTFLAGS	(WM_USER + 70)

endif ;; (_WIN32_IE GE 0x0400)

if (_WIN32_IE GE 0x0500)

define TB_GETSTRINGW		(WM_USER + 91)
define TB_GETSTRINGA		(WM_USER + 92)
ifdef _UNICODE
define TB_GETSTRING		TB_GETSTRINGW
else
define TB_GETSTRING		TB_GETSTRINGA
endif
define TB_SETBOUNDINGSIZE	(WM_USER + 93)
define TB_SETHOTITEM2		(WM_USER + 94)
define TB_HASACCELERATOR	(WM_USER + 95)
define TB_SETLISTGAP		(WM_USER + 96)
define TB_GETIMAGELISTCOUNT	(WM_USER + 98)
define TB_GETIDEALSIZE		(WM_USER + 99)
define TB_TRANSLATEACCELERATOR	CCM_TRANSLATEACCELERATOR

endif ;; (_WIN32_IE GE 0x0500)

if (_WIN32_WINNT GE 0x0501)

define TBMF_PAD			0x00000001
define TBMF_BARPAD		0x00000002
define TBMF_BUTTONSPACING	0x00000004

TBMETRICS		STRUC
cbSize			UINT ?
dwMask			DWORD ?
cxPad			SINT ? ; PAD
cyPad			SINT ? ;
cxBarPad		SINT ? ; BARPAD
cyBarPad		SINT ? ;
cxButtonSpacing		SINT ? ; BUTTONSPACING
cyButtonSpacing		SINT ? ;
TBMETRICS		ENDS
LPTBMETRICS		typedef ptr TBMETRICS

define TB_GETMETRICS		(WM_USER + 101)
define TB_SETMETRICS		(WM_USER + 102)
endif

if (_WIN32_WINNT GE 0x600)
define TB_GETITEMDROPDOWNRECT	(WM_USER + 103)
define TB_SETPRESSEDIMAGELIST	(WM_USER + 104)
define TB_GETPRESSEDIMAGELIST	(WM_USER + 105)
endif

if (_WIN32_WINNT GE 0x0501)
define TB_SETWINDOWTHEME	CCM_SETWINDOWTHEME
endif

define TBN_GETBUTTONINFOA	(TBN_FIRST-0)
define TBN_BEGINDRAG		(TBN_FIRST-1)
define TBN_ENDDRAG		(TBN_FIRST-2)
define TBN_BEGINADJUST		(TBN_FIRST-3)
define TBN_ENDADJUST		(TBN_FIRST-4)
define TBN_RESET		(TBN_FIRST-5)
define TBN_QUERYINSERT		(TBN_FIRST-6)
define TBN_QUERYDELETE		(TBN_FIRST-7)
define TBN_TOOLBARCHANGE	(TBN_FIRST-8)
define TBN_CUSTHELP		(TBN_FIRST-9)
if (_WIN32_IE GE 0x0300)
define TBN_DROPDOWN		(TBN_FIRST - 10)
endif

if (_WIN32_IE GE 0x0400)

define TBN_GETOBJECT		(TBN_FIRST - 12)

NMTBHOTITEM		STRUC
hdr			NMHDR <>
idOld			SINT ?
idNew			SINT ?
dwFlags			dd ?
NMTBHOTITEM		ENDS
LPNMTBHOTITEM		typedef ptr NMTBHOTITEM

define HICF_OTHER		0x00000000
define HICF_MOUSE		0x00000001
define HICF_ARROWKEYS		0x00000002
define HICF_ACCELERATOR		0x00000004
define HICF_DUPACCEL		0x00000008
define HICF_ENTERING		0x00000010
define HICF_LEAVING		0x00000020
define HICF_RESELECT		0x00000040
define HICF_LMOUSE		0x00000080
define HICF_TOGGLEDROPDOWN	0x00000100

define TBN_HOTITEMCHANGE	(TBN_FIRST - 13)
define TBN_DRAGOUT		(TBN_FIRST - 14)
define TBN_DELETINGBUTTON	(TBN_FIRST - 15)
define TBN_GETDISPINFOA		(TBN_FIRST - 16)
define TBN_GETDISPINFOW		(TBN_FIRST - 17)
define TBN_GETINFOTIPA		(TBN_FIRST - 18)
define TBN_GETINFOTIPW		(TBN_FIRST - 19)
define TBN_GETBUTTONINFOW	(TBN_FIRST - 20)
if (_WIN32_IE GE 0x0500)
define TBN_RESTORE		(TBN_FIRST - 21)
define TBN_SAVE			(TBN_FIRST - 22)
define TBN_INITCUSTOMIZE	(TBN_FIRST - 23)
define TBNRF_HIDEHELP		0x00000001
define TBNRF_ENDCUSTOMIZE	0x00000002
define TBN_WRAPHOTITEM		(TBN_FIRST - 24)
define TBN_DUPACCELERATOR	(TBN_FIRST - 25)
define TBN_WRAPACCELERATOR	(TBN_FIRST - 26)
define TBN_DRAGOVER		(TBN_FIRST - 27)
define TBN_MAPACCELERATOR	(TBN_FIRST - 28)
endif

if (_WIN32_IE GE 0x0500)

NMTBSAVE		STRUC
hdr			NMHDR <>
pData			LPDWORD ?
pCurrent		LPDWORD ?
cbData			UINT ?
iItem			SINT ?
cButtons		SINT ?
tbButton		TBBUTTON <>
NMTBSAVE		ENDS
LPNMTBSAVE		typedef ptr NMTBSAVE

NMTBRESTORE		STRUC
hdr			NMHDR <>
pData			LPDWORD ?
pCurrent		LPDWORD ?
cbData			UINT ?
iItem			SINT ?
cButtons		SINT ?
cbBytesPerRecord	SINT ?
tbButton		TBBUTTON <>
NMTBRESTORE		ENDS
LPNMTBRESTORE		typedef ptr NMTBRESTORE
endif

NMTBGETINFOTIPA		STRUC
hdr			NMHDR <>
pszText			LPSTR ?
cchTextMax		SINT ?
iItem			SINT ?
lParam			LPARAM ?
NMTBGETINFOTIPA		ENDS
LPNMTBGETINFOTIPA	typedef ptr NMTBGETINFOTIPA

NMTBGETINFOTIPW		STRUC
hdr			NMHDR <>
pszText			LPWSTR ?
cchTextMax		SINT ?
iItem			SINT ?
lParam			LPARAM ?
NMTBGETINFOTIPW		ENDS
LPNMTBGETINFOTIPW	typedef ptr NMTBGETINFOTIPW

ifdef _UNICODE
define TBN_GETINFOTIP	TBN_GETINFOTIPW
NMTBGETINFOTIP		typedef NMTBGETINFOTIPW
LPNMTBGETINFOTIP	typedef LPNMTBGETINFOTIPW
else
define TBN_GETINFOTIP	TBN_GETINFOTIPA
NMTBGETINFOTIP		typedef NMTBGETINFOTIPA
LPNMTBGETINFOTIP	typedef LPNMTBGETINFOTIPA
endif

define TBNF_IMAGE	0x00000001
define TBNF_TEXT	0x00000002
define TBNF_DI_SETITEM	0x10000000

NMTBDISPINFOA		STRUC
hdr			NMHDR <>
dwMask			dd ?
idCommand		SINT ?
lParam			dd ?
iImage			SINT ?
pszText			LPSTR ?
cchText			SINT ?
NMTBDISPINFOA		ENDS
LPNMTBDISPINFOA		typedef ptr NMTBDISPINFOA

NMTBDISPINFOW		STRUC
hdr			NMHDR <>
dwMask			dd ?
idCommand		SINT ?
lParam			dd ?
iImage			SINT ?
pszText			LPWSTR ?
cchText			SINT ?
NMTBDISPINFOW		ENDS
LPNMTBDISPINFOW		typedef ptr NMTBDISPINFOW

ifdef _UNICODE
define TBN_GETDISPINFO	TBN_GETDISPINFOW
NMTBDISPINFO		typedef NMTBDISPINFOW
LPNMTBDISPINFO		typedef LPNMTBDISPINFOW
else
define TBN_GETDISPINFO	TBN_GETDISPINFOA
NMTBDISPINFO		typedef NMTBDISPINFOA
LPNMTBDISPINFO		typedef LPNMTBDISPINFOA
endif

define TBDDRET_DEFAULT		0
define TBDDRET_NODEFAULT	1
define TBDDRET_TREATPRESSED	2

endif ; (_WIN32_IE GE 0x0400)

ifdef _UNICODE
define TBN_GETBUTTONINFO	TBN_GETBUTTONINFOW
else
define TBN_GETBUTTONINFO	TBN_GETBUTTONINFOA
endif

if (_WIN32_IE GE 0x0300)
NMTOOLBARA		STRUC
hdr			NMHDR <>
iItem			SINT ?
tbButton		TBBUTTON <>
cchText			SINT ?
pszText			LPSTR ?
if (_WIN32_IE GE 0x500)
rcButton		RECT <>
endif
NMTOOLBARA		ENDS
LPNMTOOLBARA		typedef ptr NMTOOLBARA
endif

if (_WIN32_IE GE 0x0300)
NMTOOLBARW		STRUC
hdr			NMHDR <>
iItem			SINT ?
tbButton		TBBUTTON <>
cchText			SINT ?
pszText			LPWSTR ?
if (_WIN32_IE GE 0x500)
rcButton		RECT <>
endif
NMTOOLBARW		ENDS
LPNMTOOLBARW		typedef ptr NMTOOLBARW
endif

ifdef _UNICODE
NMTOOLBAR		typedef NMTOOLBARW
LPNMTOOLBAR		typedef LPNMTOOLBARW
else
NMTOOLBAR		typedef NMTOOLBARA
LPNMTOOLBAR		typedef LPNMTOOLBARA
endif
if (_WIN32_IE GE 0x0300)
TBNOTIFYA		typedef NMTOOLBARA
TBNOTIFYW		typedef NMTOOLBARW
LPTBNOTIFYA		typedef LPNMTOOLBARA
LPTBNOTIFYW		typedef LPNMTOOLBARW
else
NMTOOLBARA		typedef TBNOTIFYA
LPNMTOOLBARA		typedef LPTBNOTIFYA
NMTOOLBARW		typedef TBNOTIFYW
LPNMTOOLBARW		typedef LPTBNOTIFYW
endif
TBNOTIFY		typedef NMTOOLBAR
LPTBNOTIFY		typedef LPNMTOOLBAR

endif ;; _WIN32
endif ;; NOTOOLBAR

if (_WIN32_IE GE 0x0300)

ifndef NOREBAR

ifdef _WIN32
define REBARCLASSNAME	<"ReBarWindow32">
else
define REBARCLASSNAME	<"ReBarWindow">
endif

define RBIM_IMAGELIST		0x00000001

define RBS_TOOLTIPS		0x00000100
define RBS_VARHEIGHT		0x00000200
define RBS_BANDBORDERS		0x00000400
define RBS_FIXEDORDER		0x00000800
define RBS_REGISTERDROP		0x00001000
define RBS_AUTOSIZE		0x00002000
define RBS_VERTICALGRIPPER	0x00004000
define RBS_DBLCLKTOGGLE		0x00008000

REBARINFO		STRUC
cbSize			UINT ?
fMask			UINT ?
ifndef NOIMAGEAPIS
himl			HIMAGELIST ?
else
himl			HANDLE ?
endif
REBARINFO		ENDS
LPREBARINFO		typedef ptr REBARINFO

define RBBS_BREAK		0x00000001
define RBBS_FIXEDSIZE		0x00000002
define RBBS_CHILDEDGE		0x00000004
define RBBS_HIDDEN		0x00000008
define RBBS_NOVERT		0x00000010
define RBBS_FIXEDBMP		0x00000020
if (_WIN32_IE GE 0x0400)
define RBBS_VARIABLEHEIGHT	0x00000040
define RBBS_GRIPPERALWAYS	0x00000080
define RBBS_NOGRIPPER		0x00000100
if (_WIN32_IE GE 0x0500)
define RBBS_USECHEVRON		0x00000200
if (_WIN32_IE GE 0x0501)
define RBBS_HIDETITLE		0x00000400
define RBBS_TOPALIGN		0x00000800
endif
endif
endif

define RBBIM_STYLE		0x00000001
define RBBIM_COLORS		0x00000002
define RBBIM_TEXT		0x00000004
define RBBIM_IMAGE		0x00000008
define RBBIM_CHILD		0x00000010
define RBBIM_CHILDSIZE		0x00000020
define RBBIM_SIZE		0x00000040
define RBBIM_BACKGROUND		0x00000080
define RBBIM_ID			0x00000100
if (_WIN32_IE GE 0x0400)
define RBBIM_IDEALSIZE		0x00000200
define RBBIM_LPARAM		0x00000400
define RBBIM_HEADERSIZE		0x00000800
endif
if (NTDDI_VERSION ge NTDDI_VISTA)
define RBBIM_CHEVRONLOCATION	0x00001000
define RBBIM_CHEVRONSTATE	0x00002000
endif

REBARBANDINFOA		STRUC
cbSize			UINT ?
fMask			UINT ?
fStyle			UINT ?
clrFore			COLORREF ?
clrBack			COLORREF ?
lpText			LPSTR ?
cch			UINT ?
iImage			SINT ?
hwndChild		HWND ?
cxMinChild		UINT ?
cyMinChild		UINT ?
_cx			UINT ?
hbmBack			HBITMAP ?
wID			UINT ?
if (_WIN32_IE GE 0x0400)
cyChild			UINT ?
cyMaxChild		UINT ?
cyIntegral		UINT ?
cxIdeal			UINT ?
lParam			LPARAM ?
cxHeader		UINT ?
endif
if (NTDDI_VERSION ge NTDDI_VISTA)
rcChevronLocation	RECT <>
uChevronState		UINT ?
endif
REBARBANDINFOA		ENDS
LPREBARBANDINFOA	typedef ptr REBARBANDINFOA
LPCREBARBANDINFOA	typedef ptr REBARBANDINFOA

define REBARBANDINFOA_V3_SIZE CCSIZEOF_STRUCT(REBARBANDINFOA, wID)
define REBARBANDINFOA_V6_SIZE CCSIZEOF_STRUCT(REBARBANDINFOA, cxHeader)

REBARBANDINFOW		STRUC
cbSize			UINT ?
fMask			UINT ?
fStyle			UINT ?
clrFore			COLORREF ?
clrBack			COLORREF ?
lpText			LPWSTR ?
cch			UINT ?
iImage			SINT ?
hwndChild		HWND ?
cxMinChild		UINT ?
cyMinChild		UINT ?
_cx			UINT ?
hbmBack			HBITMAP ?
wID			UINT ?
if (_WIN32_IE GE 0x0400)
cyChild			UINT ?
cyMaxChild		UINT ?
cyIntegral		UINT ?
cxIdeal			UINT ?
lParam			LPARAM ?
cxHeader		UINT ?
endif
if (NTDDI_VERSION ge NTDDI_VISTA)
rcChevronLocation	RECT <>
uChevronState		UINT ?
endif
REBARBANDINFOW		ENDS
LPREBARBANDINFOW	typedef ptr REBARBANDINFOW
LPCREBARBANDINFOW	typedef ptr REBARBANDINFOW

define REBARBANDINFOW_V3_SIZE CCSIZEOF_STRUCT(REBARBANDINFOW, wID)
define REBARBANDINFOW_V6_SIZE CCSIZEOF_STRUCT(REBARBANDINFOW, cxHeader)

ifdef _UNICODE
REBARBANDINFO		typedef REBARBANDINFOW
LPREBARBANDINFO		typedef LPREBARBANDINFOW
LPCREBARBANDINFO	typedef LPCREBARBANDINFOW
define REBARBANDINFO_V3_SIZE	REBARBANDINFOW_V3_SIZE
else
REBARBANDINFO		typedef REBARBANDINFOA
LPREBARBANDINFO		typedef LPREBARBANDINFOA
LPCREBARBANDINFO	typedef LPCREBARBANDINFOA
define REBARBANDINFO_V3_SIZE	REBARBANDINFOA_V3_SIZE
endif

define RB_INSERTBANDA  (WM_USER + 1)
define RB_DELETEBAND   (WM_USER + 2)
define RB_GETBARINFO   (WM_USER + 3)
define RB_SETBARINFO   (WM_USER + 4)
if (_WIN32_IE LT 0x0400)
define RB_GETBANDINFO  (WM_USER + 5)
endif
define RB_SETBANDINFOA (WM_USER + 6)
define RB_SETPARENT    (WM_USER + 7)
if (_WIN32_IE GE 0x0400)
define RB_HITTEST      (WM_USER + 8)
define RB_GETRECT      (WM_USER + 9)
endif
define RB_INSERTBANDW  (WM_USER + 10)
define RB_SETBANDINFOW (WM_USER + 11)
define RB_GETBANDCOUNT (WM_USER + 12)
define RB_GETROWCOUNT  (WM_USER + 13)
define RB_GETROWHEIGHT (WM_USER + 14)
if (_WIN32_IE GE 0x0400)
define RB_IDTOINDEX    (WM_USER + 16)
define RB_GETTOOLTIPS  (WM_USER + 17)
define RB_SETTOOLTIPS  (WM_USER + 18)
define RB_SETBKCOLOR   (WM_USER + 19)
define RB_GETBKCOLOR   (WM_USER + 20)
define RB_SETTEXTCOLOR (WM_USER + 21)
define RB_GETTEXTCOLOR (WM_USER + 22)
if (_WIN32_WINNT GE 0x0501)
define RBSTR_CHANGERECT 0x0001
endif
define RB_SIZETORECT   (WM_USER + 23)
endif

define RB_SETCOLORSCHEME CCM_SETCOLORSCHEME
define RB_GETCOLORSCHEME CCM_GETCOLORSCHEME

ifdef _UNICODE
define RB_INSERTBAND	RB_INSERTBANDW
define RB_SETBANDINFO	RB_SETBANDINFOW
else
define RB_INSERTBAND	RB_INSERTBANDA
define RB_SETBANDINFO	RB_SETBANDINFOA
endif

if (_WIN32_IE GE 0x0400)

define RB_BEGINDRAG	(WM_USER + 24)
define RB_ENDDRAG	(WM_USER + 25)
define RB_DRAGMOVE	(WM_USER + 26)
define RB_GETBARHEIGHT	(WM_USER + 27)
define RB_GETBANDINFOW	(WM_USER + 28)
define RB_GETBANDINFOA	(WM_USER + 29)

ifdef _UNICODE
define RB_GETBANDINFO	RB_GETBANDINFOW
else
define RB_GETBANDINFO	RB_GETBANDINFOA
endif

define RB_MINIMIZEBAND	(WM_USER + 30)
define RB_MAXIMIZEBAND	(WM_USER + 31)

define RB_GETDROPTARGET (CCM_GETDROPTARGET)

define RB_GETBANDBORDERS (WM_USER + 34)

define RB_SHOWBAND	(WM_USER + 35)
define RB_SETPALETTE	(WM_USER + 37)
define RB_GETPALETTE	(WM_USER + 38)
define RB_MOVEBAND	(WM_USER + 39)

define RB_SETUNICODEFORMAT CCM_SETUNICODEFORMAT
define RB_GETUNICODEFORMAT CCM_GETUNICODEFORMAT

endif

if (_WIN32_WINNT GE 0x0501)
define RB_GETBANDMARGINS	(WM_USER + 40)
define RB_SETWINDOWTHEME	CCM_SETWINDOWTHEME
endif
if (_WIN32_IE GE 0x0600)
define RB_SETEXTENDEDSTYLE	(WM_USER + 41)
define RB_GETEXTENDEDSTYLE	(WM_USER + 42)
endif
if (_WIN32_IE GE 0x0500)
define RB_PUSHCHEVRON		(WM_USER + 43)
endif
if (_WIN32_WINNT GE 0x0600)
define RB_SETBANDWIDTH		(WM_USER + 44)
endif

define RBN_HEIGHTCHANGE		(RBN_FIRST - 0)

if (_WIN32_IE GE 0x0400)
define RBN_GETOBJECT		(RBN_FIRST - 1)
define RBN_LAYOUTCHANGED	(RBN_FIRST - 2)
define RBN_AUTOSIZE		(RBN_FIRST - 3)
define RBN_BEGINDRAG		(RBN_FIRST - 4)
define RBN_ENDDRAG		(RBN_FIRST - 5)
define RBN_DELETINGBAND		(RBN_FIRST - 6)
define RBN_DELETEDBAND		(RBN_FIRST - 7)
define RBN_CHILDSIZE		(RBN_FIRST - 8)
if (_WIN32_IE GE 0x0500)
define RBN_CHEVRONPUSHED	(RBN_FIRST - 10)
endif
if (_WIN32_IE GE 0x0600)
define RBN_SPLITTERDRAG		(RBN_FIRST - 11)
endif
if (_WIN32_IE GE 0x0500)
define RBN_MINMAX		(RBN_FIRST - 21)
endif
if (_WIN32_WINNT GE 0x0501)
define RBN_AUTOBREAK		(RBN_FIRST - 22)
endif

NMREBARCHILDSIZE	STRUC
hdr			NMHDR <>
uBand			UINT ?
wID			UINT ?
rcChild			RECT <>
rcBand			RECT <>
NMREBARCHILDSIZE	ENDS
LPNMREBARCHILDSIZE	typedef ptr NMREBARCHILDSIZE

NMREBAR			STRUC
hdr			NMHDR <>
dwMask			dd ?
uBand			UINT ?
fStyle			UINT ?
wID			UINT ?
lParam			LPARAM ?
NMREBAR			ENDS
LPNMREBAR		typedef ptr NMREBAR

define RBNM_ID		0x00000001
define RBNM_STYLE	0x00000002
define RBNM_LPARAM	0x00000004

NMRBAUTOSIZE		STRUC
hdr			NMHDR <>
fChanged		BOOL ?
rcTarget		RECT <>
rcActual		RECT <>
NMRBAUTOSIZE		ENDS
LPNMRBAUTOSIZE		typedef ptr NMRBAUTOSIZE

if (_WIN32_IE GE 0x0500)
NMREBARCHEVRON		STRUC
hdr			NMHDR <>
uBand			UINT ?
wID			UINT ?
lParam			LPARAM ?
rc			RECT <>
lParamNM		LPARAM ?
NMREBARCHEVRON		ENDS
LPNMREBARCHEVRON	typedef ptr NMREBARCHEVRON
endif

if (_WIN32_IE GE 0x0600)
NMREBARSPLITTER		STRUC
hdr			NMHDR <>
rcSizing		RECT <>
NMREBARSPLITTER		ENDS
LPNMREBARSPLITTER	typedef ptr NMREBARSPLITTER
endif

if (_WIN32_WINNT GE 0x0501)
define RBAB_AUTOSIZE	0x0001
define RBAB_ADDBAND	0x0002

NMREBARAUTOBREAK	STRUC
hdr			NMHDR <>
uBand			UINT ?
wID			UINT ?
lParam			LPARAM ?
uMsg			UINT ?
fStyleCurrent		UINT ?
fAutoBreak		BOOL ?
NMREBARAUTOBREAK	ENDS
LPNMREBARAUTOBREAK	typedef ptr NMREBARAUTOBREAK
endif

define RBHT_NOWHERE	0x0001
define RBHT_CAPTION	0x0002
define RBHT_CLIENT	0x0003
define RBHT_GRABBER	0x0004
if (_WIN32_IE GE 0x0500)
define RBHT_CHEVRON	0x0008
endif
if (_WIN32_IE GE 0x0600)
define RBHT_SPLITTER	0x0010
endif

RBHITTESTINFO		STRUC
pt			POINT <>
flags			UINT ?
iBand			SINT ?
RBHITTESTINFO		ENDS
LPRBHITTESTINFO		typedef ptr RBHITTESTINFO

endif ;; _WIN32_IE >= 0x0400
endif ;; NOREBAR
endif ;; _WIN32_IE >= 0x0300

ifndef NOTOOLTIPS

ifdef _WIN32
define TOOLTIPS_CLASS	<"tooltips_class32">
else
define TOOLTIPS_CLASS	<"tooltips_class">
endif

TTTOOLINFOA		STRUC
cbSize			UINT ?
uFlags			UINT ?
hwnd			HWND ?
uId			UINT_PTR ?
rect			RECT <>
hinst			HINSTANCE ?
lpszText		LPSTR ?
if (_WIN32_IE GE 0x0300)
lParam			LPARAM ?
endif
if (_WIN32_WINNT GE 0x0501)
lpReserved		PVOID ?
endif
TTTOOLINFOA		ENDS
PTOOLINFOA		typedef ptr TTTOOLINFOA
LPTTTOOLINFOA		typedef ptr TTTOOLINFOA

TTTOOLINFOW		STRUC
cbSize			UINT ?
uFlags			UINT ?
hwnd			HWND ?
uId			UINT_PTR ?
rect			RECT <>
hinst			HINSTANCE ?
lpszText		LPWSTR ?
if (_WIN32_IE GE 0x0300)
lParam			LPARAM ?
endif
if (_WIN32_WINNT GE 0x0501)
lpReserved		PVOID ?
endif
TTTOOLINFOW		ENDS
PTOOLINFOW		typedef ptr TTTOOLINFOW
LPTTTOOLINFOW		typedef ptr TTTOOLINFOW

define TTTOOLINFOA_V1_SIZE CCSIZEOF_STRUCT(TTTOOLINFOA, lpszText)
define TTTOOLINFOW_V1_SIZE CCSIZEOF_STRUCT(TTTOOLINFOW, lpszText)
define TTTOOLINFOA_V2_SIZE CCSIZEOF_STRUCT(TTTOOLINFOA, lParam)
define TTTOOLINFOW_V2_SIZE CCSIZEOF_STRUCT(TTTOOLINFOW, lParam)
define TTTOOLINFOA_V3_SIZE CCSIZEOF_STRUCT(TTTOOLINFOA, lpReserved)
define TTTOOLINFOW_V3_SIZE CCSIZEOF_STRUCT(TTTOOLINFOW, lpReserved)

ifdef _UNICODE
TTTOOLINFO		typedef TTTOOLINFOW
PTOOLINFO		typedef PTOOLINFOW
LPTTTOOLINFO		typedef LPTTTOOLINFOW
define TTTOOLINFO_V1_SIZE TTTOOLINFOW_V1_SIZE
else
PTOOLINFO		typedef PTOOLINFOA
TTTOOLINFO		typedef TTTOOLINFOA
LPTTTOOLINFO		typedef LPTTTOOLINFOA
define TTTOOLINFO_V1_SIZE TTTOOLINFOA_V1_SIZE
endif
LPTOOLINFO		typedef LPTTTOOLINFO
TOOLINFO		typedef TTTOOLINFO

if (_WIN32_IE GE 0x0300)
LPTOOLINFOA		typedef LPTTTOOLINFOA
LPTOOLINFOW		typedef LPTTTOOLINFOW
TOOLINFOA		typedef TTTOOLINFOA
TOOLINFOW		typedef TTTOOLINFOW
else
TTTOOLINFOA		typedef TOOLINFOA
LPTTTOOLINFOA		typedef LPTOOLINFOA
TTTOOLINFOW		typedef TOOLINFOW
LPTTTOOLINFOW		typedef LPTOOLINFOW
endif

define TTS_ALWAYSTIP		0x01
define TTS_NOPREFIX		0x02
if (_WIN32_IE GE 0x0500)
define TTS_NOANIMATE		0x10
define TTS_NOFADE		0x20
define TTS_BALLOON		0x40
define TTS_CLOSE		0x80
endif
if _WIN32_WINNT GE 0x0600
define TTS_USEVISUALSTYLE	0x100
endif

define TTF_IDISHWND		0x0001
define TTF_CENTERTIP		0x0002
define TTF_RTLREADING		0x0004
define TTF_SUBCLASS		0x0010
if (_WIN32_IE GE 0x0300)
define TTF_TRACK		0x0020
define TTF_ABSOLUTE		0x0080
define TTF_TRANSPARENT		0x0100
if (_WIN32_IE GE 0x0501)
define TTF_PARSELINKS		0x1000
endif
define TTF_DI_SETITEM		0x8000
endif

define TTDT_AUTOMATIC		0
define TTDT_RESHOW		1
define TTDT_AUTOPOP		2
define TTDT_INITIAL		3

define TTI_NONE			0
define TTI_INFO			1
define TTI_WARNING		2
define TTI_ERROR		3
if (NTDDI_VERSION ge NTDDI_VISTA)
define TTI_INFO_LARGE		4
define TTI_WARNING_LARGE	5
define TTI_ERROR_LARGE		6
endif

define TTM_ACTIVATE		(WM_USER + 1)
define TTM_SETDELAYTIME		(WM_USER + 3)
define TTM_ADDTOOLA		(WM_USER + 4)
define TTM_ADDTOOLW		(WM_USER + 50)
define TTM_DELTOOLA		(WM_USER + 5)
define TTM_DELTOOLW		(WM_USER + 51)
define TTM_NEWTOOLRECTA		(WM_USER + 6)
define TTM_NEWTOOLRECTW		(WM_USER + 52)
define TTM_RELAYEVENT		(WM_USER + 7)

define TTM_GETTOOLINFOA		(WM_USER + 8)
define TTM_GETTOOLINFOW		(WM_USER + 53)

define TTM_SETTOOLINFOA		(WM_USER + 9)
define TTM_SETTOOLINFOW		(WM_USER + 54)

define TTM_HITTESTA		(WM_USER + 10)
define TTM_HITTESTW		(WM_USER + 55)
define TTM_GETTEXTA		(WM_USER + 11)
define TTM_GETTEXTW		(WM_USER + 56)
define TTM_UPDATETIPTEXTA	(WM_USER + 12)
define TTM_UPDATETIPTEXTW	(WM_USER + 57)
define TTM_GETTOOLCOUNT		(WM_USER + 13)
define TTM_ENUMTOOLSA		(WM_USER + 14)
define TTM_ENUMTOOLSW		(WM_USER + 58)
define TTM_GETCURRENTTOOLA	(WM_USER + 15)
define TTM_GETCURRENTTOOLW	(WM_USER + 59)
define TTM_WINDOWFROMPOINT	(WM_USER + 16)
if (_WIN32_IE GE 0x0300)
define TTM_TRACKACTIVATE	(WM_USER + 17)
define TTM_TRACKPOSITION	(WM_USER + 18)
define TTM_SETTIPBKCOLOR	(WM_USER + 19)
define TTM_SETTIPTEXTCOLOR	(WM_USER + 20)
define TTM_GETDELAYTIME		(WM_USER + 21)
define TTM_GETTIPBKCOLOR	(WM_USER + 22)
define TTM_GETTIPTEXTCOLOR	(WM_USER + 23)
define TTM_SETMAXTIPWIDTH	(WM_USER + 24)
define TTM_GETMAXTIPWIDTH	(WM_USER + 25)
define TTM_SETMARGIN		(WM_USER + 26)
define TTM_GETMARGIN		(WM_USER + 27)
define TTM_POP			(WM_USER + 28)
endif
if (_WIN32_IE GE 0x0400)
define TTM_UPDATE		(WM_USER + 29)
endif
if (_WIN32_IE GE 0x0500)
define TTM_GETBUBBLESIZE	(WM_USER + 30)
define TTM_ADJUSTRECT		(WM_USER + 31)
define TTM_SETTITLEA		(WM_USER + 32)
define TTM_SETTITLEW		(WM_USER + 33)
endif

if (_WIN32_WINNT GE 0x0501)
define TTM_POPUP		(WM_USER + 34)
define TTM_GETTITLE		(WM_USER + 35)

TTGETTITLE		STRUC
dwSize			DWORD ?
uTitleBitmap		UINT ?
cch			UINT ?
pszTitle		LPWORD ?
TTGETTITLE		ENDS
PTTGETTITLE		typedef ptr TTGETTITLE
endif

ifdef _UNICODE
define TTM_ADDTOOL		TTM_ADDTOOLW
define TTM_DELTOOL		TTM_DELTOOLW
define TTM_NEWTOOLRECT		TTM_NEWTOOLRECTW
define TTM_GETTOOLINFO		TTM_GETTOOLINFOW
define TTM_SETTOOLINFO		TTM_SETTOOLINFOW
define TTM_HITTEST		TTM_HITTESTW
define TTM_GETTEXT		TTM_GETTEXTW
define TTM_UPDATETIPTEXT	TTM_UPDATETIPTEXTW
define TTM_ENUMTOOLS		TTM_ENUMTOOLSW
define TTM_GETCURRENTTOOL	TTM_GETCURRENTTOOLW
if (_WIN32_IE GE 0x0500)
define TTM_SETTITLE		TTM_SETTITLEW
endif
else
define TTM_ADDTOOL		TTM_ADDTOOLA
define TTM_DELTOOL		TTM_DELTOOLA
define TTM_NEWTOOLRECT		TTM_NEWTOOLRECTA
define TTM_GETTOOLINFO		TTM_GETTOOLINFOA
define TTM_SETTOOLINFO		TTM_SETTOOLINFOA
define TTM_HITTEST		TTM_HITTESTA
define TTM_GETTEXT		TTM_GETTEXTA
define TTM_UPDATETIPTEXT	TTM_UPDATETIPTEXTA
define TTM_ENUMTOOLS		TTM_ENUMTOOLSA
define TTM_GETCURRENTTOOL	TTM_GETCURRENTTOOLA
if (_WIN32_IE GE 0x0500)
define TTM_SETTITLE		TTM_SETTITLEA
endif
endif
if (_WIN32_WINNT GE 0x0501)
define TTM_SETWINDOWTHEME	CCM_SETWINDOWTHEME
endif

TTHITTESTINFOA		STRUC
hwnd			HWND ?
pt			POINT <>
ti			TTTOOLINFOA <>
TTHITTESTINFOA		ENDS
LPTTHITTESTINFOA	typedef ptr TTHITTESTINFOA

TTHITTESTINFOW		STRUC
hwnd			HWND ?
pt			POINT <>
ti			TTTOOLINFOW <>
TTHITTESTINFOW		ENDS
LPTTHITTESTINFOW	typedef ptr TTHITTESTINFOW

ifdef _UNICODE
TTHITTESTINFO		typedef TTHITTESTINFOW
LPTTHITTESTINFO		typedef LPTTHITTESTINFOW
else
TTHITTESTINFO		typedef TTHITTESTINFOA
LPTTHITTESTINFO		typedef LPTTHITTESTINFOA
endif
if (_WIN32_IE GE 0x0300)
LPHITTESTINFOW		typedef LPTTHITTESTINFOW
LPHITTESTINFOA		typedef LPTTHITTESTINFOA
else
LPTTHITTESTINFOA	typedef LPHITTESTINFOA
LPTTHITTESTINFOW	typedef LPHITTESTINFOW
endif
LPHITTESTINFO		typedef LPTTHITTESTINFO

define TTN_GETDISPINFOA		(TTN_FIRST - 0)
define TTN_GETDISPINFOW		(TTN_FIRST - 10)
define TTN_SHOW			(TTN_FIRST - 1)
define TTN_POP			(TTN_FIRST - 2)
define TTN_LINKCLICK		(TTN_FIRST - 3)
ifdef _UNICODE
define TTN_GETDISPINFO		TTN_GETDISPINFOW
else
define TTN_GETDISPINFO		TTN_GETDISPINFOA
endif
define TTN_NEEDTEXT		TTN_GETDISPINFO
define TTN_NEEDTEXTA		TTN_GETDISPINFOA
define TTN_NEEDTEXTW		TTN_GETDISPINFOW

NMTTDISPINFOA		STRUC
hdr			NMHDR <>
lpszText		LPSTR ?
szText			sbyte 80 dup(?)
hinst			HINSTANCE ?
uFlags			UINT ?
if (_WIN32_IE GE 0x0300)
lParam			LPARAM ?
endif
NMTTDISPINFOA		ENDS
LPNMTTDISPINFOA		typedef ptr NMTTDISPINFOA

NMTTDISPINFOW		STRUC
hdr			NMHDR <>
lpszText		LPWSTR ?
szText			dw 80 dup(?)
hinst			HINSTANCE ?
uFlags			UINT ?
if (_WIN32_IE GE 0x0300)
lParam			LPARAM ?
endif
NMTTDISPINFOW		ENDS
LPNMTTDISPINFOW		typedef ptr NMTTDISPINFOW

if (_WIN32_IE GE 0x0300)
TOOLTIPTEXTW		typedef NMTTDISPINFOW
TOOLTIPTEXTA		typedef NMTTDISPINFOA
LPTOOLTIPTEXTA		typedef LPNMTTDISPINFOA
LPTOOLTIPTEXTW		typedef LPNMTTDISPINFOW
else
NMTTDISPINFOA		typedef TOOLTIPTEXTA
NMTTDISPINFOW		typedef TOOLTIPTEXTW
LPNMTTDISPINFOA		typedef LPTOOLTIPTEXTA
LPNMTTDISPINFOW		typedef LPTOOLTIPTEXTW
endif

define NMTTDISPINFOA_V1_SIZE CCSIZEOF_STRUCT(NMTTDISPINFOA, uFlags)
define NMTTDISPINFOW_V1_SIZE CCSIZEOF_STRUCT(NMTTDISPINFOW, uFlags)

ifdef _UNICODE
NMTTDISPINFO		typedef NMTTDISPINFOW
LPNMTTDISPINFO		typedef LPNMTTDISPINFOW
define NMTTDISPINFO_V1_SIZE NMTTDISPINFOW_V1_SIZE
else
NMTTDISPINFO		typedef NMTTDISPINFOA
LPNMTTDISPINFO		typedef LPNMTTDISPINFOA
define NMTTDISPINFO_V1_SIZE NMTTDISPINFOA_V1_SIZE
endif
TOOLTIPTEXT		typedef NMTTDISPINFO
LPTOOLTIPTEXT		typedef LPNMTTDISPINFO

endif

ifndef NOSTATUSBAR

define SBARS_SIZEGRIP		0x0100
if (_WIN32_IE GE 0x0500)
define SBARS_TOOLTIPS		0x0800
endif
if (_WIN32_IE GE 0x0400)
define SBT_TOOLTIPS		0x0800
endif

DrawStatusTextA proto WINAPI :HDC, :LPCRECT, :LPCSTR, :UINT
DrawStatusTextW proto WINAPI :HDC, :LPCRECT, :LPCWSTR, :UINT

CreateStatusWindowA proto WINAPI :LONG, :LPCSTR, :HWND, :UINT
CreateStatusWindowW proto WINAPI :LONG, :LPCWSTR, :HWND, :UINT

ifdef _UNICODE
define CreateStatusWindow	<CreateStatusWindowW>
define DrawStatusText		<DrawStatusTextW>
else
define CreateStatusWindow	<CreateStatusWindowA>
define DrawStatusText		<DrawStatusTextA>
endif

ifdef _WIN32
define STATUSCLASSNAME		<"msctls_statusbar32">
else
define STATUSCLASSNAME		<"msctls_statusbar">
endif

define SB_SETTEXTA		(WM_USER+1)
define SB_SETTEXTW		(WM_USER+11)
define SB_GETTEXTA		(WM_USER+2)
define SB_GETTEXTW		(WM_USER+13)
define SB_GETTEXTLENGTHA	(WM_USER+3)
define SB_GETTEXTLENGTHW	(WM_USER+12)

ifdef _UNICODE
define SB_GETTEXT		SB_GETTEXTW
define SB_SETTEXT		SB_SETTEXTW
define SB_GETTEXTLENGTH		SB_GETTEXTLENGTHW
if (_WIN32_IE GE 0x0400)
define SB_SETTIPTEXT		SB_SETTIPTEXTW
define SB_GETTIPTEXT		SB_GETTIPTEXTW
endif
else
define SB_GETTEXT		SB_GETTEXTA
define SB_SETTEXT		SB_SETTEXTA
define SB_GETTEXTLENGTH		SB_GETTEXTLENGTHA
if (_WIN32_IE GE 0x0400)
define SB_SETTIPTEXT		SB_SETTIPTEXTA
define SB_GETTIPTEXT		SB_GETTIPTEXTA
endif
endif ;; _UNICODE

define SB_SETPARTS		(WM_USER+4)
define SB_GETPARTS		(WM_USER+6)
define SB_GETBORDERS		(WM_USER+7)
define SB_SETMINHEIGHT		(WM_USER+8)
define SB_SIMPLE		(WM_USER+9)
define SB_GETRECT		(WM_USER+10)
if (_WIN32_IE GE 0x0300)
define SB_ISSIMPLE		(WM_USER+14)
endif
if (_WIN32_IE GE 0x0400)
define SB_SETICON		(WM_USER+15)
define SB_SETTIPTEXTA		(WM_USER+16)
define SB_SETTIPTEXTW		(WM_USER+17)
define SB_GETTIPTEXTA		(WM_USER+18)
define SB_GETTIPTEXTW		(WM_USER+19)
define SB_GETICON		(WM_USER+20)
define SB_SETUNICODEFORMAT	CCM_SETUNICODEFORMAT
define SB_GETUNICODEFORMAT	CCM_GETUNICODEFORMAT
endif

define SBT_OWNERDRAW		0x1000
define SBT_NOBORDERS		0x0100
define SBT_POPOUT		0x0200
define SBT_RTLREADING		0x0400
if (_WIN32_IE GE 0x0400)
define SBT_NOTABPARSING		0x0800
endif
define SB_SETBKCOLOR		CCM_SETBKCOLOR

if (_WIN32_IE GE 0x0400)
define SBN_SIMPLEMODECHANGE	(SBN_FIRST - 0)
endif
if (_WIN32_IE GE 0x0500)
define SB_SIMPLEID		0x00ff
endif

endif ;; NOSTATUSBAR

ifndef NOMENUHELP

MenuHelp proto WINAPI :UINT, :WPARAM, :LPARAM, :HMENU, :HINSTANCE, :HWND, :ptr
ShowHideMenuCtl proto WINAPI :HWND, :UINT_PTR, :LPINT
GetEffectiveClientRect proto WINAPI :HWND, :LPRECT, :ptr

define MINSYSCOMMAND   SC_SIZE
endif

ifndef NOTRACKBAR

ifdef _WIN32
define TRACKBAR_CLASS	<"msctls_trackbar32">
else
define TRACKBAR_CLASS	<"msctls_trackbar">
endif

define TBS_AUTOTICKS		0x0001
define TBS_VERT			0x0002
define TBS_HORZ			0x0000
define TBS_TOP			0x0004
define TBS_BOTTOM		0x0000
define TBS_LEFT			0x0004
define TBS_RIGHT		0x0000
define TBS_BOTH			0x0008
define TBS_NOTICKS		0x0010
define TBS_ENABLESELRANGE	0x0020
define TBS_FIXEDLENGTH		0x0040
define TBS_NOTHUMB		0x0080
if (_WIN32_IE GE 0x0300)
define TBS_TOOLTIPS		0x0100
endif
if (_WIN32_IE GE 0x0500)
define TBS_REVERSED		0x0200
endif
if (_WIN32_IE GE 0x0501)
define TBS_DOWNISLEFT		0x0400
endif
if (_WIN32_IE GE 0x0600)
define TBS_NOTIFYBEFOREMOVE	0x0800
endif
if (NTDDI_VERSION GE NTDDI_VISTA)
define TBS_TRANSPARENTBKGND	0x1000
endif

define TBM_GETPOS		(WM_USER)
define TBM_GETRANGEMIN		(WM_USER+1)
define TBM_GETRANGEMAX		(WM_USER+2)
define TBM_GETTIC		(WM_USER+3)
define TBM_SETTIC		(WM_USER+4)
define TBM_SETPOS		(WM_USER+5)
define TBM_SETRANGE		(WM_USER+6)
define TBM_SETRANGEMIN		(WM_USER+7)
define TBM_SETRANGEMAX		(WM_USER+8)
define TBM_CLEARTICS		(WM_USER+9)
define TBM_SETSEL		(WM_USER+10)
define TBM_SETSELSTART		(WM_USER+11)
define TBM_SETSELEND		(WM_USER+12)
define TBM_GETPTICS		(WM_USER+14)
define TBM_GETTICPOS		(WM_USER+15)
define TBM_GETNUMTICS		(WM_USER+16)
define TBM_GETSELSTART		(WM_USER+17)
define TBM_GETSELEND		(WM_USER+18)
define TBM_CLEARSEL		(WM_USER+19)
define TBM_SETTICFREQ		(WM_USER+20)
define TBM_SETPAGESIZE		(WM_USER+21)
define TBM_GETPAGESIZE		(WM_USER+22)
define TBM_SETLINESIZE		(WM_USER+23)
define TBM_GETLINESIZE		(WM_USER+24)
define TBM_GETTHUMBRECT		(WM_USER+25)
define TBM_GETCHANNELRECT	(WM_USER+26)
define TBM_SETTHUMBLENGTH	(WM_USER+27)
define TBM_GETTHUMBLENGTH	(WM_USER+28)
if (_WIN32_IE GE 0x0300)
define TBM_SETTOOLTIPS		(WM_USER+29)
define TBM_GETTOOLTIPS		(WM_USER+30)
define TBM_SETTIPSIDE		(WM_USER+31)
define TBTS_TOP			0
define TBTS_LEFT		1
define TBTS_BOTTOM		2
define TBTS_RIGHT		3

define TBM_SETBUDDY		(WM_USER+32)
define TBM_GETBUDDY		(WM_USER+33)
define TBM_SETPOSNOTIFY		(WM_USER+34)
endif
if (_WIN32_IE GE 0x0400)
define TBM_SETUNICODEFORMAT	CCM_SETUNICODEFORMAT
define TBM_GETUNICODEFORMAT	CCM_GETUNICODEFORMAT
endif

define TB_LINEUP		0
define TB_LINEDOWN		1
define TB_PAGEUP		2
define TB_PAGEDOWN		3
define TB_THUMBPOSITION		4
define TB_THUMBTRACK		5
define TB_TOP			6
define TB_BOTTOM		7
define TB_ENDTRACK		8

if (_WIN32_IE GE 0x0300)
define TBCD_TICS		0x0001
define TBCD_THUMB		0x0002
define TBCD_CHANNEL		0x0003
endif
if (_WIN32_WINNT GE 0x0600)
define TRBN_THUMBPOSCHANGING	(TRBN_FIRST-1)

NMTRBTHUMBPOSCHANGING	STRUC
hdr			NMHDR <>
dwPos			DWORD ?
nReason			SINT ?
NMTRBTHUMBPOSCHANGING	ENDS
endif

endif ;; NOTRACKBAR

ifndef NODRAGLIST

DRAGLISTINFO		STRUC
uNotification		UINT ?
hWnd			HWND ?
ptCursor		POINT <>
DRAGLISTINFO		ENDS
LPDRAGLISTINFO		typedef ptr DRAGLISTINFO

define DL_BEGINDRAG	(WM_USER+133)
define DL_DRAGGING	(WM_USER+134)
define DL_DROPPED	(WM_USER+135)
define DL_CANCELDRAG	(WM_USER+136)

define DL_CURSORSET	0
define DL_STOPCURSOR	1
define DL_COPYCURSOR	2
define DL_MOVECURSOR	3

define DRAGLISTMSGSTRING <"commctrl_DragListMsg">

MakeDragList proto WINAPI :HWND
DrawInsert proto WINAPI :HWND, :HWND, :sdword
LBItemFromPt proto WINAPI :HWND, :POINT, :BOOL
endif

ifndef NOUPDOWN

ifdef _WIN32
define UPDOWN_CLASS	<"msctls_updown32">
else
define UPDOWN_CLASS	<"msctls_updown">
endif

UDACCEL			STRUC
nSec			UINT ?
nInc			UINT ?
UDACCEL			ENDS
LPUDACCEL		typedef ptr UDACCEL

define UD_MAXVAL		0x7fff
define UD_MINVAL		(-UD_MAXVAL)

define UDS_WRAP			0x0001
define UDS_SETBUDDYINT		0x0002
define UDS_ALIGNRIGHT		0x0004
define UDS_ALIGNLEFT		0x0008
define UDS_AUTOBUDDY		0x0010
define UDS_ARROWKEYS		0x0020
define UDS_HORZ			0x0040
define UDS_NOTHOUSANDS		0x0080
if (_WIN32_IE GE 0x0300)
define UDS_HOTTRACK		0x0100
endif

define UDM_SETRANGE		(WM_USER+101)
define UDM_GETRANGE		(WM_USER+102)
define UDM_SETPOS		(WM_USER+103)
define UDM_GETPOS		(WM_USER+104)
define UDM_SETBUDDY		(WM_USER+105)
define UDM_GETBUDDY		(WM_USER+106)
define UDM_SETACCEL		(WM_USER+107)
define UDM_GETACCEL		(WM_USER+108)
define UDM_SETBASE		(WM_USER+109)
define UDM_GETBASE		(WM_USER+110)
if (_WIN32_IE GE 0x0400)
define UDM_SETRANGE32		(WM_USER+111)
define UDM_GETRANGE32		(WM_USER+112)
define UDM_SETUNICODEFORMAT	CCM_SETUNICODEFORMAT
define UDM_GETUNICODEFORMAT	CCM_GETUNICODEFORMAT
endif
if (_WIN32_IE GE 0x0500)
define UDM_SETPOS32		(WM_USER+113)
define UDM_GETPOS32		(WM_USER+114)
endif

CreateUpDownControl proto WINAPI :DWORD, :sdword, :sdword, :sdword, :sdword, :HWND, :sdword, :HINSTANCE, :HWND, :sdword, :sdword, :sdword

NMUPDOWN		STRUC
hdr			NMHDR <>
iPos			SINT ?
iDelta			SINT ?
NMUPDOWN		ENDS
LPNMUPDOWN		typedef ptr NMUPDOWN

if (_WIN32_IE GE 0x0300)
NM_UPDOWN		typedef NMUPDOWN
LPNM_UPDOWN		typedef LPNMUPDOWN
else
NMUPDOWN		typedef NM_UPDOWN
LPNMUPDOWN		typedef LPNM_UPDOWN
endif

define UDN_DELTAPOS	(UDN_FIRST - 1)

endif ;; NOUPDOWN

ifndef NOPROGRESS

ifdef _WIN32
define PROGRESS_CLASS	<"msctls_progress32">
else
define PROGRESS_CLASS	<"msctls_progress">
endif

if (_WIN32_IE GE 0x0300)
define PBS_SMOOTH	0x01
define PBS_VERTICAL	0x04
endif

define PBM_SETRANGE	(WM_USER+1)
define PBM_SETPOS	(WM_USER+2)
define PBM_DELTAPOS	(WM_USER+3)
define PBM_SETSTEP	(WM_USER+4)
define PBM_STEPIT	(WM_USER+5)

if (_WIN32_IE GE 0x0300)
define PBM_SETRANGE32	(WM_USER+6)

PBRANGE			STRUC
iLow			SINT ?
iHigh			SINT ?
PBRANGE			ENDS
PPBRANGE		typedef ptr PBRANGE

define PBM_GETRANGE		(WM_USER+7)
define PBM_GETPOS		(WM_USER+8)
if (_WIN32_IE GE 0x0400)
define PBM_SETBARCOLOR		(WM_USER+9)
endif
define PBM_SETBKCOLOR		CCM_SETBKCOLOR
endif
if (_WIN32_WINNT GE 0x0501)
define PBS_MARQUEE		0x08
endif
if (_WIN32_WINNT GE 0x0501)
define PBM_SETMARQUEE		(WM_USER+10)
endif
if _WIN32_WINNT GE 0x0600
define PBS_SMOOTHREVERSE	0x10
endif

if _WIN32_WINNT GE 0x0600
define PBM_GETSTEP		(WM_USER+13)
define PBM_GETBKCOLOR		(WM_USER+14)
define PBM_GETBARCOLOR		(WM_USER+15)
define PBM_SETSTATE		(WM_USER+16)
define PBM_GETSTATE		(WM_USER+17)

define PBST_NORMAL		0x0001
define PBST_ERROR		0x0002
define PBST_PAUSED		0x0003
endif

endif ;; NOPROGRESS

ifndef NOHOTKEY

define HOTKEYF_SHIFT		0x01
define HOTKEYF_CONTROL		0x02
define HOTKEYF_ALT		0x04
ifdef _MAC
define HOTKEYF_EXT		0x80
else
define HOTKEYF_EXT		0x08
endif

define HKCOMB_NONE		0x0001
define HKCOMB_S			0x0002
define HKCOMB_C			0x0004
define HKCOMB_A			0x0008
define HKCOMB_SC		0x0010
define HKCOMB_SA		0x0020
define HKCOMB_CA		0x0040
define HKCOMB_SCA		0x0080

define HKM_SETHOTKEY		(WM_USER+1)
define HKM_GETHOTKEY		(WM_USER+2)
define HKM_SETRULES		(WM_USER+3)

ifdef _WIN32
define HOTKEY_CLASS		<"msctls_hotkey32">
else
define HOTKEY_CLASS		<"msctls_hotkey">
endif
endif ;; NOHOTKEY

define CCS_TOP			0x00000001
define CCS_NOMOVEY		0x00000002
define CCS_BOTTOM		0x00000003
define CCS_NORESIZE		0x00000004
define CCS_NOPARENTALIGN	0x00000008
define CCS_ADJUSTABLE		0x00000020
define CCS_NODIVIDER		0x00000040
if (_WIN32_IE GE 0x0300)
define CCS_VERT			0x00000080
define CCS_LEFT			(CCS_VERT or CCS_TOP)
define CCS_RIGHT		(CCS_VERT or CCS_BOTTOM)
define CCS_NOMOVEX		(CCS_VERT or CCS_NOMOVEY)
endif

ifndef NOLISTVIEW

ifdef _WIN32
if (_WIN32_WINNT GE 0x0501)

define INVALID_LINK_INDEX	(-1)
define MAX_LINKID_TEXT		48
define L_MAX_URL_LENGTH		(2048 + 32 + TCHAR*4)
define WC_LINK			<"SysLink">

define LWS_TRANSPARENT		0x0001
define LWS_IGNORERETURN		0x0002
if _WIN32_WINNT GE 0x0600
define LWS_NOPREFIX		0x0004
define LWS_USEVISUALSTYLE	0x0008
define LWS_USECUSTOMTEXT	0x0010
define LWS_RIGHT		0x0020
endif

define LIF_ITEMINDEX		0x00000001
define LIF_STATE		0x00000002
define LIF_ITEMID		0x00000004
define LIF_URL			0x00000008

define LIS_FOCUSED		0x00000001
define LIS_ENABLED		0x00000002
define LIS_VISITED		0x00000004
if _WIN32_WINNT EQ 0x0600
define LIS_HOTTRACK		0x00000008
define LIS_DEFAULTCOLORS	0x00000010
endif

LITEM			STRUC
mask			UINT ?
iLink			SINT ?
state			UINT ?
stateMask		UINT ?
szID			dw MAX_LINKID_TEXT dup(?)
szUrl			dw L_MAX_URL_LENGTH dup(?)
LITEM			ENDS
PLITEM			typedef ptr LITEM

LHITTESTINFO		STRUC
pt			POINT <>
item			LITEM <>
LHITTESTINFO		ENDS
PLHITTESTINFO		typedef ptr LHITTESTINFO

NMLINK			STRUC
hdr			NMHDR <>
item			LITEM <>
NMLINK			ENDS
PNMLINK			typedef ptr NMLINK

define LM_HITTEST		(WM_USER+0x300)
define LM_GETIDEALHEIGHT	(WM_USER+0x301)
define LM_SETITEM		(WM_USER+0x302)
define LM_GETITEM		(WM_USER+0x303)
define LM_GETIDEALSIZE		(LM_GETIDEALHEIGHT)

endif ;; _WIN32_WINNT >= 0x0501

define WC_LISTVIEW		<"SysListView32">
else  ;; _WIN32
define WC_LISTVIEW		<"SysListView">
endif ;; _WIN32

define LVS_ICON			0x0000
define LVS_REPORT		0x0001
define LVS_SMALLICON		0x0002
define LVS_LIST			0x0003
define LVS_TYPEMASK		0x0003
define LVS_SINGLESEL		0x0004
define LVS_SHOWSELALWAYS	0x0008
define LVS_SORTASCENDING	0x0010
define LVS_SORTDESCENDING	0x0020
define LVS_SHAREIMAGELISTS	0x0040
define LVS_NOLABELWRAP		0x0080
define LVS_AUTOARRANGE		0x0100
define LVS_EDITLABELS		0x0200
if (_WIN32_IE GE 0x0300)
define LVS_OWNERDATA		0x1000
endif
define LVS_NOSCROLL		0x2000
define LVS_TYPESTYLEMASK	0xfc00
define LVS_ALIGNTOP		0x0000
define LVS_ALIGNLEFT		0x0800
define LVS_ALIGNMASK		0x0c00
define LVS_OWNERDRAWFIXED	0x0400
define LVS_NOCOLUMNHEADER	0x4000
define LVS_NOSORTHEADER		0x8000

if (_WIN32_IE GE 0x0400)
define LVM_SETUNICODEFORMAT	CCM_SETUNICODEFORMAT
ListView_SetUnicodeFormat macro hwnd, fUnicode
	exitm<SNDMSG(hwnd, LVM_SETUNICODEFORMAT, fUnicode, 0)>
	endm

define LVM_GETUNICODEFORMAT	CCM_GETUNICODEFORMAT
ListView_GetUnicodeFormat macro hwnd
	exitm<SNDMSG(hwnd, LVM_GETUNICODEFORMAT, 0, 0)>
	endm
endif

define LVM_GETBKCOLOR		(LVM_FIRST + 0)
ListView_GetBkColor macro hwnd
	exitm<SNDMSG(hwnd, LVM_GETBKCOLOR, 0, 0)>
	endm

define LVM_SETBKCOLOR		(LVM_FIRST + 1)
ListView_SetBkColor macro hwnd, clrBk
	exitm<SNDMSG(hwnd, LVM_SETBKCOLOR, 0, clrBk)>
	endm

define LVM_GETIMAGELIST		(LVM_FIRST + 2)
ListView_GetImageList macro hwnd, iImageList
	exitm<SNDMSG(hwnd, LVM_GETIMAGELIST, iImageList, 0)>
	endm

define LVSIL_NORMAL		0
define LVSIL_SMALL		1
define LVSIL_STATE		2
define LVSIL_GROUPHEADER	3

define LVM_SETIMAGELIST		(LVM_FIRST + 3)
ListView_SetImageList macro hwnd, himl, iImageList
	exitm<SNDMSG(hwnd, LVM_SETIMAGELIST, iImageList, himl)>
	endm

define LVM_GETITEMCOUNT		(LVM_FIRST + 4)
ListView_GetItemCount macro hwnd
	exitm<SNDMSG(hwnd, LVM_GETITEMCOUNT, 0, 0)>
	endm

define LVIF_TEXT		0x00000001
define LVIF_IMAGE		0x00000002
define LVIF_PARAM		0x00000004
define LVIF_STATE		0x00000008
if (_WIN32_IE GE 0x0300)
define LVIF_INDENT		0x00000010
define LVIF_NORECOMPUTE		0x00000800
endif
if (_WIN32_WINNT GE 0x0501)
define LVIF_GROUPID		0x00000100
define LVIF_COLUMNS		0x00000200
endif
if _WIN32_WINNT GE 0x0600
define LVIF_COLFMT		0x00010000
endif
define LVIS_FOCUSED		0x0001
define LVIS_SELECTED		0x0002
define LVIS_CUT			0x0004
define LVIS_DROPHILITED		0x0008
define LVIS_GLOW		0x0010
define LVIS_ACTIVATING		0x0020

define LVIS_OVERLAYMASK		0x0F00
define LVIS_STATEIMAGEMASK	0xF000

INDEXTOSTATEIMAGEMASK macro i
	exitm<(i SHL 12)>
	endm

LVITEMA			STRUC
mask			UINT ?
iItem			SINT ?
iSubItem		SINT ?
state			UINT ?
stateMask		UINT ?
pszText			LPSTR ?
cchTextMax		SINT ?
iImage			SINT ?
lParam			LPARAM ?
if (_WIN32_IE GE 0x0300)
iIndent			SINT ?
endif
if (_WIN32_WINNT GE 0x0501)
iGroupId		SINT ?
cColumns		UINT ? ; tile view columns
puColumns		PUINT ?
endif
if _WIN32_WINNT GE 0x0600
piColFmt		LPDWORD ?
iGroup			SINT ?
endif
LVITEMA			ENDS
LPLVITEMA		typedef ptr LVITEMA

LVITEMW			STRUC
mask			UINT ?
iItem			SINT ?
iSubItem		SINT ?
state			UINT ?
stateMask		UINT ?
pszText			LPWSTR ?
cchTextMax		SINT ?
iImage			SINT ?
lParam			LPARAM ?
if (_WIN32_IE GE 0x0300)
iIndent			SINT ?
endif
if (_WIN32_WINNT GE 0x0501)
iGroupId		SINT ?
cColumns		UINT ? ; tile view columns
puColumns		PUINT ?
endif
if _WIN32_WINNT GE 0x0600
piColFmt		LPDWORD ?
iGroup			SINT ?
endif
LVITEMW			ENDS
LPLVITEMW		typedef ptr LVITEMW

if (_WIN32_IE GE 0x0300)
define I_INDENTCALLBACK (-1)
LV_ITEMA		typedef LVITEMA
LV_ITEMW		typedef LVITEMW
else
LVITEMA			typedef LV_ITEMA
LVITEMW			typedef LV_ITEMW
endif

if (_WIN32_WINNT GE 0x0501)
define I_GROUPIDCALLBACK (-1)
define I_GROUPIDNONE	(-2)
endif

if _WIN32_WINNT GE 0x0600
define LVITEMA_V5_SIZE	CCSIZEOF_STRUCT(LVITEMA, puColumns)
define LVITEMW_V5_SIZE	CCSIZEOF_STRUCT(LVITEMW, puColumns)
ifdef _UNICODE
define LVITEM_V5_SIZE	LVITEMW_V5_SIZE
else
define LVITEM_V5_SIZE	LVITEMA_V5_SIZE
endif
endif
define LVITEMA_V1_SIZE	CCSIZEOF_STRUCT(LVITEMA, lParam)
define LVITEMW_V1_SIZE	CCSIZEOF_STRUCT(LVITEMW, lParam)

ifdef _UNICODE
LVITEM			typedef LVITEMW
LPLVITEM		typedef LPLVITEMW
define LVITEM_V1_SIZE	LVITEMW_V1_SIZE
else
LVITEM			typedef LVITEMA
LPLVITEM		typedef LPLVITEMA
define LVITEM_V1_SIZE	LVITEMA_V1_SIZE
endif
LV_ITEM			typedef LVITEM

define LPSTR_TEXTCALLBACKW (-1)
define LPSTR_TEXTCALLBACKA (-1)
ifdef _UNICODE
define LPSTR_TEXTCALLBACK LPSTR_TEXTCALLBACKW
else
define LPSTR_TEXTCALLBACK LPSTR_TEXTCALLBACKA
endif

define I_IMAGECALLBACK	(-1)
define I_IMAGENONE	(-2)

if (NTDDI_VERSION GE NTDDI_WINXP)
define I_COLUMNSCALLBACK (-1)
endif

define LVM_GETITEMA	(LVM_FIRST + 5)
define LVM_GETITEMW	(LVM_FIRST + 75)
ifdef _UNICODE
define LVM_GETITEM	LVM_GETITEMW
else
define LVM_GETITEM	LVM_GETITEMA
endif

ListView_GetItem macro hwnd, pitem
	exitm<SNDMSG(hwnd, LVM_GETITEM, 0, pitem)>
	endm

define LVM_SETITEMA	(LVM_FIRST + 6)
define LVM_SETITEMW	(LVM_FIRST + 76)
ifdef _UNICODE
define LVM_SETITEM	LVM_SETITEMW
else
define LVM_SETITEM	LVM_SETITEMA
endif

ListView_SetItem macro hwnd, pitem
	exitm<SNDMSG(hwnd, LVM_SETITEM, 0, pitem)>
	endm

define LVM_INSERTITEMA	(LVM_FIRST + 7)
define LVM_INSERTITEMW	(LVM_FIRST + 77)
ifdef _UNICODE
define LVM_INSERTITEM	LVM_INSERTITEMW
else
define LVM_INSERTITEM	LVM_INSERTITEMA
endif
ListView_InsertItem macro hwnd, pitem
	exitm<SNDMSG(hwnd, LVM_INSERTITEM, 0, pitem)>
	endm

define LVM_DELETEITEM		(LVM_FIRST + 8)
ListView_DeleteItem macro hwnd, i
	exitm<SNDMSG(hwnd, LVM_DEETEITEM, (i), 0)>
	endm

define LVM_DELETEALLITEMS	(LVM_FIRST + 9)
ListView_DeleteAllItems macro hwnd
	exitm<SNDMSG(hwnd, LVM_DELETEALLITEMS, 0, 0)>
	endm

define LVM_GETCALLBACKMASK	(LVM_FIRST + 10)
ListView_GetCallbackMask macro hwnd
	exitm<SNDMSG(hwnd, LVM_GETCALLBACKMASK, 0, 0)>
	endm

define LVM_SETCALLBACKMASK	(LVM_FIRST + 11)
ListView_SetCallbackMask macro hwnd, mask
	exitm<SNDMSG(hwnd, LVM_SETCALLBACKMASK, mask, 0)>
	endm

define LVNI_ALL			0x0000

define LVNI_FOCUSED		0x0001
define LVNI_SELECTED		0x0002
define LVNI_CUT			0x0004
define LVNI_DROPHILITED		0x0008
define LVNI_STATEMASK		(LVNI_FOCUSED or LVNI_SELECTED or LVNI_CUT or LVNI_DROPHILITED)

define LVNI_VISIBLEORDER	0x0010
define LVNI_PREVIOUS		0x0020
define LVNI_VISIBLEONLY		0x0040
define LVNI_SAMEGROUPONLY	0x0080

define LVNI_ABOVE		0x0100
define LVNI_BELOW		0x0200
define LVNI_TOLEFT		0x0400
define LVNI_TORIGHT		0x0800
define LVNI_DIRECTIONMASK	(LVNI_ABOVE or LVNI_BELOW or LVNI_TOLEFT or LVNI_TORIGHT)

define LVM_GETNEXTITEM		(LVM_FIRST + 12)
ListView_GetNextItem macro hwnd, i, flags
	exitm<SNDMSG(hwnd, LVM_GETNEXTITEM, i, MAKEPARAM(flags, 0))>
	endm

define LVFI_PARAM		0x0001
define LVFI_STRING		0x0002
define LVFI_SUBSTRING		0x0004
define LVFI_PARTIAL		0x0008
define LVFI_WRAP		0x0020
define LVFI_NEARESTXY		0x0040

LVFINDINFOA		STRUC
flags			UINT ?
psz			LPCSTR ?
lParam			LPARAM ?
pt			POINT <>
vkDirection		UINT ?
LVFINDINFOA		ENDS
LPFINDINFOA		typedef ptr LVFINDINFOA

LVFINDINFOW		STRUC
flags			UINT ?
psz			LPCWSTR ?
lParam			LPARAM ?
pt			POINT <>
vkDirection		UINT ?
LVFINDINFOW		ENDS
LPFINDINFOW		typedef ptr LVFINDINFOW

ifdef _UNICODE
LVFINDINFO		typedef LVFINDINFOW
else
LVFINDINFO		typedef LVFINDINFOA
endif

if (_WIN32_IE GE 0x0300)
LV_FINDINFOA		typedef LVFINDINFOA
LV_FINDINFOW		typedef LVFINDINFOW
else
LVFINDINFOA		typedef LV_FINDINFOA
LVFINDINFOW		typedef LV_FINDINFOW
endif
LV_FINDINFO		typedef LVFINDINFO

define LVM_FINDITEMA	(LVM_FIRST + 13)
define LVM_FINDITEMW	(LVM_FIRST + 83)
ifdef _UNICODE
define LVM_FINDITEM	LVM_FINDITEMW
else
define LVM_FINDITEM	LVM_FINDITEMA
endif

ListView_FindItem macro hwnd, iStart, plvfi
	exitm<SNDMSG(hwnd, LVM_FINDITEM, iStart, plvfi)>
	endm

define LVIR_BOUNDS		0
define LVIR_ICON		1
define LVIR_LABEL		2
define LVIR_SELECTBOUNDS	3

define LVM_GETITEMRECT		(LVM_FIRST + 14)
ListView_GetItemRect macro hwnd, i, prc, code
	.if prc
	    mov [prc].left,code
	    exitm<SNDMSG(hwnd, LVM_GETITEMRECT, i, prc)>
	.else
	    exitm<SNDMSG(hwnd, LVM_GETITEMRECT, i, NULL)>
	.endif
	endm

define LVM_SETITEMPOSITION	(LVM_FIRST + 15)
ListView_SetItemPosition macro hwndLV, i, x, y
	exitm<SNDMSG(hwndLV, LVM_SETITEMPOSITION, i, MAKEPARAM(x, y))>
	endm

define LVM_GETITEMPOSITION	(LVM_FIRST + 16)
ListView_GetItemPosition macro hwndLV, i, ppt
	exitm<SNDMSG((hwndLV), LVM_GETITEMPOSITION, (i), (ppt))>
	endm

define LVM_GETSTRINGWIDTHA	(LVM_FIRST + 17)
define LVM_GETSTRINGWIDTHW	(LVM_FIRST + 87)
ifdef _UNICODE
define LVM_GETSTRINGWIDTH	LVM_GETSTRINGWIDTHW
else
define LVM_GETSTRINGWIDTH	LVM_GETSTRINGWIDTHA
endif

ListView_GetStringWidth macro hwndLV, psz
	exitm<SNDMSG((hwndLV), LVM_GETSTRINGWIDTH, 0, psz)>
	endm

define LVHT_NOWHERE		0x00000001
define LVHT_ONITEMICON		0x00000002
define LVHT_ONITEMLABEL		0x00000004
define LVHT_ONITEMSTATEICON	0x00000008
define LVHT_ONITEM		(LVHT_ONITEMICON or LVHT_ONITEMLABEL or LVHT_ONITEMSTATEICON)

define LVHT_ABOVE		0x00000008
define LVHT_BELOW		0x00000010
define LVHT_TORIGHT		0x00000020
define LVHT_TOLEFT		0x00000040

define LVHT_EX_GROUP_HEADER	0x10000000
define LVHT_EX_GROUP_FOOTER	0x20000000
define LVHT_EX_GROUP_COLLAPSE	0x40000000
define LVHT_EX_GROUP_BACKGROUND 0x80000000
define LVHT_EX_GROUP_STATEICON	0x01000000
define LVHT_EX_GROUP_SUBSETLINK 0x02000000
define LVHT_EX_GROUP		(LVHT_EX_GROUP_BACKGROUND or LVHT_EX_GROUP_COLLAPSE or LVHT_EX_GROUP_FOOTER or LVHT_EX_GROUP_HEADER or LVHT_EX_GROUP_STATEICON or LVHT_EX_GROUP_SUBSETLINK)
define LVHT_EX_ONCONTENTS	0x04000000
define LVHT_EX_FOOTER		0x08000000

LVHITTESTINFO		STRUC
pt			POINT <>
flags			UINT ?
iItem			SINT ?
if (_WIN32_IE GE 0x0300)
iSubItem		SINT ?
endif
if (NTDDI_VERSION ge NTDDI_VISTA)
iGroup			SINT ?
endif
LVHITTESTINFO		ENDS
LPLVHITTESTINFO		typedef ptr LVHITTESTINFO

if (_WIN32_IE GE 0x0300)
LV_HITTESTINFO		typedef LVHITTESTINFO
else
LVHITTESTINFO		typedef LV_HITTESTINFO
endif
define LVHITTESTINFO_V1_SIZE CCSIZEOF_STRUCT(LVHITTESTINFO, iItem)

define LVM_HITTEST		(LVM_FIRST + 18)
ListView_HitTest macro hwndLV, pinfo
	exitm<SNDMSG((hwndLV), LVM_HITTEST, 0, pinfo)>
	endm

define LVM_ENSUREVISIBLE	(LVM_FIRST + 19)
ListView_EnsureVisible macro hwndLV, i, fPartialOK
	exitm<SNDMSG((hwndLV), LVM_ENSUREVISIBLE, (i), MAKEPARAM((fPartialOK), 0))>
	endm

define LVM_SCROLL		(LVM_FIRST + 20)
ListView_Scroll macro hwndLV, _dx, dy
	exitm<SNDMSG((hwndLV), LVM_SCROLL, _dx, dy)>
	endm

define LVM_REDRAWITEMS		(LVM_FIRST + 21)
ListView_RedrawItems macro hwndLV, iFirst, iLast
	exitm<SNDMSG((hwndLV), LVM_REDRAWITEMS, iFirst, iLast)>
	endm

define LVA_DEFAULT		0x0000
define LVA_ALIGNLEFT		0x0001
define LVA_ALIGNTOP		0x0002
define LVA_SNAPTOGRID		0x0005

define LVM_ARRANGE		(LVM_FIRST + 22)
ListView_Arrange macro hwndLV, code
	exitm<SNDMSG((hwndLV), LVM_ARRANGE, code, 0)>
	endm

define LVM_EDITLABELA		(LVM_FIRST + 23)
define LVM_EDITLABELW		(LVM_FIRST + 118)
ifdef _UNICODE
define LVM_EDITLABEL		LVM_EDITLABELW
else
define LVM_EDITLABEL		LVM_EDITLABELA
endif

ListView_EditLabel macro hwndLV, i
	exitm<SNDMSG((hwndLV), LVM_EDITLABE, i, 0)>
	endm

define LVM_GETEDITCONTROL	(LVM_FIRST + 24)
ListView_GetEditControl macro hwndLV
	exitm<SNDMSG((hwndLV), LVM_GETEDITCONTROL, 0, 0)>
	endm

LVCOLUMNA		STRUC
mask			UINT ?
fmt			SINT ?
_cx			SINT ?
pszText			LPSTR ?
cchTextMax		SINT ?
iSubItem		SINT ?
if (_WIN32_IE GE 0x0300)
iImage			SINT ?
iOrder			SINT ?
endif
if _WIN32_WINNT GE 0x0600
cxMin			SINT ?	; min snap point
cxDefault		SINT ?	; default snap point
cxIdeal			SINT ?	; read only. ideal may not eqaul current width if auto
endif
LVCOLUMNA		ENDS
LPLVCOLUMNA		typedef ptr LVCOLUMNA

LVCOLUMNW		STRUC
mask			UINT ?
fmt			SINT ?
_cx			SINT ?
pszText			LPWSTR ?
cchTextMax		SINT ?
iSubItem		SINT ?
if (_WIN32_IE GE 0x0300)
iImage			SINT ?
iOrder			SINT ?
endif
if _WIN32_WINNT GE 0x0600
cxMin			SINT ?
cxDefault		SINT ?
cxIdeal			SINT ?
endif
LVCOLUMNW		ENDS
LPLVCOLUMNW		typedef ptr LVCOLUMNW

define LVCOLUMNA_V1_SIZE CCSIZEOF_STRUCT(LVCOLUMNA, iSubItem)
define LVCOLUMNW_V1_SIZE CCSIZEOF_STRUCT(LVCOLUMNW, iSubItem)

ifdef _UNICODE
LVCOLUMN		typedef LVCOLUMNW
LPLVCOLUMN		typedef LPLVCOLUMNW
define LVCOLUMN_V1_SIZE LVCOLUMNW_V1_SIZE
else
LVCOLUMN		typedef LVCOLUMNA
LPLVCOLUMN		typedef LPLVCOLUMNA
define LVCOLUMN_V1_SIZE LVCOLUMNA_V1_SIZE
endif

if (_WIN32_IE GE 0x0300)
LV_COLUMNA		typedef LVCOLUMNA
LV_COLUMNW		typedef LVCOLUMNW
else
LVCOLUMNA		typedef LV_COLUMNA
LVCOLUMNW		typedef LV_COLUMNW
endif
LV_COLUMN		typedef LVCOLUMN

define LVCF_FMT			0x0001
define LVCF_WIDTH		0x0002
define LVCF_TEXT		0x0004
define LVCF_SUBITEM		0x0008
if (_WIN32_IE GE 0x0300)
define LVCF_IMAGE		0x0010
define LVCF_ORDER		0x0020
endif
if _WIN32_WINNT GE 0x0600
define LVCF_MINWIDTH		0x0040
define LVCF_DEFAULTWIDTH	0x0080
define LVCF_IDEALWIDTH		0x0100
endif

define LVCFMT_LEFT		0x0000
define LVCFMT_RIGHT		0x0001
define LVCFMT_CENTER		0x0002
define LVCFMT_JUSTIFYMASK	0x0003
if (_WIN32_IE GE 0x0300)
define LVCFMT_IMAGE		0x0800
define LVCFMT_BITMAP_ON_RIGHT	0x1000
define LVCFMT_COL_HAS_IMAGES	0x8000
endif
if _WIN32_WINNT GE 0x0600
define LVCFMT_FIXED_WIDTH	0x00100
define LVCFMT_NO_DPI_SCALE	0x40000
define LVCFMT_FIXED_RATIO	0x80000
define LVCFMT_LINE_BREAK	0x100000
define LVCFMT_FILL		0x200000
define LVCFMT_WRAP		0x400000
define LVCFMT_NO_TITLE		0x800000
define LVCFMT_TILE_PLACEMENTMASK (LVCFMT_LINE_BREAK or LVCFMT_FILL)
define LVCFMT_SPLITBUTTON	0x1000000
endif

define LVM_GETCOLUMNA		(LVM_FIRST + 25)
define LVM_GETCOLUMNW		(LVM_FIRST + 95)
ifdef _UNICODE
define LVM_GETCOLUMN		LVM_GETCOLUMNW
else
define LVM_GETCOLUMN		LVM_GETCOLUMNA
endif

ListView_GetColumn macro hwnd, iCol, pcol
	exitm<SNDMSG(hwnd, LVM_GETCOLUMN, iCol, pcol)>
	endm

define LVM_SETCOLUMNA		(LVM_FIRST + 26)
define LVM_SETCOLUMNW		(LVM_FIRST + 96)
ifdef _UNICODE
define	LVM_SETCOLUMN		LVM_SETCOLUMNW
else
define	LVM_SETCOLUMN		LVM_SETCOLUMNA
endif

ListView_SetColumn macro hwnd, iCol, pcol
	exitm<SNDMSG(hwnd, LVM_SETCOLUMN, iCol, pcol)>
	endm

define LVM_INSERTCOLUMNA	(LVM_FIRST + 27)
define LVM_INSERTCOLUMNW	(LVM_FIRST + 97)
ifdef _UNICODE
define LVM_INSERTCOLUMN		LVM_INSERTCOLUMNW
else
define LVM_INSERTCOLUMN		LVM_INSERTCOLUMNA
endif

ListView_InsertColumn macro hwnd, iCol, pcol
	exitm<SNDMSG(hwnd, LVM_INSERTCOLUMN, iCol, pcol)>
	endm

define LVM_DELETECOLUMN		(LVM_FIRST + 28)
ListView_DeleteColumn macro hwnd, iCol
	exitm<SNDMSG(hwnd, LVM_DELETECOLUMN, iCol, 0)>
	endm

define LVM_GETCOLUMNWIDTH	(LVM_FIRST + 29)
ListView_GetColumnWidth macro hwnd, iCol
	exitm<SNDMSG(hwnd, LVM_GETCOLUMNWIDTH, iCol, 0)>
	endm

define LVSCW_AUTOSIZE		(-1)
define LVSCW_AUTOSIZE_USEHEADER (-2)
define LVM_SETCOLUMNWIDTH	(LVM_FIRST + 30)

ListView_SetColumnWidth macro hwnd, iCol, _cx
	exitm<SNDMSG(hwnd, LVM_SETCOLUMNWIDTH, iCol, MAKEPARAM((_cx), 0))>
	endm

if (_WIN32_IE GE 0x0300)
define LVM_GETHEADER		(LVM_FIRST + 31)
ListView_GetHeader macro hwnd
	exitm<SNDMSG(hwnd, LVM_GETHEADER, 0, 0)>
	endm
endif

define LVM_CREATEDRAGIMAGE	(LVM_FIRST + 33)
ListView_CreateDragImage macro hwnd, i, lpptUpLeft
	exitm<SNDMSG(hwnd, LVM_CREATEDRAGIMAGE, i, lpptUpLeft)>
	endm

define LVM_GETVIEWRECT		(LVM_FIRST + 34)
ListView_GetViewRect macro hwnd, prc
	exitm<SNDMSG(hwnd, LVM_GETVIEWRECT, 0, prc)>
	endm

define LVM_GETTEXTCOLOR		(LVM_FIRST + 35)
ListView_GetTextColor macro hwnd
	exitm<SNDMSG(hwnd, LVM_GETTEXTCOLOR, 0, 0)>
	endm

define LVM_SETTEXTCOLOR		(LVM_FIRST + 36)
ListView_SetTextColor macro hwnd, clrText
	exitm<SNDMSG(hwnd, LVM_SETTEXTCOLOR, 0, clrText)>
	endm

define LVM_GETTEXTBKCOLOR	(LVM_FIRST + 37)
ListView_GetTextBkColor macro hwnd
	exitm<SNDMSG(hwnd, LVM_GETTEXTBKCOLOR, 0, 0)>
	endm

define LVM_SETTEXTBKCOLOR	(LVM_FIRST + 38)
ListView_SetTextBkColor macro hwnd, clrTextBk
	exitm<SNDMSG(hwnd, LVM_SETTEXTBKCOLOR, 0, clrTextBk)>
	endm

define LVM_GETTOPINDEX		(LVM_FIRST + 39)
ListView_GetTopIndex macro hwndLV
	exitm<SNDMSG((hwndLV), LVM_GETTOPINDEX, 0, 0)>
	endm

define LVM_GETCOUNTPERPAGE	(LVM_FIRST + 40)
ListView_GetCountPerPage macro hwndLV
	exitm<SNDMSG((hwndLV), LVM_GETCOUNTPERPAGE, 0, 0)>
	endm

define LVM_GETORIGIN		(LVM_FIRST + 41)
ListView_GetOrigin macro hwndLV, ppt
	exitm<SNDMSG((hwndLV), LVM_GETORIGIN, 0, ppt)>
	endm

define LVM_UPDATE		(LVM_FIRST + 42)
ListView_Update macro hwndLV, i
	exitm<SNDMSG((hwndLV), LVM_UPDATE, i, 0)>
	endm

define LVM_SETITEMSTATE		(LVM_FIRST + 43)
ListView_SetItemState macro hwndV, i, data, mask
	endm

define LVM_GETITEMSTATE		(LVM_FIRST + 44)
ListView_GetItemState macro hwndLV, i, mask
	exitm<SNDMSG((hwndLV), LVM_GETITEMSTATE, i, mask)>
	endm

if (_WIN32_IE GE 0x0300)
ListView_GetCheckState macro hwndLV, i
	SNDMSG(hwndLV, LVM_GETITEMSTATE, i, LVIS_STATEIMAGEMASK)
	shr eax,12
	dec eax
	exitm<eax>
	endm
endif

define LVM_GETITEMTEXTA		(LVM_FIRST + 45)
define LVM_GETITEMTEXTW		(LVM_FIRST + 115)
ifdef _UNICODE
define LVM_GETITEMTEXT		LVM_GETITEMTEXTW
else
define LVM_GETITEMTEXT		LVM_GETITEMTEXTA
endif

define LVM_SETITEMTEXTA		(LVM_FIRST + 46)
define LVM_SETITEMTEXTW		(LVM_FIRST + 116)
ifdef _UNICODE
define LVM_SETITEMTEXT		LVM_SETITEMTEXTW
else
define LVM_SETITEMTEXT		LVM_SETITEMTEXTA
endif

if (_WIN32_IE GE 0x0300)
define LVSICF_NOINVALIDATEALL	0x00000001
define LVSICF_NOSCROLL		0x00000002
endif

define LVM_SETITEMCOUNT		(LVM_FIRST + 47)
ListView_SetItemCount macro hwndLV, cItems
	exitm<SNDMSG((hwndLV), LVM_SETITEMCOUNT, cItems, 0)>
	endm

if (_WIN32_IE GE 0x0300)
ListView_SetItemCountEx macro hwndLV, cItems, dwFlags
	exitm<SNDMSG((hwndLV), LVM_SETITEMCOUNT, cItems, dwFlags)>
	endm
endif

CALLBACK(PFNLVCOMPARE, :LPARAM, :LPARAM, :LPARAM)

define LVM_SORTITEMS		(LVM_FIRST + 48)
ListView_SortItems macro hwndLV, _pfnCompare, _lPrm
	exitm<SNDMSG((hwndLV), LVM_SORTITEMS, _lPrm, _pfnCompare)>
	endm

define LVM_SETITEMPOSITION32	(LVM_FIRST + 49)
ListView_SetItemPosition32 macro hwndLV, i, x, y
	exitm<>
	endm

define LVM_GETSELECTEDCOUNT	(LVM_FIRST + 50)
ListView_GetSelectedCount macro hwndLV
	exitm<SNDMSG((hwndLV), LVM_GETSEECTEDCOUNT, 0, 0)>
	endm

define LVM_GETITEMSPACING	(LVM_FIRST + 51)
ListView_GetItemSpacing macro hwndLV, fSmall
	exitm<SNDMSG((hwndLV), LVM_GETITEMSPACING, fSmall, 0)>
	endm

define LVM_GETISEARCHSTRINGA	(LVM_FIRST + 52)
define LVM_GETISEARCHSTRINGW	(LVM_FIRST + 117)
ifdef _UNICODE
define LVM_GETISEARCHSTRING	LVM_GETISEARCHSTRINGW
else
define LVM_GETISEARCHSTRING	LVM_GETISEARCHSTRINGA
endif

ListView_GetISearchString macro hwndLV, lpsz
	exitm<SNDMSG((hwndLV), LVM_GETISEARCHSTRING, 0, lpsz)>
	endm

if (_WIN32_IE GE 0x0300)
define LVM_SETICONSPACING	(LVM_FIRST + 53)
ListView_SetIconSpacing macro hwndLV, _cx, _cy
	exitm<SNDMSG((hwndLV), LVM_SETICONSPACING, 0, MAKELONG(_cx,_cy))>
	endm

define LVM_SETEXTENDEDLISTVIEWSTYLE (LVM_FIRST + 54)
ListView_SetExtendedListViewStyle macro hwndLV, w
	exitm<SNDMSG((hwndLV), LVM_SETEXTENDEDLISTVIEWSTYLE, 0, w)>
	endm
if (_WIN32_IE GE 0x0400)
ListView_SetExtendedListViewStyleEx macro hwndLV, dwMask, w
	exitm<SNDMSG((hwndLV), LVM_SETEXTENDEDLISTVIEWSTYLE, dwMask, w)>
	endm
endif

define LVM_GETEXTENDEDLISTVIEWSTYLE (LVM_FIRST + 55)
ListView_GetExtendedListViewStyle macro hwndLV
	exitm<SNDMSG((hwndLV), LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0)>
	endm

define LVS_EX_GRIDLINES		0x00000001
define LVS_EX_SUBITEMIMAGES	0x00000002
define LVS_EX_CHECKBOXES	0x00000004
define LVS_EX_TRACKSELECT	0x00000008
define LVS_EX_HEADERDRAGDROP	0x00000010
define LVS_EX_FULLROWSELECT	0x00000020
define LVS_EX_ONECLICKACTIVATE	0x00000040
define LVS_EX_TWOCLICKACTIVATE	0x00000080
if (_WIN32_IE GE 0x0400)
define LVS_EX_FLATSB		0x00000100
define LVS_EX_REGIONAL		0x00000200
define LVS_EX_INFOTIP		0x00000400
define LVS_EX_UNDERLINEHOT	0x00000800
define LVS_EX_UNDERLINECOLD	0x00001000
define LVS_EX_MULTIWORKAREAS	0x00002000
endif
if (_WIN32_IE GE 0x0500)
define LVS_EX_LABELTIP		0x00004000
define LVS_EX_BORDERSELECT	0x00008000
endif
if (_WIN32_WINNT GE 0x0501)
define LVS_EX_DOUBLEBUFFER	0x00010000
define LVS_EX_HIDELABELS	0x00020000
define LVS_EX_SINGLEROW		0x00040000
define LVS_EX_SNAPTOGRID	0x00080000
define LVS_EX_SIMPLESELECT	0x00100000
endif
if _WIN32_WINNT GE 0x0600
define LVS_EX_JUSTIFYCOLUMNS	0x00200000
define LVS_EX_TRANSPARENTBKGND	0x00400000
define LVS_EX_TRANSPARENTSHADOWTEXT 0x00800000
define LVS_EX_AUTOAUTOARRANGE	0x01000000
define LVS_EX_HEADERINALLVIEWS	0x02000000
define LVS_EX_AUTOCHECKSELECT	0x08000000
define LVS_EX_AUTOSIZECOLUMNS	0x10000000
define LVS_EX_COLUMNSNAPPOINTS	0x40000000
define LVS_EX_COLUMNOVERFLOW	0x80000000
endif

define LVM_GETSUBITEMRECT	(LVM_FIRST + 56)
ListView_GetSubItemRect macro hwnd, iItem, iSubItem, code, prc
	.if prc
	    mov [prc].RECT.top,iSubItem
	    mov [prc].RECT.left,code
	    exitm<SNDMSG(hwnd, LVM_GETSUBITEMRECT, iItem, prc)>
	.else
	    exitm<SNDMSG(hwnd, LVM_GETSUBITEMRECT, iItem, NULL)>
	.endif
	endm

define LVM_SUBITEMHITTEST	(LVM_FIRST + 57)
ListView_SubItemHitTest macro hwnd, plvhti
	exitm<SNDMSG(hwnd, LVM_SUBITEMHITTEST, 0, plvhti)>
	endm

define LVM_SETCOLUMNORDERARRAY	(LVM_FIRST + 58)
ListView_SetColumnOrderArray macro hwnd, iCount, pi
	exitm<SNDMSG(hwnd, LVM_SETCOLUMNORDERARRAY, iCount, pi)>
	endm

define LVM_GETCOLUMNORDERARRAY	(LVM_FIRST + 59)
ListView_GetColumnOrderArray macro hwnd, iCount, pi
	exitm<SNDMSG(hwnd, LVM_GETCOLUMNORDERARRAY, iCount, pi)>
	endm

define LVM_SETHOTITEM		(LVM_FIRST + 60)
ListView_SetHotItem macro hwnd, i
	exitm<SNDMSG(hwnd, LVM_SETHOTITEM, i, 0)>
	endm

define LVM_GETHOTITEM		(LVM_FIRST + 61)
ListView_GetHotItem macro hwnd
	exitm<SNDMSG(hwnd, LVM_GETHOTITEM, 0, 0)>
	endm

define LVM_SETHOTCURSOR		(LVM_FIRST + 62)
ListView_SetHotCursor macro hwnd, hcur
	exitm<SNDMSG(hwnd, LVM_SETHOTCURSOR, 0, hcur)>
	endm

define LVM_GETHOTCURSOR		(LVM_FIRST + 63)
ListView_GetHotCursor macro hwnd
	exitm<SNDMSG(hwnd, LVM_GETHOTCURSOR, 0, 0)>
	endm

define LVM_APPROXIMATEVIEWRECT	(LVM_FIRST + 64)
ListView_ApproximateViewRect macro hwnd, iWidth, iHeight, iCount
	exitm<SNDMSG(hwnd, LVM_APPROXIMATEVIEWRECT, iCount, MAKEPARAM(iWidth, iHeight))>
	endm
endif

if (_WIN32_IE GE 0x0400)


define LV_MAX_WORKAREAS		16
define LVM_SETWORKAREAS		(LVM_FIRST + 65)
ListView_SetWorkAreas macro hwnd, nWorkAreas, prc
	exitm<SNDMSG(hwnd, LVM_SETWORKAREAS, nWorkAreas, prc)>
	endm

define LVM_GETWORKAREAS		(LVM_FIRST + 70)
ListView_GetWorkAreas macro hwnd, nWorkAreas, prc
	exitm<SNDMSG(hwnd, LVM_GETWORKAREAS, nWorkAreas, prc)>
	endm

define LVM_GETNUMBEROFWORKAREAS (LVM_FIRST + 73)
ListView_GetNumberOfWorkAreas macro hwnd, pnWorkAreas
	exitm<SNDMSG(hwnd, LVM_GETNUMBEROFWORKAREAS, 0, pnWorkAreas)>
	endm

define LVM_GETSELECTIONMARK	(LVM_FIRST + 66)
ListView_GetSelectionMark macro hwnd
	exitm<SNDMSG(hwnd, LVM_GETSEECTIONMARK, 0, 0)>
	endm

define LVM_SETSELECTIONMARK	(LVM_FIRST + 67)
ListView_SetSelectionMark macro hwnd, i
	exitm<SNDMSG(hwnd, LVM_SETSELECTIONMARK, 0, i)>
	endm

define LVM_SETHOVERTIME		(LVM_FIRST + 71)
ListView_SetHoverTime macro hwndLV, dwHoverTimeMs
	exitm<SendMessage(hwndLV, LVM_SETHOVERTIME, 0, dwHoverTimeMs)>
	endm

define LVM_GETHOVERTIME		(LVM_FIRST + 72)
ListView_GetHoverTime macro hwndLV
	exitm<SendMessage(hwndLV, LVM_GETHOVERTIME, 0, 0)>
	endm

define LVM_SETTOOLTIPS		(LVM_FIRST + 74)
ListView_SetToolTips macro hwndLV, hwndNewHwnd
	exitm<SendMessage(hwndLV, LVM_SETTOOLTIPS, hwndNewHwnd, 0)>
	endm

define LVM_GETTOOLTIPS		(LVM_FIRST + 78)
ListView_GetToolTips macro hwndLV
	exitm<SendMessage(hwndLV, LVM_GETTOOLTIPS, 0, 0)>
	endm

define LVM_SORTITEMSEX		(LVM_FIRST + 81)
ListView_SortItemsEx macro hwndLV, _pfnCompare, _lPrm
	exitm<SNDMSG(hwndLV, LVM_SORTITEMSEX, _lPrm, _pfnCompare)>
	endm

LVBKIMAGEA		STRUC
ulFlags			ULONG ?
hbm			HBITMAP ?
pszImage		LPSTR ?
cchImageMax		UINT ?
xOffsetPercent		SINT ?
yOffsetPercent		SINT ?
LVBKIMAGEA		ENDS
LPLVBKIMAGEA		typedef ptr LVBKIMAGEA

LVBKIMAGEW		STRUC
ulFlags			ULONG ?
hbm			HBITMAP ?
pszImage		LPWSTR ?
cchImageMax		UINT ?
xOffsetPercent		SINT ?
yOffsetPercent		SINT ?
LVBKIMAGEW		ENDS
LPLVBKIMAGEW		typedef ptr LVBKIMAGEW

define LVBKIF_SOURCE_NONE	0x00000000
define LVBKIF_SOURCE_HBITMAP	0x00000001
define LVBKIF_SOURCE_URL	0x00000002
define LVBKIF_SOURCE_MASK	0x00000003
define LVBKIF_STYLE_NORMAL	0x00000000
define LVBKIF_STYLE_TILE	0x00000010
define LVBKIF_STYLE_MASK	0x00000010
if (_WIN32_WINNT GE 0x0501)
define LVBKIF_FLAG_TILEOFFSET	0x00000100
define LVBKIF_TYPE_WATERMARK	0x10000000
define LVBKIF_FLAG_ALPHABLEND	0x20000000
endif
define LVM_SETBKIMAGEA		(LVM_FIRST + 68)
define LVM_SETBKIMAGEW		(LVM_FIRST + 138)
define LVM_GETBKIMAGEA		(LVM_FIRST + 69)
define LVM_GETBKIMAGEW		(LVM_FIRST + 139)

if (_WIN32_WINNT GE 0x0501)
define LVM_SETSELECTEDCOLUMN	(LVM_FIRST + 140)
ListView_SetSelectedColumn macro hwnd, iCol
	exitm<SNDMSG(hwnd, LVM_SETSELECTEDCOLUMN, iCol, 0)>
	endm

define LV_VIEW_ICON		0x0000
define LV_VIEW_DETAILS		0x0001
define LV_VIEW_SMALLICON	0x0002
define LV_VIEW_LIST		0x0003
define LV_VIEW_TILE		0x0004
define LV_VIEW_MAX		0x0004

define LVM_SETVIEW		(LVM_FIRST + 142)
ListView_SetView macro hwnd, iView
	exitm<SNDMSG(hwnd, LVM_SETVIEW, iView, 0)>
	endm

define LVM_GETVIEW		(LVM_FIRST + 143)
ListView_GetView macro hwnd
	exitm<SNDMSG(hwnd, LVM_GETVIEW, 0, 0)>
	endm

define LVGF_NONE		0x00000000
define LVGF_HEADER		0x00000001
define LVGF_FOOTER		0x00000002
define LVGF_STATE		0x00000004
define LVGF_ALIGN		0x00000008
define LVGF_GROUPID		0x00000010
if _WIN32_WINNT GE 0x0600
define LVGF_SUBTITLE		0x00000100
define LVGF_TASK		0x00000200
define LVGF_DESCRIPTIONTOP	0x00000400
define LVGF_DESCRIPTIONBOTTOM	0x00000800
define LVGF_TITLEIMAGE		0x00001000
define LVGF_EXTENDEDIMAGE	0x00002000
define LVGF_ITEMS		0x00004000
define LVGF_SUBSET		0x00008000
define LVGF_SUBSETITEMS		0x00010000
endif

define LVGS_NORMAL		0x00000000
define LVGS_COLLAPSED		0x00000001
define LVGS_HIDDEN		0x00000002
define LVGS_NOHEADER		0x00000004
define LVGS_COLLAPSIBLE		0x00000008
define LVGS_FOCUSED		0x00000010
define LVGS_SELECTED		0x00000020
define LVGS_SUBSETED		0x00000040
define LVGS_SUBSETLINKFOCUSED	0x00000080

define LVGA_HEADER_LEFT		0x00000001
define LVGA_HEADER_CENTER	0x00000002
define LVGA_HEADER_RIGHT	0x00000004
define LVGA_FOOTER_LEFT		0x00000008
define LVGA_FOOTER_CENTER	0x00000010
define LVGA_FOOTER_RIGHT	0x00000020

LVGROUP			STRUC
cbSize			UINT ?
mask			UINT ?
pszHeader		LPWSTR ?
cchHeader		SINT ?
pszFooter		LPWSTR ?
cchFooter		SINT ?
iGroupId		SINT ?
stateMask		UINT ?
state			UINT ?
uAlign			UINT ?
if _WIN32_WINNT GE 0x0600
pszSubtitle		LPWSTR ?
cchSubtitle		UINT ?
pszTask			LPWSTR ?
cchTask			UINT ?
pszDescriptionTop	LPWSTR ?
cchDescriptionTop	UINT ?
pszDescriptionBottom	LPWSTR ?
cchDescriptionBottom	UINT ?
iTitleImage		SINT ?
iExtendedImage		SINT ?
iFirstItem		SINT ?	; Read only
cItems			UINT ?	; Read only
pszSubsetTitle		LPWSTR ?; NULL if group is not subset
cchSubsetTitle		UINT ?
define LVGROUP_V5_SIZE	CCSIZEOF_STRUCT(LVGROUP, uAlign)
endif
LVGROUP			ENDS
PLVGROUP		typedef ptr LVGROUP

define LVM_INSERTGROUP		(LVM_FIRST + 145)
ListView_InsertGroup macro hwnd, index, pgrp
	exitm<SNDMSG(hwnd, LVM_INSERTGROUP, index, pgrp)>
	endm

define LVM_SETGROUPINFO		(LVM_FIRST + 147)
ListView_SetGroupInfo macro hwnd, iGroupId, pgrp
	exitm<SNDMSG(hwnd, LVM_SETGROUPINFO, iGroupId, pgrp)>
	endm

define LVM_GETGROUPINFO		(LVM_FIRST + 149)
ListView_GetGroupInfo macro hwnd, iGroupId, pgrp
	exitm<SNDMSG(hwnd, LVM_GETGROUPINFO, iGroupId, pgrp)>
	endm

define LVM_REMOVEGROUP		(LVM_FIRST + 150)
ListView_RemoveGroup macro hwnd, iGroupId
	exitm<SNDMSG(hwnd, LVM_REMOVEGROUP, iGroupId, 0)>
	endm

define LVM_MOVEGROUP		(LVM_FIRST + 151)
ListView_MoveGroup macro hwnd, iGroupId, toIndex
	exitm<SNDMSG(hwnd, LVM_MOVEGROUP, iGroupId, toIndex)>
	endm

define LVM_GETGROUPCOUNT	(LVM_FIRST + 152)
ListView_GetGroupCount macro hwnd
	exitm<SNDMSG(hwnd, LVM_GETGROUPCOUNT, 0, 0)>
	endm

define LVM_GETGROUPINFOBYINDEX	(LVM_FIRST + 153)
ListView_GetGroupInfoByIndex macro hwnd, iIndex, pgrp
	exitm<SNDMSG(hwnd, LVM_GETGROUPINFOBYINDEX, iIndex, pgrp)>
	endm

define LVM_MOVEITEMTOGROUP	(LVM_FIRST + 154)
ListView_MoveItemToGroup macro hwnd, idItemFrom, idGroupTo
	exitm<SNDMSG(hwnd, LVM_MOVEITEMTOGROUP, idItemFrom, idGroupTo)>
	endm

define LVGGR_GROUP		0
define LVGGR_HEADER		1
define LVGGR_LABEL		2
define LVGGR_SUBSETLINK		3

define LVM_GETGROUPRECT		(LVM_FIRST + 98)
ListView_GetGroupRect macro hwnd, iGroupId, t, prc
	.if prc
	    mov [prc].RECT.top,t
	    exitm<SNDMSG(hwnd, LVM_GETGROUPRECT, iGroupId, prc)>
	.else
	    exitm<SNDMSG(hwnd, LVM_GETGROUPRECT, iGroupId, NULL)>
	.endif
	endm

define LVGMF_NONE		0x00000000
define LVGMF_BORDERSIZE		0x00000001
define LVGMF_BORDERCOLOR	0x00000002
define LVGMF_TEXTCOLOR		0x00000004

LVGROUPMETRICS		STRUC
cbSize			UINT ?
mask			UINT ?
Left			UINT ?
Top			UINT ?
Right			UINT ?
Bottom			UINT ?
crLeft			COLORREF ?
crTop			COLORREF ?
crRight			COLORREF ?
crBottom		COLORREF ?
crHeader		COLORREF ?
crFooter		COLORREF ?
LVGROUPMETRICS		ENDS
PLVGROUPMETRICS		typedef ptr LVGROUPMETRICS

define LVM_SETGROUPMETRICS	(LVM_FIRST + 155)
ListView_SetGroupMetrics macro hwnd, pGroupMetrics
	exitm<SNDMSG(hwnd, LVM_SETGROUPMETRICS, 0, pGroupMetrics)>
	endm

define LVM_GETGROUPMETRICS	(LVM_FIRST + 156)
ListView_GetGroupMetrics macro hwnd, pGroupMetrics
	exitm<SNDMSG(hwnd, LVM_GETGROUPMETRICS, 0, pGroupMetrics)>
	endm

define LVM_ENABLEGROUPVIEW	(LVM_FIRST + 157)
ListView_EnableGroupView macro hwnd, fEnable
	exitm<SNDMSG(hwnd, LVM_ENABLEGROUPVIEW, fEnable, 0)>
	endm

CALLBACK(PFNLVGROUPCOMPARE, :SINT, :SINT, :PVOID)

define LVM_SORTGROUPS		(LVM_FIRST + 158)
ListView_SortGroups macro hwnd, _pfnGroupCompate, _plv
	exitm<SNDMSG(hwnd, LVM_SORTGROUPS, _pfnGroupCompate, _plv)>
	endm

LVINSERTGROUPSORTED	STRUC
pfnGroupCompare		PFNLVGROUPCOMPARE ?
pvData			PVOID ?
lvGroup			LVGROUP <>
LVINSERTGROUPSORTED	ENDS
PLVINSERTGROUPSORTED	typedef ptr LVINSERTGROUPSORTED

define LVM_INSERTGROUPSORTED	(LVM_FIRST + 159)
ListView_InsertGroupSorted macro hwnd, structInsert
	exitm<SNDMSG(hwnd, LVM_INSERTGROUPSORTED, structInsert, 0)>
	endm

define LVM_REMOVEALLGROUPS	(LVM_FIRST + 160)
ListView_RemoveAllGroups macro hwnd
	exitm<SNDMSG(hwnd, LVM_REMOVEALLGROUPS, 0, 0)>
	endm

define LVM_HASGROUP		(LVM_FIRST + 161)
ListView_HasGroup macro hwnd, dwGroupId
	exitm<SNDMSG(hwnd, LVM_HASGROUP, dwGroupId, 0)>
	endm

define LVM_GETGROUPSTATE	(LVM_FIRST + 92)
ListView_GetGroupState macro hwnd, dwGroupId, dwMask
	exitm<SNDMSG(hwnd, LVM_GETGROUPSTATE, dwGroupId, dwMask)>
	endm

define LVM_GETFOCUSEDGROUP	(LVM_FIRST + 93)
ListView_GetFocusedGroup macro hwnd
	exitm<SNDMSG(hwnd, LVM_GETFOCUSEDGROUP, 0, 0)>
	endm

define LVTVIF_AUTOSIZE		0x00000000
define LVTVIF_FIXEDWIDTH	0x00000001
define LVTVIF_FIXEDHEIGHT	0x00000002
define LVTVIF_FIXEDSIZE		0x00000003
if _WIN32_WINNT GE 0x0600
define LVTVIF_EXTENDED		0x00000004
endif

define LVTVIM_TILESIZE		0x00000001
define LVTVIM_COLUMNS		0x00000002
define LVTVIM_LABELMARGIN	0x00000004

LVTILEVIEWINFO		STRUC
cbSize			UINT ?
dwMask			DWORD ? ; LVTVIM_*
dwFlags			DWORD ? ; LVTVIF_*
sizeTile		POINT <>
cLines			SINT ?
rcLabelMargin		RECT <>
LVTILEVIEWINFO		ENDS
PLVTILEVIEWINFO		typedef ptr LVTILEVIEWINFO

LVTILEINFO		STRUC
cbSize			UINT ?
iItem			SINT ?
cColumns		UINT ?
puColumns		PUINT ?
if _WIN32_WINNT GE 0x0600
piColFmt		LPINT ?
endif
LVTILEINFO		ENDS
PLVTILEINFO		typedef ptr LVTILEINFO

define LVTILEINFO_V5_SIZE CCSIZEOF_STRUCT(LVTILEINFO, puColumns)

define LVM_SETTILEVIEWINFO	(LVM_FIRST + 162)
ListView_SetTileViewInfo macro hwnd, ptvi
	exitm<SNDMSG(hwnd, LVM_SETTILEVIEWINFO, 0, ptvi)>
	endm
define LVM_GETTILEVIEWINFO	(LVM_FIRST + 163)

ListView_GetTileViewInfo macro hwnd, ptvi
	exitm<SNDMSG(hwnd, LVM_GETTILEVIEWINFO, 0, ptvi)>
	endm

define LVM_SETTILEINFO		(LVM_FIRST + 164)
ListView_SetTileInfo macro hwnd, pti
	exitm<SNDMSG(hwnd, LVM_SETTILEINFO, 0, pti)>
	endm

define LVM_GETTILEINFO		(LVM_FIRST + 165)
ListView_GetTileInfo macro hwnd, pti
	exitm<SNDMSG(hwnd, LVM_GETTILEINFO, 0, pti)>
	endm

LVINSERTMARK		STRUC
cbSize			UINT ?
dwFlags			DWORD ?
iItem			SINT ?
dwReserved		DWORD ?
LVINSERTMARK		ENDS
LPLVINSERTMARK		typedef ptr LVINSERTMARK

define LVIM_AFTER		0x00000001

define LVM_SETINSERTMARK	(LVM_FIRST + 166)
ListView_SetInsertMark macro hwnd, lvim
	exitm<SNDMSG(hwnd, LVM_SETINSERTMARK, 0, lvim)>
	endm

define LVM_GETINSERTMARK	(LVM_FIRST + 167)
ListView_GetInsertMark macro hwnd, lvim
	exitm<SNDMSG(hwnd, LVM_GETINSERTMARK, 0, lvim)>
	endm

define LVM_INSERTMARKHITTEST	(LVM_FIRST + 168)
ListView_InsertMarkHitTest macro hwnd, point, lvim
	exitm<SNDMSG(hwnd, LVM_INSERTMARKHITTEST, point, lvim)>
	endm

define LVM_GETINSERTMARKRECT	(LVM_FIRST + 169)
ListView_GetInsertMarkRect macro hwnd, rc
	exitm<SNDMSG(hwnd, LVM_GETINSERTMARKRECT, 0, rc)>
	endm

define LVM_SETINSERTMARKCOLOR	(LVM_FIRST + 170)
ListView_SetInsertMarkColor macro hwnd, color
	exitm<SNDMSG(hwnd, LVM_SETINSERTMARKCOLOR, 0, color)>
	endm

define LVM_GETINSERTMARKCOLOR	(LVM_FIRST + 171)
ListView_GetInsertMarkColor macro hwnd
	exitm<SNDMSG(hwnd, LVM_GETINSERTMARKCOLOR, 0, 0)>
	endm

LVSETINFOTIP		STRUC
cbSize			UINT ?
dwFlags			DWORD ?
pszText			LPWSTR ?
iItem			SINT ?
iSubItem		SINT ?
LVSETINFOTIP		ENDS
PLVSETINFOTIP		typedef ptr LVSETINFOTIP

define	LVM_SETINFOTIP		(LVM_FIRST + 173)
ListView_SetInfoTip macro hwndLV, plvInfoTip
	exitm<SNDMSG(hwndLV, LVM_SETINFOTIP, 0, plvInfoTip)>
	endm

define LVM_GETSELECTEDCOLUMN	(LVM_FIRST + 174)
ListView_GetSelectedColumn macro hwnd
	exitm<SNDMSG(hwnd, LVM_GETSELECTEDCOLUMN, 0, 0)>
	endm

define LVM_ISGROUPVIEWENABLED	(LVM_FIRST + 175)
ListView_IsGroupViewEnabled macro hwnd
	exitm<SNDMSG(hwnd, LVM_ISGROUPVIEWENABLED, 0, 0)>
	endm

define LVM_GETOUTLINECOLOR	(LVM_FIRST + 176)
ListView_GetOutlineColor macro hwnd
	exitm<SNDMSG(hwnd, LVM_GETOUTLINECOLOR, 0, 0)>
	endm

define LVM_SETOUTLINECOLOR	(LVM_FIRST + 177)
ListView_SetOutlineColor macro hwnd, color
	exitm<SNDMSG(hwnd, LVM_SETOUTLINECOLOR, 0, color)>
	endm


define LVM_CANCELEDITLABEL	(LVM_FIRST + 179)
ListView_CancelEditLabel macro hwnd
	exitm<SNDMSG(hwnd, LVM_CANCELEDITLABEL, 0, 0)>
	endm

define LVM_MAPINDEXTOID		(LVM_FIRST + 180)
ListView_MapIndexToID macro hwnd, index
	exitm<SNDMSG(hwnd, LVM_MAPINDEXTOID, index, 0)>
	endm

define LVM_MAPIDTOINDEX		(LVM_FIRST + 181)
ListView_MapIDToIndex macro hwnd, id
	exitm<SNDMSG(hwnd, LVM_MAPIDTOINDEX, id, 0)>
	endm

define LVM_ISITEMVISIBLE	(LVM_FIRST + 182)
ListView_IsItemVisible macro hwnd, index
	exitm<SNDMSG(hwnd, LVM_ISITEMVISIBLE, index, 0)>
	endm

if _WIN32_WINNT GE 0x0600
ListView_SetGroupHeaderImageList macro hwnd, himl
	exitm<SNDMSG(hwnd, LVM_SETIMAGELIST, LVSIL_GROUPHEADER, himl)>
	endm

ListView_GetGroupHeaderImageList macro hwnd
	exitm<SNDMSG(hwnd, LVM_GETIMAGELIST, LVSIL_GROUPHEADER, 0)>
	endm

define LVM_GETEMPTYTEXT		(LVM_FIRST + 204)
ListView_GetEmptyText macro hwnd, pszText, cchText
	exitm<SNDMSG(hwnd, LVM_GETEMPTYTEXT, cchText, pszText)>
	endm

define LVM_GETFOOTERRECT	(LVM_FIRST + 205)
ListView_GetFooterRect macro hwnd, prc
	exitm<SNDMSG(hwnd, LVM_GETFOOTERRECT, 0, prc)>
	endm

define LVFF_ITEMCOUNT		0x00000001

LVFOOTERINFO		STRUC
mask			UINT ?	; LVFIF_*
pszText			LPWSTR ?
cchTextMax		SINT ?
cItems			UINT ?
LVFOOTERINFO		ENDS
LPLVFOOTERINFO		typedef ptr LVFOOTERINFO

define LVM_GETFOOTERINFO	(LVM_FIRST + 206)
ListView_GetFooterInfo macro hwnd, plvfi
	exitm<SNDMSG(hwnd, LVM_GETFOOTERINFO, 0, plvfi)>
	endm

define LVM_GETFOOTERITEMRECT	(LVM_FIRST + 207)
ListView_GetFooterItemRect macro hwnd, iItem, prc
	exitm<SNDMSG(hwnd, LVM_GETFOOTERITEMRECT, iItem, prc)>
	endm

define LVFIF_TEXT		0x00000001
define LVFIF_STATE		0x00000002
define LVFIS_FOCUSED		0x0001

LVFOOTERITEM		STRUC
mask			UINT ?	; LVFIF_*
iItem			SINT ?
pszText			LPWSTR ?
cchTextMax		SINT ?	;
state			UINT ?	; LVFIS_*
stateMask		UINT ?	; LVFIS_*
LVFOOTERITEM		ENDS
LPLVFOOTERITEM		typedef ptr LVFOOTERITEM

define LVM_GETFOOTERITEM	(LVM_FIRST + 208)
ListView_GetFooterItem macro hwnd, iItem, pfi
	exitm<SNDMSG(hwnd, LVM_GETFOOTERITEM, iItem, pfi)>
	endm

LVITEMINDEX		STRUC
iItem			SINT ?
iGroup			SINT ?
LVITEMINDEX		ENDS
PLVITEMINDEX		typedef ptr LVITEMINDEX

define LVM_GETITEMINDEXRECT	(LVM_FIRST + 209)
ListView_GetItemIndexRect macro hwnd, plvii, iSubItem, _code, prc
	endm

define LVM_SETITEMINDEXSTATE	(LVM_FIRST + 210)
define LVM_GETNEXTITEMINDEX	(LVM_FIRST + 211)
ListView_GetNextItemIndex macro hwnd, plvii, flags
	exitm<SNDMSG(hwnd, LVM_GETNEXTITEMINDEX, plvii, MAKELPARAM(flags, 0))>
	endm
endif ; _WIN32_WINNT >= 0x0600
endif ; _WIN32_WINNT >= 0x0501


define LVM_SETBKIMAGEA	(LVM_FIRST + 68)
define LVM_GETBKIMAGEA	(LVM_FIRST + 69)
define LVM_SETBKIMAGEW	(LVM_FIRST + 138)
define LVM_GETBKIMAGEW	(LVM_FIRST + 139)

ifdef _UNICODE
LVBKIMAGE		typedef LVBKIMAGEW
LPLVBKIMAGE		typedef LPLVBKIMAGEW
define LVM_SETBKIMAGE	LVM_SETBKIMAGEW
define LVM_GETBKIMAGE	LVM_GETBKIMAGEW
else
LVBKIMAGE		typedef LVBKIMAGEA
LPLVBKIMAGE		typedef LPLVBKIMAGEA
define LVM_SETBKIMAGE	LVM_SETBKIMAGEA
define LVM_GETBKIMAGE	LVM_GETBKIMAGEA
endif

ListView_SetBkImage macro hwnd, plvbki
	exitm<SNDMSG(hwnd, LVM_SETBKIMAGE, 0, plvbki)>
	endm

ListView_GetBkImage macro hwnd, plvbki
	exitm<SNDMSG(hwnd, LVM_GETBKIMAGE, 0, plvbki)>
	endm

endif

NMLISTVIEW		STRUC
hdr			NMHDR <>
iItem			SINT ?
iSubItem		SINT ?
uNewState		UINT ?
uOldState		UINT ?
uChanged		UINT ?
ptAction		POINT <>
lParam			LPARAM ?
NMLISTVIEW		ENDS
LPNMLISTVIEW		typedef ptr NMLISTVIEW

if (_WIN32_IE GE 0x0300)
LPNM_LISTVIEW		typedef LPNMLISTVIEW
NM_LISTVIEW		typedef NMLISTVIEW
else
NMLISTVIEW		typedef NM_LISTVIEW
LPNMLISTVIEW		typedef LPNM_LISTVIEW
endif

if (_WIN32_IE GE 0x400)
NMITEMACTIVATE		STRUC
hdr			NMHDR <>
iItem			SINT ?
iSubItem		SINT ?
uNewState		UINT ?
uOldState		UINT ?
uChanged		UINT ?
ptAction		POINT <>
lParam			LPARAM ?
uKeyFlags		UINT ?
NMITEMACTIVATE		ENDS
LPNMITEMACTIVATE	typedef ptr NMITEMACTIVATE

define LVKF_ALT		0x0001
define LVKF_CONTROL	0x0002
define LVKF_SHIFT	0x0004
endif

if (_WIN32_IE GE 0x0300)

NMLVCUSTOMDRAW		STRUC
nmcd			NMCUSTOMDRAW <>
clrText			COLORREF ?
clrTextBk		COLORREF ?
if (_WIN32_IE GE 0x0400)
iSubItem		SINT ?
endif
if (_WIN32_WINNT GE 0x0501)
dwItemType		DWORD ?
clrFace			COLORREF ?
iIconEffect		SINT ?
iIconPhase		SINT ?
iPartId			SINT ?
iStateId		SINT ?
rcText			RECT <>
uAlign			UINT ?
endif
NMLVCUSTOMDRAW		ENDS
LPNMLVCUSTOMDRAW	typedef ptr NMLVCUSTOMDRAW

define NMLVCUSTOMDRAW_V3_SIZE	CCSIZEOF_STRUCT(NMLVCUSTOMDRAW, clrTextBk)

define LVCDI_ITEM		0x00000000
define LVCDI_GROUP		0x00000001
define LVCDI_ITEMSLIST		0x00000002

define LVCDRF_NOSELECT		0x00010000
define LVCDRF_NOGROUPFRAME	0x00020000

NMLVCACHEHINT		STRUC
hdr			NMHDR <>
iFrom			SINT ?
iTo			SINT ?
NMLVCACHEHINT		ENDS
LPNMLVCACHEHINT		typedef ptr NMLVCACHEHINT
LPNM_CACHEHINT		typedef LPNMLVCACHEHINT
PNM_CACHEHINT		typedef LPNMLVCACHEHINT
NM_CACHEHINT		typedef NMLVCACHEHINT

NMLVFINDITEMA		STRUC
hdr			NMHDR <>
iStart			SINT ?
lvfi			LVFINDINFOA <>
NMLVFINDITEMA		ENDS
LPNMLVFINDITEMA		typedef ptr NMLVFINDITEMA
PNM_FINDITEMA		typedef LPNMLVFINDITEMA
LPNM_FINDITEMA		typedef LPNMLVFINDITEMA
NM_FINDITEMA		typedef NMLVFINDITEMA

NMLVFINDITEMW		STRUC
hdr			NMHDR <>
iStart			SINT ?
lvfi			LVFINDINFOW <>
NMLVFINDITEMW		ENDS
LPNMLVFINDITEMW		typedef ptr NMLVFINDITEMW
PNM_FINDITEMW		typedef LPNMLVFINDITEMW
LPNM_FINDITEMW		typedef LPNMLVFINDITEMW
NM_FINDITEMW		typedef NMLVFINDITEMW

ifdef _UNICODE
PNM_FINDITEM		typedef PNM_FINDITEMW
LPNM_FINDITEM		typedef LPNM_FINDITEMW
NM_FINDITEM		typedef NM_FINDITEMW
NMLVFINDITEM		typedef NMLVFINDITEMW
LPNMLVFINDITEM		typedef LPNMLVFINDITEMW
else
PNM_FINDITEM		typedef PNM_FINDITEMA
LPNM_FINDITEM		typedef LPNM_FINDITEMA
NM_FINDITEM		typedef NM_FINDITEMA
NMLVFINDITEM		typedef NMLVFINDITEMA
LPNMLVFINDITEM		typedef LPNMLVFINDITEMA
endif


NMLVODSTATECHANGE	STRUC
hdr			NMHDR <>
iFrom			SINT ?
iTo			SINT ?
uNewState		UINT ?
uOldState		UINT ?
NMLVODSTATECHANGE	ENDS
LPNMLVODSTATECHANGE	typedef ptr NMLVODSTATECHANGE
PNM_ODSTATECHANGE	typedef LPNMLVODSTATECHANGE
LPNM_ODSTATECHANGE	typedef LPNMLVODSTATECHANGE
NM_ODSTATECHANGE	typedef NMLVODSTATECHANGE
endif

define LVN_ITEMCHANGING		(LVN_FIRST-0)
define LVN_ITEMCHANGED		(LVN_FIRST-1)
define LVN_INSERTITEM		(LVN_FIRST-2)
define LVN_DELETEITEM		(LVN_FIRST-3)
define LVN_DELETEALLITEMS	(LVN_FIRST-4)
define LVN_BEGINLABELEDITA	(LVN_FIRST-5)
define LVN_BEGINLABELEDITW	(LVN_FIRST-75)
define LVN_ENDLABELEDITA	(LVN_FIRST-6)
define LVN_ENDLABELEDITW	(LVN_FIRST-76)
define LVN_COLUMNCLICK		(LVN_FIRST-8)
define LVN_BEGINDRAG		(LVN_FIRST-9)
define LVN_BEGINRDRAG		(LVN_FIRST-11)

if (_WIN32_IE GE 0x0300)
define LVN_ODCACHEHINT		(LVN_FIRST-13)
define LVN_ODFINDITEMA		(LVN_FIRST-52)
define LVN_ODFINDITEMW		(LVN_FIRST-79)
define LVN_ITEMACTIVATE		(LVN_FIRST-14)
define LVN_ODSTATECHANGED	(LVN_FIRST-15)
ifdef _UNICODE
define LVN_ODFINDITEM		LVN_ODFINDITEMW
else
define LVN_ODFINDITEM		LVN_ODFINDITEMA
endif
endif
if (_WIN32_IE GE 0x0400)
define LVN_HOTTRACK		(LVN_FIRST-21)
endif

define LVN_GETDISPINFOA		(LVN_FIRST-50)
define LVN_GETDISPINFOW		(LVN_FIRST-77)
define LVN_SETDISPINFOA		(LVN_FIRST-51)
define LVN_SETDISPINFOW		(LVN_FIRST-78)

ifdef _UNICODE
define LVN_BEGINLABELEDIT	LVN_BEGINLABELEDITW
define LVN_ENDLABELEDIT		LVN_ENDLABELEDITW
define LVN_GETDISPINFO		LVN_GETDISPINFOW
define LVN_SETDISPINFO		LVN_SETDISPINFOW
else
define LVN_BEGINLABELEDIT	LVN_BEGINLABELEDITA
define LVN_ENDLABELEDIT		LVN_ENDLABELEDITA
define LVN_GETDISPINFO		LVN_GETDISPINFOA
define LVN_SETDISPINFO		LVN_SETDISPINFOA
endif

define LVIF_DI_SETITEM		0x1000

NMLVDISPINFOA		STRUC
hdr			NMHDR <>
item			LVITEMA <>
NMLVDISPINFOA		ENDS
LPNMLVDISPINFOA		typedef ptr NMLVDISPINFOA

NMLVDISPINFOW		STRUC
hdr			NMHDR <>
item			LVITEMW <>
NMLVDISPINFOW		ENDS
LPNMLVDISPINFOW		typedef ptr NMLVDISPINFOW

ifdef _UNICODE
NMLVDISPINFO		typedef NMLVDISPINFOW
else
NMLVDISPINFO		typedef NMLVDISPINFOA
endif
if (_WIN32_IE GE 0x0300)
LV_DISPINFOA		typedef NMLVDISPINFOA
LV_DISPINFOW		typedef NMLVDISPINFOW
else
NMLVDISPINFOA		typedef LV_DISPINFOA
NMLVDISPINFOW		typedef LV_DISPINFOW
endif
LV_DISPINFO		typedef NMLVDISPINFO

define LVN_KEYDOWN	(LVN_FIRST-55)

.pragma pack(push, 1)

NMLVKEYDOWN		STRUC
hdr			NMHDR <>
wVKey			dw ?
flags			UINT ?
NMLVKEYDOWN		ENDS
LPNMLVKEYDOWN		typedef ptr NMLVKEYDOWN

.pragma pack(pop)

if (_WIN32_IE GE 0x0300)
LV_KEYDOWN		typedef NMLVKEYDOWN
else
NMLVKEYDOWN		typedef LV_KEYDOWN
endif

if (_WIN32_IE GE 0x0300)
define LVN_MARQUEEBEGIN (LVN_FIRST-56)
endif

if _WIN32_WINNT GE 0x0600
NMLVLINK		STRUC
hdr			NMHDR <>
link			LITEM <>
iItem			SINT ?
iSubItem		SINT ?
NMLVLINK		ENDS
PNMLVLINK		typedef ptr NMLVLINK
endif

if (_WIN32_IE GE 0x0400)
NMLVGETINFOTIPA		STRUC
hdr			NMHDR <>
dwFlags			dd ?
pszText			LPSTR ?
cchTextMax		SINT ?
iItem			SINT ?
iSubItem		SINT ?
lParam			LPARAM ?
NMLVGETINFOTIPA		ENDS
LPNMLVGETINFOTIPA	typedef ptr NMLVGETINFOTIPA
NMLVGETINFOTIPW		STRUC
hdr			NMHDR <>
dwFlags			dd ?
pszText			LPWSTR ?
cchTextMax		SINT ?
iItem			SINT ?
iSubItem		SINT ?
lParam			LPARAM ?
NMLVGETINFOTIPW		ENDS
LPNMLVGETINFOTIPW	typedef ptr NMLVGETINFOTIPW

define LVGIT_UNFOLDED  0x0001

define LVN_GETINFOTIPA (LVN_FIRST-57)
define LVN_GETINFOTIPW (LVN_FIRST-58)
ifdef _UNICODE
define LVN_GETINFOTIP	LVN_GETINFOTIPW
NMLVGETINFOTIP		typedef NMLVGETINFOTIPW
LPNMLVGETINFOTIP	typedef LPNMLVGETINFOTIPW
else
define LVN_GETINFOTIP	LVN_GETINFOTIPA
NMLVGETINFOTIP		typedef NMLVGETINFOTIPA
LPNMLVGETINFOTIP	typedef LPNMLVGETINFOTIPA
endif
endif

if (_WIN32_IE GE 0x0500)

define LVNSCH_DEFAULT	(-1)
define LVNSCH_ERROR	(-2)
define LVNSCH_IGNORE	(-3)

define LVN_INCREMENTALSEARCHA	(LVN_FIRST-62)
define LVN_INCREMENTALSEARCHW	(LVN_FIRST-63)
ifdef _UNICODE
define LVN_INCREMENTALSEARCH	LVN_INCREMENTALSEARCHW
else
define LVN_INCREMENTALSEARCH	LVN_INCREMENTALSEARCHA
endif
endif

if (NTDDI_VERSION ge NTDDI_VISTA)
define LVN_COLUMNDROPDOWN	(LVN_FIRST-64)
define LVN_COLUMNOVERFLOWCLICK	(LVN_FIRST-66)
endif

if (_WIN32_WINNT GE 0x0501)
NMLVSCROLL		STRUC
hdr			NMHDR <>
_dx			SINT ?
dy			SINT ?
NMLVSCROLL		ENDS
LPNMLVSCROLL		typedef ptr NMLVSCROLL

define LVN_BEGINSCROLL	(LVN_FIRST-80)
define LVN_ENDSCROLL	(LVN_FIRST-81)
endif

if _WIN32_WINNT GE 0x0600
LVN_LINKCLICK		equ (LVN_FIRST-84)
EMF_CENTERED		equ 0x00000001

NMLVEMPTYMARKUP		STRUC
hdr			NMHDR <>
dwFlags			DWORD ?
szMarkup		dw L_MAX_URL_LENGTH dup(?)
NMLVEMPTYMARKUP		ENDS

define LVN_GETEMPTYMARKUP (LVN_FIRST-87)
endif

endif

ifndef NOTREEVIEW

ifdef _WIN32
define WC_TREEVIEW	<"SysTreeView32">
else
define WC_TREEVIEW	<"SysTreeView">
endif

define TVS_HASBUTTONS		0x0001
define TVS_HASLINES		0x0002
define TVS_LINESATROOT		0x0004
define TVS_EDITLABELS		0x0008
define TVS_DISABLEDRAGDROP	0x0010
define TVS_SHOWSELALWAYS	0x0020
if (_WIN32_IE GE 0x0300)
define TVS_RTLREADING		0x0040
define TVS_NOTOOLTIPS		0x0080
define TVS_CHECKBOXES		0x0100
define TVS_TRACKSELECT		0x0200
if (_WIN32_IE GE 0x0400)
define TVS_SINGLEEXPAND		0x0400
define TVS_INFOTIP		0x0800
define TVS_FULLROWSELECT	0x1000
define TVS_NOSCROLL		0x2000
define TVS_NONEVENHEIGHT	0x4000
endif
if (_WIN32_IE GE 0x500)
define TVS_NOHSCROLL		0x8000
endif
endif ; _WIN32_IE GE 0x0300

if (NTDDI_VERSION ge NTDDI_WINXP)
define TVS_EX_NOSINGLECOLLAPSE	0x0001
endif

if (NTDDI_VERSION ge NTDDI_VISTA)
define TVS_EX_MULTISELECT	0x0002
define TVS_EX_DOUBLEBUFFER	0x0004
define TVS_EX_NOINDENTSTATE	0x0008
define TVS_EX_RICHTOOLTIP	0x0010
define TVS_EX_AUTOHSCROLL	0x0020
define TVS_EX_FADEINOUTEXPANDOS 0x0040
define TVS_EX_PARTIALCHECKBOXES 0x0080
define TVS_EX_EXCLUSIONCHECKBOXES 0x0100
define TVS_EX_DIMMEDCHECKBOXES	0x0200
define TVS_EX_DRAWIMAGEASYNC	0x0400
endif

HTREEITEM typedef ptr TREEITEM

define TVIF_TEXT		0x0001
define TVIF_IMAGE		0x0002
define TVIF_PARAM		0x0004
define TVIF_STATE		0x0008
define TVIF_HANDLE		0x0010
define TVIF_SELECTEDIMAGE	0x0020
define TVIF_CHILDREN		0x0040
if (_WIN32_IE GE 0x0400)
define TVIF_INTEGRAL		0x0080
endif
if (_WIN32_IE GE 0x0600)
define TVIF_STATEEX		0x0100
define TVIF_EXPANDEDIMAGE	0x0200
endif
define TVIS_SELECTED		0x0002
define TVIS_CUT			0x0004
define TVIS_DROPHILITED		0x0008
define TVIS_BOLD		0x0010
define TVIS_EXPANDED		0x0020
define TVIS_EXPANDEDONCE	0x0040
if (_WIN32_IE GE 0x0300)
define TVIS_EXPANDPARTIAL	0x0080
endif
define TVIS_OVERLAYMASK		0x0F00
define TVIS_STATEIMAGEMASK	0xF000
define TVIS_USERMASK		0xF000

if (_WIN32_IE GE 0x0600)
define TVIS_EX_FLAT		0x0001
if (_WIN32_WINNT GE 0x0600)
define TVIS_EX_DISABLED		0x0002
endif
define TVIS_EX_ALL		0x0002

NMTVSTATEIMAGECHANGING	STRUC
hdr			NMHDR <>
hti			HTREEITEM ?
iOldStateImageIndex	SINT ?
iNewStateImageIndex	SINT ?
NMTVSTATEIMAGECHANGING	ENDS
LPNMTVSTATEIMAGECHANGING typedef ptr NMTVSTATEIMAGECHANGING
endif ; (_WIN32_IE GE 0x0600)

define I_CHILDRENCALLBACK	(-1)
define I_CHILDRENAUTO		(-2)

TVITEMA			STRUC
mask			UINT ?
hItem			HTREEITEM ?
state			UINT ?
stateMask		UINT ?
pszText			LPSTR ?
cchTextMax		SINT ?
iImage			SINT ?
iSelectedImage		SINT ?
cChildren		SINT ?
lParam			LPARAM ?
TVITEMA			ENDS
LPTVITEMA		typedef ptr TVITEMA

TVITEMW			STRUC
mask			UINT ?
hItem			HTREEITEM ?
state			UINT ?
stateMask		UINT ?
pszText			LPWSTR ?
cchTextMax		SINT ?
iImage			SINT ?
iSelectedImage		SINT ?
cChildren		SINT ?
lParam			LPARAM ?
TVITEMW			ENDS
LPTVITEMW		typedef ptr TVITEMW

ifdef _UNICODE
TVITEM			typedef TVITEMW
LPTVITEM		typedef LPTVITEMW
else
TVITEM			typedef TVITEMA
LPTVITEM		typedef LPTVITEMA
endif

if (_WIN32_IE GE 0x0300)
LPTV_ITEMW		typedef LPTVITEMW
LPTV_ITEMA		typedef LPTVITEMA
TV_ITEMW		typedef TVITEMW
TV_ITEMA		typedef TVITEMA
else
TVITEMA			typedef TV_ITEMA
LPTVITEMA		typedef LPTV_ITEMA
TVITEMW			typedef TV_ITEMW
LPTVITEMW		typedef LPTV_ITEMW
endif
LPTV_ITEM		typedef LPTVITEM
TV_ITEM			typedef TVITEM

if (_WIN32_IE GE 0x0400)

TVITEMEXA		STRUC
mask			UINT ?
hItem			HTREEITEM ?
state			UINT ?
stateMask		UINT ?
pszText			LPSTR ?
cchTextMax		SINT ?
iImage			SINT ?
iSelectedImage		SINT ?
cChildren		SINT ?
lParam			LPARAM ?
iIntegral		SINT ?
if (_WIN32_IE GE 0x0600)
uStateEx		UINT ?
hwnd			HWND ?
iExpandedImage		SINT ?
endif
if (NTDDI_VERSION GE NTDDI_WIN7)
iReserved		SINT ?
endif
TVITEMEXA		ENDS
LPTVITEMEXA		typedef ptr TVITEMEXA

TVITEMEXW		STRUC
mask			UINT ?
hItem			HTREEITEM ?
state			UINT ?
stateMask		UINT ?
pszText			LPWSTR ?
cchTextMax		SINT ?
iImage			SINT ?
iSelectedImage		SINT ?
cChildren		SINT ?
lParam			LPARAM ?
iIntegral		SINT ?
if (_WIN32_IE GE 0x0600)
uStateEx		UINT ?
hwnd			HWND ?
iExpandedImage		SINT ?
endif
if (NTDDI_VERSION GE NTDDI_WIN7)
iReserved		SINT ?
endif
TVITEMEXW		ENDS
LPTVITEMEXW		typedef ptr TVITEMEXW
ifdef _UNICODE
TVITEMEX		typedef TVITEMEXW
LPTVITEMEX		typedef LPTVITEMEXW
else
TVITEMEX		typedef TVITEMEXA
LPTVITEMEX		typedef LPTVITEMEXA
endif

endif ; (_WIN32_IE GE 0x0400)


define TVI_ROOT		0xFFFF0000
define TVI_FIRST	0xFFFF0001
define TVI_LAST		0xFFFF0002
define TVI_SORT		0xFFFF0003

TVINSERTSTRUCTA		STRUC
hParent			HTREEITEM ?
hInsertAfter		HTREEITEM ?
if (_WIN32_IE GE 0x0400)
UNION
 itemex			TVITEMEXA <>
 item			TV_ITEMA <>
ENDS
else
item			TV_ITEMA <>
endif
TVINSERTSTRUCTA		ENDS
LPTVINSERTSTRUCTA	typedef ptr TVINSERTSTRUCTA

TVINSERTSTRUCTW		STRUC
hParent			HTREEITEM ?
hInsertAfter		HTREEITEM ?
if (_WIN32_IE GE 0x0400)
UNION
 itemex			TVITEMEXW <>
 item			TV_ITEMW <>
ENDS
else
item			TV_ITEMW <>
endif
TVINSERTSTRUCTW		ENDS
LPTVINSERTSTRUCTW	typedef ptr TVINSERTSTRUCTW

define TVINSERTSTRUCTA_V1_SIZE CCSIZEOF_STRUCT(TVINSERTSTRUCTA, item)
define TVINSERTSTRUCTW_V1_SIZE CCSIZEOF_STRUCT(TVINSERTSTRUCTW, item)

ifdef _UNICODE
TVINSERTSTRUCT		typedef TVINSERTSTRUCTW
LPTVINSERTSTRUCT	typedef LPTVINSERTSTRUCTW
define TVINSERTSTRUCT_V1_SIZE	TVINSERTSTRUCTW_V1_SIZE
else
TVINSERTSTRUCT		typedef TVINSERTSTRUCTA
LPTVINSERTSTRUCT	typedef LPTVINSERTSTRUCTA
define TVINSERTSTRUCT_V1_SIZE	TVINSERTSTRUCTA_V1_SIZE
endif
if (_WIN32_IE GE 0x0300)
LPTV_INSERTSTRUCTA	typedef LPTVINSERTSTRUCTA
LPTV_INSERTSTRUCTW	typedef LPTVINSERTSTRUCTW
TV_INSERTSTRUCTA	typedef TVINSERTSTRUCTA
TV_INSERTSTRUCTW	typedef TVINSERTSTRUCTW
else
LPTVINSERTSTRUCTA	typedef LPTV_INSERTSTRUCTA
LPTVINSERTSTRUCTW	typedef LPTV_INSERTSTRUCTW
TVINSERTSTRUCTA		typedef TV_INSERTSTRUCTA
TVINSERTSTRUCTW		typedef TV_INSERTSTRUCTW
endif
TV_INSERTSTRUCT		typedef TVINSERTSTRUCT
LPTV_INSERTSTRUCT	typedef LPTVINSERTSTRUCT


define TVM_INSERTITEMA	(TV_FIRST + 0)
define TVM_INSERTITEMW	(TV_FIRST + 50)
ifdef _UNICODE
define TVM_INSERTITEM	TVM_INSERTITEMW
else
define TVM_INSERTITEM	TVM_INSERTITEMA
endif

TreeView_InsertItem macro hwnd, lpis
	exitm<SNDMSG(hwnd, TVM_INSERTITEM, 0, lpis)>
	endm

define TVM_DELETEITEM	(TV_FIRST + 1)
TreeView_DeleteItem macro hwnd, hitem
	exitm<SNDMSG(hwnd, TVM_DEETEITEM, 0, hitem)>
	endm

TreeView_DeleteAllItems macro hwnd
	exitm<SNDMSG(hwnd, TVM_DEETEITEM, 0, TVI_ROOT)>
	endm

define TVM_EXPAND	(TV_FIRST + 2)
TreeView_Expand macro hwnd, hitem, code
	exitm<SNDMSG(hwnd, TVM_EXPAND, code, hitem)>
	endm

define TVE_COLLAPSE		0x0001
define TVE_EXPAND		0x0002
define TVE_TOGGLE		0x0003
if (_WIN32_IE GE 0x0300)
define TVE_EXPANDPARTIAL	0x4000
endif
define TVE_COLLAPSERESET	0x8000

define TVM_GETITEMRECT		(TV_FIRST + 4)
TreeView_GetItemRect macro hwnd, hitem, prc, code
	mov [prc],hitem
	exitm<SNDMSG(hwnd, TVM_GETITEMRECT, code, prc)>
	endm

define TVM_GETCOUNT		(TV_FIRST + 5)
TreeView_GetCount macro hwnd
	exitm<SNDMSG(hwnd, TVM_GETCOUNT, 0, 0)>
	endm

define TVM_GETINDENT		(TV_FIRST + 6)
TreeView_GetIndent macro hwnd
	exitm<SNDMSG(hwnd, TVM_GETINDENT, 0, 0)>
	endm

define TVM_SETINDENT		(TV_FIRST + 7)
TreeView_SetIndent macro hwnd, indent
	exitm<SNDMSG(hwnd, TVM_SETINDENT, indent, 0)>
	endm

define TVM_GETIMAGELIST		(TV_FIRST + 8)
TreeView_GetImageList macro hwnd, iImage
	exitm<SNDMSG(hwnd, TVM_GETIMAGELIST, iImage, 0)>
	endm

define TVSIL_NORMAL		0
define TVSIL_STATE		2

define TVM_SETIMAGELIST		(TV_FIRST + 9)
TreeView_SetImageList macro hwnd, himl, iImage
	exitm<SNDMSG(hwnd, TVM_SETIMAGELIST, iImage, himl)>
	endm

define TVM_GETNEXTITEM		(TV_FIRST + 10)
TreeView_GetNextItem macro hwnd, hitem, code
	exitm<SNDMSG(hwnd, TVM_GETNEXTITEM, code, hitem)>
	endm

define TVGN_ROOT		0x0000
define TVGN_NEXT		0x0001
define TVGN_PREVIOUS		0x0002
define TVGN_PARENT		0x0003
define TVGN_CHILD		0x0004
define TVGN_FIRSTVISIBLE	0x0005
define TVGN_NEXTVISIBLE		0x0006
define TVGN_PREVIOUSVISIBLE	0x0007
define TVGN_DROPHILITE		0x0008
define TVGN_CARET		0x0009
if (_WIN32_IE GE 0x0400)
define TVGN_LASTVISIBLE		0x000A
endif
if (_WIN32_IE GE 0x0600)
define TVGN_NEXTSELECTED	0x000B
endif
if (_WIN32_WINNT GE 0x0501)
define TVSI_NOSINGLEEXPAND	0x8000
endif

TreeView_GetChild macro hwnd, hitem
	exitm<TreeView_GetNextItem(hwnd, hitem, TVGN_CHILD)>
	endm
TreeView_GetNextSibling macro hwnd, hitem
	exitm<TreeView_GetNextItem(hwnd, hitem, TVGN_NEXT)>
	endm
TreeView_GetPrevSibling macro hwnd, hitem
	exitm<TreeView_GetNextItem(hwnd, hitem, TVGN_PREVIOUS)>
	endm
TreeView_GetParent macro hwnd, hitem
	exitm<TreeView_GetNextItem(hwnd, hitem, TVGN_PARENT)>
	endm
TreeView_GetFirstVisible macro hwnd
	exitm<TreeView_GetNextItem(hwnd, NULL,	TVGN_FIRSTVISIBE)>
	endm
TreeView_GetNextVisible macro hwnd, hitem
	exitm<TreeView_GetNextItem(hwnd, hitem, TVGN_NEXTVISIBE)>
	endm
TreeView_GetPrevVisible macro hwnd, hitem
	exitm<TreeView_GetNextItem(hwnd, hitem, TVGN_PREVIOUSVISIBE)>
	endm
TreeView_GetSelection macro hwnd
	exitm<TreeView_GetNextItem(hwnd, NULL, TVGN_CARET)>
	endm
TreeView_GetDropHilight macro hwnd
	exitm<TreeView_GetNextItem(hwnd, NULL, TVGN_DROPHILITE)>
	endm
TreeView_GetRoot macro hwnd
	exitm<TreeView_GetNextItem(hwnd, NULL, TVGN_ROOT)>
	endm
if (_WIN32_IE GE 0x0400)
TreeView_GetLastVisible macro hwnd
	exitm<TreeView_GetNextItem(hwnd, NULL, TVGN_LASTVISIBE)>
	endm
endif
if (_WIN32_IE GE 0x0600)
TreeView_GetNextSelected macro hwnd, hitem
	exitm<TreeView_GetNextItem(hwnd, hitem, TVGN_NEXTSELECTED)>
	endm
endif

define TVM_SELECTITEM		(TV_FIRST + 11)
TreeView_Select macro hwnd, hitem, code
	exitm<SNDMSG(hwnd, TVM_SEECTITEM, code, hitem)>
	endm

TreeView_SelectItem macro hwnd, hitem
	exitm<TreeView_Select(hwnd, hitem, TVGN_CARET)>
	endm
TreeView_SelectDropTarget macro hwnd, hitem
	exitm<TreeView_Select(hwnd, hitem, TVGN_DROPHILITE)>
	endm
TreeView_SelectSetFirstVisible macro hwnd, hitem
	exitm<TreeView_Select(hwnd, hitem, TVGN_FIRSTVISIBE)>
	endm

define TVM_GETITEMA		(TV_FIRST + 12)
define TVM_GETITEMW		(TV_FIRST + 62)
ifdef _UNICODE
define TVM_GETITEM		TVM_GETITEMW
else
define TVM_GETITEM		TVM_GETITEMA
endif

TreeView_GetItem macro hwnd, pitem
	exitm<SNDMSG(hwnd, TVM_GETITEM, 0, pitem)>
	endm

define TVM_SETITEMA		(TV_FIRST + 13)
define TVM_SETITEMW		(TV_FIRST + 63)
ifdef _UNICODE
define TVM_SETITEM		TVM_SETITEMW
else
define TVM_SETITEM		TVM_SETITEMA
endif

TreeView_SetItem macro hwnd, pitem
	exitm<SNDMSG(hwnd, TVM_SETITEM, 0, pitem)>
	endm

define TVM_EDITLABELA		(TV_FIRST + 14)
define TVM_EDITLABELW		(TV_FIRST + 65)
ifdef _UNICODE
define TVM_EDITLABEL		TVM_EDITLABELW
else
define TVM_EDITLABEL		TVM_EDITLABELA
endif

TreeView_EditLabel macro hwnd, hitem
	exitm<SNDMSG(hwnd, TVM_EDITLABE, 0, hitem)>
	endm

define TVM_GETEDITCONTROL	(TV_FIRST + 15)
TreeView_GetEditControl macro hwnd
	exitm<SNDMSG(hwnd, TVM_GETEDITCONTROL, 0, 0)>
	endm

define TVM_GETVISIBLECOUNT	(TV_FIRST + 16)
TreeView_GetVisibleCount macro hwnd
	exitm<SNDMSG(hwnd, TVM_GETVISIBECOUNT, 0, 0)>
	endm

define TVM_HITTEST		(TV_FIRST + 17)
TreeView_HitTest macro hwnd, lpht
	exitm<SNDMSG(hwnd, TVM_HITTEST, 0, lpht)>
	endm

TVHITTESTINFO		STRUC
pt			POINT <>
flags			UINT ?
hItem			HTREEITEM ?
TVHITTESTINFO		ENDS
LPTVHITTESTINFO		typedef ptr TVHITTESTINFO
if (_WIN32_IE GE 0x0300)
LPTV_HITTESTINFO	typedef LPTVHITTESTINFO
TV_HITTESTINFO		typedef TVHITTESTINFO
else
TVHITTESTINFO		typedef TV_HITTESTINFO
LPTVHITTESTINFO		typedef LPTV_HITTESTINFO
endif

define TVHT_NOWHERE		0x0001
define TVHT_ONITEMICON		0x0002
define TVHT_ONITEMLABEL		0x0004
define TVHT_ONITEM		(TVHT_ONITEMICON or TVHT_ONITEMLABEL or TVHT_ONITEMSTATEICON)
define TVHT_ONITEMINDENT	0x0008
define TVHT_ONITEMBUTTON	0x0010
define TVHT_ONITEMRIGHT		0x0020
define TVHT_ONITEMSTATEICON	0x0040

define TVHT_ABOVE		0x0100
define TVHT_BELOW		0x0200
define TVHT_TORIGHT		0x0400
define TVHT_TOLEFT		0x0800

define TVM_CREATEDRAGIMAGE	(TV_FIRST + 18)
TreeView_CreateDragImage macro hwnd, hitem
	exitm<SNDMSG(hwnd, TVM_CREATEDRAGIMAGE, 0, hitem)>
	endm

define TVM_SORTCHILDREN		(TV_FIRST + 19)
TreeView_SortChildren macro hwnd, hitem, recurse
	exitm<SNDMSG(hwnd, TVM_SORTCHILDREN, recurse, hitem)>
	endm

define TVM_ENSUREVISIBLE	(TV_FIRST + 20)
TreeView_EnsureVisible macro hwnd, hitem
	exitm<SNDMSG(hwnd, TVM_ENSUREVISIBE, 0, hitem)>
	endm

define TVM_SORTCHILDRENCB	(TV_FIRST + 21)
TreeView_SortChildrenCB macro hwnd, psort, recurse
	exitm<SNDMSG(hwnd, TVM_SORTCHILDRENCB, recurse, psort)>
	endm

define TVM_ENDEDITLABELNOW	(TV_FIRST + 22)
TreeView_EndEditLabelNow macro hwnd, fCancel
	exitm<SNDMSG(hwnd, TVM_ENDEDITLABENOW, fCancel, 0)>
	endm

define TVM_GETISEARCHSTRINGA	(TV_FIRST + 23)
define TVM_GETISEARCHSTRINGW	(TV_FIRST + 64)
ifdef _UNICODE
define TVM_GETISEARCHSTRING	TVM_GETISEARCHSTRINGW
else
define TVM_GETISEARCHSTRING	TVM_GETISEARCHSTRINGA
endif

if (_WIN32_IE GE 0x0300)
define TVM_SETTOOLTIPS		(TV_FIRST + 24)
TreeView_SetToolTips macro hwnd,  hwndTT
	exitm<SNDMSG(hwnd, TVM_SETTOOLTIPS, hwndTT, 0)>
	endm
define TVM_GETTOOLTIPS		(TV_FIRST + 25)
TreeView_GetToolTips macro hwnd
	exitm<SNDMSG(hwnd, TVM_GETTOOLTIPS, 0, 0)>
	endm
endif

TreeView_GetISearchString macro hwndTV, lpsz
	exitm<SNDMSG((hwndTV), TVM_GETISEARCHSTRING, 0, lpsz)>
	endm

if (_WIN32_IE GE 0x0400)
define TVM_SETINSERTMARK	(TV_FIRST + 26)
TreeView_SetInsertMark macro hwnd, hItem, fAfter
	exitm<SNDMSG(hwnd, TVM_SETINSERTMARK, fAfter, hItem)>
	endm

define TVM_SETUNICODEFORMAT	CCM_SETUNICODEFORMAT
TreeView_SetUnicodeFormat macro hwnd, fUnicode
	exitm<SNDMSG(hwnd, TVM_SETUNICODEFORMAT, fUnicode, 0)>
	endm

define TVM_GETUNICODEFORMAT	CCM_GETUNICODEFORMAT
TreeView_GetUnicodeFormat macro hwnd
	exitm<SNDMSG(hwnd, TVM_GETUNICODEFORMAT, 0, 0)>
	endm
endif

if (_WIN32_IE GE 0x0400)
define TVM_SETITEMHEIGHT	(TV_FIRST + 27)
TreeView_SetItemHeight macro hwnd,  iHeight
	exitm<SNDMSG(hwnd, TVM_SETITEMHEIGHT, iHeight, 0)>
	endm
define TVM_GETITEMHEIGHT	(TV_FIRST + 28)
TreeView_GetItemHeight macro hwnd
	exitm<SNDMSG(hwnd, TVM_GETITEMHEIGHT, 0, 0)>
	endm

define TVM_SETBKCOLOR		(TV_FIRST + 29)
TreeView_SetBkColor macro hwnd, clr
	exitm<SNDMSG(hwnd, TVM_SETBKCOLOR, 0, clr)>
	endm

define TVM_SETTEXTCOLOR		(TV_FIRST + 30)
TreeView_SetTextColor macro hwnd, clr
	exitm<SNDMSG(hwnd, TVM_SETTEXTCOLOR, 0, clr)>
	endm

define TVM_GETBKCOLOR		(TV_FIRST + 31)
TreeView_GetBkColor macro hwnd
	exitm<SNDMSG(hwnd, TVM_GETBKCOLOR, 0, 0)>
	endm

define TVM_GETTEXTCOLOR		(TV_FIRST + 32)
TreeView_GetTextColor macro hwnd
	exitm<SNDMSG(hwnd, TVM_GETTEXTCOLOR, 0, 0)>
	endm

define TVM_SETSCROLLTIME	(TV_FIRST + 33)
TreeView_SetScrollTime macro hwnd, uTime
	exitm<SNDMSG(hwnd, TVM_SETSCROLLTIME, uTime, 0)>
	endm

define TVM_GETSCROLLTIME	(TV_FIRST + 34)
TreeView_GetScrollTime macro hwnd
	exitm<SNDMSG(hwnd, TVM_GETSCROLLTIME, 0, 0)>
	endm

if (_WIN32_IE GE 0x0400)
define TVM_SETINSERTMARKCOLOR	(TV_FIRST + 37)
TreeView_SetInsertMarkColor macro hwnd, clr
	exitm<SNDMSG(hwnd, TVM_SETINSERTMARKCOLOR, 0, clr)>
	endm
define TVM_GETINSERTMARKCOLOR	(TV_FIRST + 38)
TreeView_GetInsertMarkColor macro hwnd
	exitm<SNDMSG(hwnd, TVM_GETINSERTMARKCOLOR, 0, 0)>
	endm
endif

define TVM_SETBORDER		(TV_FIRST + 35)
TreeView_SetBorder macro hwnd,	dwFlags, xBorder, yBorder
	exitm<SNDMSG(hwnd, TVM_SETBORDER, dwFlags, MAKELPARAM(xBorder, yBorder))>
	endm

define TVSBF_XBORDER		0x00000001
define TVSBF_YBORDER		0x00000002

define TVM_GETITEMSTATE		(TV_FIRST + 39)
TreeView_GetItemState macro hwndTV, hti, mask
	exitm<SNDMSG(hwndTV, TVM_GETITEMSTATE, hti, mask)>
	endm

define TVM_SETLINECOLOR		(TV_FIRST + 40)
TreeView_SetLineColor macro hwnd, clr
	exitm<SNDMSG(hwnd, TVM_SETLINECOLOR, 0, clr)>
	endm

define TVM_GETLINECOLOR		(TV_FIRST + 41)
TreeView_GetLineColor macro hwnd
	exitm<SNDMSG(hwnd, TVM_GETLINECOLOR, 0, 0)>
	endm

if (NTDDI_VERSION ge NTDDI_WINXP)
define TVM_MAPACCIDTOHTREEITEM	(TV_FIRST + 42)
TreeView_MapAccIDToHTREEITEM macro hwnd, id
	exitm<SNDMSG(hwnd, TVM_MAPACCIDTOHTREEITEM, id, 0)>
	endm

define TVM_MAPHTREEITEMTOACCID	(TV_FIRST + 43)
TreeView_MapHTREEITEMToAccID macro hwnd, htreeitem
	exitm<SNDMSG(hwnd, TVM_MAPHTREEITEMTOACCID, htreeitem, 0)>
	endm

define TVM_SETEXTENDEDSTYLE	(TV_FIRST + 44)
TreeView_SetExtendedStyle macro hwnd, w, mask
	exitm<SNDMSG(hwnd, TVM_SETEXTENDEDSTYLE, mask, w)>
	endm

define TVM_GETEXTENDEDSTYLE	(TV_FIRST + 45)
TreeView_GetExtendedStyle macro hwnd
	exitm<SNDMSG(hwnd, TVM_GETEXTENDEDSTYLE, 0, 0)>
	endm

define TVM_SETAUTOSCROLLINFO	(TV_FIRST + 59)
TreeView_SetAutoScrollInfo macro hwnd, uPixPerSec, uUpdateTime
	exitm<SNDMSG(hwnd, TVM_SETAUTOSCROLLINFO, uPixPerSec, uUpdateTime)>
	endm
endif

define TVM_SETHOT		(TV_FIRST + 58)
TreeView_SetHot macro hwnd, hitem
	exitm<SNDMSG(hwnd, TVM_SETHOT, 0, hitem)>
	endm

if (NTDDI_VERSION ge NTDDI_VISTA)
define TVM_GETSELECTEDCOUNT	(TV_FIRST + 70)
TreeView_GetSelectedCount macro hwnd
	exitm<SNDMSG(hwnd, TVM_GETSELECTEDCOUNT, 0, 0)>
	endm

define TVM_SHOWINFOTIP		(TV_FIRST + 71)
TreeView_ShowInfoTip macro hwnd, hitem
	exitm<SNDMSG(hwnd, TVM_SHOWINFOTIP, 0, hitem)>
	endm

.enum TVITEMPART {
	TVGIPR_BUTTON  = 0x0001,
	}

TVGETITEMPARTRECTINFO	struct
hti			HTREEITEM ?
prc			ptr RECT ?
partID			TVITEMPART ?
TVGETITEMPARTRECTINFO	ends

define TVM_GETITEMPARTRECT	(TV_FIRST + 72)

endif

endif

CALLBACK(PFNTVCOMPARE, lParam1:LPARAM, lParam2:LPARAM, lParamSort:LPARAM)

TVSORTCB		STRUC
hParent			HTREEITEM ?
lpfnCompare		PFNTVCOMPARE ?
lParam			LPARAM ?
TVSORTCB		ENDS
LPTVSORTCB		typedef ptr TVSORTCB
if (_WIN32_IE GE 0x0300)
LPTV_SORTCB		typedef LPTVSORTCB
TV_SORTCB		typedef TVSORTCB
else
TVSORTCB		typedef TV_SORTCB
LPTVSORTCB		typedef LPTV_SORTCB
endif

NMTREEVIEWA		STRUC
hdr			NMHDR <>
action			UINT ?
itemOld			TVITEMA <>
itemNew			TVITEMA <>
ptDrag			POINT <>
NMTREEVIEWA		ENDS
LPNMTREEVIEWA		typedef ptr NMTREEVIEWA

NMTREEVIEWW		STRUC
hdr			NMHDR <>
action			UINT ?
itemOld			TVITEMW <>
itemNew			TVITEMW <>
ptDrag			POINT <>
NMTREEVIEWW		ENDS
LPNMTREEVIEWW		typedef ptr NMTREEVIEWW

ifdef _UNICODE
NMTREEVIEW		typedef NMTREEVIEWW
LPNMTREEVIEW		typedef LPNMTREEVIEWW
else
NMTREEVIEW		typedef NMTREEVIEWA
LPNMTREEVIEW		typedef LPNMTREEVIEWA
endif
if (_WIN32_IE GE 0x0300)
NM_TREEVIEWW		typedef NMTREEVIEWW
NM_TREEVIEWA		typedef NMTREEVIEWA
LPNM_TREEVIEWA		typedef LPNMTREEVIEWA
LPNM_TREEVIEWW		typedef LPNMTREEVIEWW
else
NMTREEVIEWA		typedef NM_TREEVIEWA
NMTREEVIEWW		typedef NM_TREEVIEWW
LPNMTREEVIEWA		typedef LPNM_TREEVIEWA
LPNMTREEVIEWW		typedef LPNM_TREEVIEWW
endif
NM_TREEVIEW		typedef NMTREEVIEW
LPNM_TREEVIEW		typedef LPNMTREEVIEW

define TVN_SELCHANGINGA (TVN_FIRST-1)
define TVN_SELCHANGINGW (TVN_FIRST-50)
define TVN_SELCHANGEDA	(TVN_FIRST-2)
define TVN_SELCHANGEDW	(TVN_FIRST-51)

define TVC_UNKNOWN	0x0000
define TVC_BYMOUSE	0x0001
define TVC_BYKEYBOARD	0x0002

define TVN_GETDISPINFOA (TVN_FIRST-3)
define TVN_GETDISPINFOW (TVN_FIRST-52)
define TVN_SETDISPINFOA (TVN_FIRST-4)
define TVN_SETDISPINFOW (TVN_FIRST-53)

define TVIF_DI_SETITEM	0x1000

NMTVDISPINFOA		STRUC
hdr			NMHDR <>
item			TVITEMA <>
NMTVDISPINFOA		ENDS
LPNMTVDISPINFOA		typedef ptr NMTVDISPINFOA

NMTVDISPINFOW		STRUC
hdr			NMHDR <>
item			TVITEMW <>
NMTVDISPINFOW		ENDS
LPNMTVDISPINFOW		typedef ptr NMTVDISPINFOW
ifdef _UNICODE
NMTVDISPINFO		typedef NMTVDISPINFOW
LPNMTVDISPINFO		typedef LPNMTVDISPINFOW
else
NMTVDISPINFO		typedef NMTVDISPINFOA
LPNMTVDISPINFO		typedef LPNMTVDISPINFOA
endif
if (_WIN32_IE GE 0x0300)
TV_DISPINFOA		typedef NMTVDISPINFOA
TV_DISPINFOW		typedef NMTVDISPINFOW
else
NMTVDISPINFOA		typedef TV_DISPINFOA
NMTVDISPINFOW		typedef TV_DISPINFOW
endif
TV_DISPINFO		typedef NMTVDISPINFO


if (_WIN32_IE GE 0x0600)
NMTVDISPINFOEXA		STRUC
hdr			NMHDR <>
item			TVITEMEXA <>
NMTVDISPINFOEXA		ENDS
LPNMTVDISPINFOEXA	typedef ptr NMTVDISPINFOEXA

NMTVDISPINFOEXW		STRUC
hdr			NMHDR <>
item			TVITEMEXW <>
NMTVDISPINFOEXW		ENDS
LPNMTVDISPINFOEXW	typedef ptr NMTVDISPINFOEXW

ifdef _UNICODE
NMTVDISPINFOEX		typedef NMTVDISPINFOEXW
LPNMTVDISPINFOEX	typedef LPNMTVDISPINFOEXW
else
NMTVDISPINFOEX		typedef NMTVDISPINFOEXA
LPNMTVDISPINFOEX	typedef LPNMTVDISPINFOEXA
endif
TV_DISPINFOEXA		typedef NMTVDISPINFOEXA
TV_DISPINFOEXW		typedef NMTVDISPINFOEXW
TV_DISPINFOEX		typedef NMTVDISPINFOEX
endif ; (_WIN32_IE GE 0x0600)

define TVN_ITEMEXPANDINGA	(TVN_FIRST-5)
define TVN_ITEMEXPANDINGW	(TVN_FIRST-54)
define TVN_ITEMEXPANDEDA	(TVN_FIRST-6)
define TVN_ITEMEXPANDEDW	(TVN_FIRST-55)
define TVN_BEGINDRAGA		(TVN_FIRST-7)
define TVN_BEGINDRAGW		(TVN_FIRST-56)
define TVN_BEGINRDRAGA		(TVN_FIRST-8)
define TVN_BEGINRDRAGW		(TVN_FIRST-57)
define TVN_DELETEITEMA		(TVN_FIRST-9)
define TVN_DELETEITEMW		(TVN_FIRST-58)
define TVN_BEGINLABELEDITA	(TVN_FIRST-10)
define TVN_BEGINLABELEDITW	(TVN_FIRST-59)
define TVN_ENDLABELEDITA	(TVN_FIRST-11)
define TVN_ENDLABELEDITW	(TVN_FIRST-60)
define TVN_KEYDOWN		(TVN_FIRST-12)

if (_WIN32_IE GE 0x0400)
define TVN_GETINFOTIPA		(TVN_FIRST-13)
define TVN_GETINFOTIPW		(TVN_FIRST-14)
define TVN_SINGLEEXPAND		(TVN_FIRST-15)
endif

define TVNRET_DEFAULT		0
define TVNRET_SKIPOLD		1
define TVNRET_SKIPNEW		2

if (_WIN32_IE GE 0x0600)
define TVN_ITEMCHANGINGA	(TVN_FIRST-16)
define TVN_ITEMCHANGINGW	(TVN_FIRST-17)
define TVN_ITEMCHANGEDA		(TVN_FIRST-18)
define TVN_ITEMCHANGEDW		(TVN_FIRST-19)
define TVN_ASYNCDRAW		(TVN_FIRST-20)
endif

.pragma pack(push, 1)

NMTVKEYDOWN		STRUC
hdr			NMHDR <>
wVKey			dw ?
flags			UINT ?
NMTVKEYDOWN		ENDS
LPNMTVKEYDOWN		typedef ptr NMTVKEYDOWN

.pragma pack(pop)
if (_WIN32_IE GE 0x0300)
TV_KEYDOWN		typedef NMTVKEYDOWN
else
NMTVKEYDOWN		typedef TV_KEYDOWN
endif

ifdef _UNICODE
define TVN_SELCHANGING		TVN_SELCHANGINGW
define TVN_SELCHANGED		TVN_SELCHANGEDW
define TVN_GETDISPINFO		TVN_GETDISPINFOW
define TVN_SETDISPINFO		TVN_SETDISPINFOW
define TVN_ITEMEXPANDING	TVN_ITEMEXPANDINGW
define TVN_ITEMEXPANDED		TVN_ITEMEXPANDEDW
define TVN_BEGINDRAG		TVN_BEGINDRAGW
define TVN_BEGINRDRAG		TVN_BEGINRDRAGW
define TVN_DELETEITEM		TVN_DELETEITEMW
define TVN_BEGINLABELEDIT	TVN_BEGINLABELEDITW
define TVN_ENDLABELEDIT		TVN_ENDLABELEDITW
else
define TVN_SELCHANGING		TVN_SELCHANGINGA
define TVN_SELCHANGED		TVN_SELCHANGEDA
define TVN_GETDISPINFO		TVN_GETDISPINFOA
define TVN_SETDISPINFO		TVN_SETDISPINFOA
define TVN_ITEMEXPANDING	TVN_ITEMEXPANDINGA
define TVN_ITEMEXPANDED		TVN_ITEMEXPANDEDA
define TVN_BEGINDRAG		TVN_BEGINDRAGA
define TVN_BEGINRDRAG		TVN_BEGINRDRAGA
define TVN_DELETEITEM		TVN_DELETEITEMA
define TVN_BEGINLABELEDIT	TVN_BEGINLABELEDITA
define TVN_ENDLABELEDIT		TVN_ENDLABELEDITA
endif

if (_WIN32_IE GE 0x0300)
NMTVCUSTOMDRAW		STRUC
nmcd			NMCUSTOMDRAW <>
clrText			COLORREF ?
clrTextBk		COLORREF ?
if (_WIN32_IE GE 0x0400)
iLevel			SINT ?
endif
NMTVCUSTOMDRAW		ENDS
LPNMTVCUSTOMDRAW	typedef ptr NMTVCUSTOMDRAW
define NMTVCUSTOMDRAW_V3_SIZE CCSIZEOF_STRUCT(NMTVCUSTOMDRAW, clrTextBk)
endif

if (_WIN32_IE GE 0x0400)
NMTVGETINFOTIPA		STRUC
hdr			NMHDR <>
pszText			LPSTR ?
cchTextMax		SINT ?
hItem			HTREEITEM ?
lParam			LPARAM ?
NMTVGETINFOTIPA		ENDS
LPNMTVGETINFOTIPA	typedef ptr NMTVGETINFOTIPA

NMTVGETINFOTIPW		STRUC
hdr			NMHDR <>
pszText			LPWSTR ?
cchTextMax		SINT ?
hItem			HTREEITEM ?
lParam			LPARAM ?
NMTVGETINFOTIPW		ENDS
LPNMTVGETINFOTIPW	typedef ptr NMTVGETINFOTIPW

ifdef _UNICODE
define TVN_GETINFOTIP	TVN_GETINFOTIPW
NMTVGETINFOTIP		typedef NMTVGETINFOTIPW
LPNMTVGETINFOTIP	typedef LPNMTVGETINFOTIPW
else
define TVN_GETINFOTIP	TVN_GETINFOTIPA
NMTVGETINFOTIP		typedef NMTVGETINFOTIPA
LPNMTVGETINFOTIP	typedef LPNMTVGETINFOTIPA
endif
define TVCDRF_NOIMAGES	0x00010000
endif

if (_WIN32_IE GT 0x0600)
NMTVITEMCHANGE		STRUC
hdr			NMHDR <>
uChanged		UINT ?
hItem			HTREEITEM ?
uStateNew		UINT ?
uStateOld		UINT ?
lParam			LPARAM ?
NMTVITEMCHANGE		ENDS

NMTVASYNCDRAW		STRUC
hdr			NMHDR <>
pimldp			PVOID ?		; IMAGELISTDRAWPARAMS * the draw that failed
hr			HRESULT ?	; why it failed
hItem			HTREEITEM ?	; item that failed to draw icon
lParam			LPARAM ?	; its data
dwRetFlags		DWORD ?		; What listview should do on return
iRetImageIndex		SINT ?		; used if ADRF_DRAWIMAGE is returned
NMTVASYNCDRAW		ENDS

ifdef _UNICODE
define TVN_ITEMCHANGING TVN_ITEMCHANGINGW
define TVN_ITEMCHANGED	TVN_ITEMCHANGEDW
else
define TVN_ITEMCHANGING TVN_ITEMCHANGINGA
define TVN_ITEMCHANGED	TVN_ITEMCHANGEDA
endif
endif

endif

if (_WIN32_IE GE 0x0300)
ifndef NOUSEREXCONTROLS

define WC_COMBOBOXEX		<"ComboBoxEx32">

define CBEIF_TEXT		0x00000001
define CBEIF_IMAGE		0x00000002
define CBEIF_SELECTEDIMAGE	0x00000004
define CBEIF_OVERLAY		0x00000008
define CBEIF_INDENT		0x00000010
define CBEIF_LPARAM		0x00000020

define CBEIF_DI_SETITEM		0x10000000

COMBOBOXEXITEMA		STRUC
mask			UINT ?
iItem			INT_PTR ?
pszText			LPSTR ?
cchTextMax		SINT ?
iImage			SINT ?
iSelectedImage		SINT ?
iOverlay		SINT ?
iIndent			SINT ?
lParam			LPARAM ?
COMBOBOXEXITEMA		ENDS
PCOMBOBOXEXITEMA	typedef ptr COMBOBOXEXITEMA
PCCOMBOEXITEMA		typedef ptr COMBOBOXEXITEMA

COMBOBOXEXITEMW		STRUC
mask			UINT ?
iItem			INT_PTR ?
pszText			LPWSTR ?
cchTextMax		SINT ?
iImage			SINT ?
iSelectedImage		SINT ?
iOverlay		SINT ?
iIndent			SINT ?
lParam			LPARAM ?
COMBOBOXEXITEMW		ENDS
PCOMBOBOXEXITEMW	typedef ptr COMBOBOXEXITEMW
PCCOMBOEXITEMW		typedef ptr COMBOBOXEXITEMW

ifdef _UNICODE
COMBOBOXEXITEM		typedef COMBOBOXEXITEMW
PCOMBOBOXEXITEM		typedef PCOMBOBOXEXITEMW
else
COMBOBOXEXITEM		typedef COMBOBOXEXITEMA
PCOMBOBOXEXITEM		typedef PCOMBOBOXEXITEMA
endif

define CBEM_INSERTITEMA		(WM_USER + 1)
define CBEM_SETIMAGELIST	(WM_USER + 2)
define CBEM_GETIMAGELIST	(WM_USER + 3)
define CBEM_GETITEMA		(WM_USER + 4)
define CBEM_SETITEMA		(WM_USER + 5)
define CBEM_DELETEITEM		CB_DELETESTRING
define CBEM_GETCOMBOCONTROL	(WM_USER + 6)
define CBEM_GETEDITCONTROL	(WM_USER + 7)
if (_WIN32_IE GE 0x0400)
define CBEM_SETEXSTYLE		(WM_USER + 8)
define CBEM_SETEXTENDEDSTYLE	(WM_USER + 14)
define CBEM_GETEXSTYLE		(WM_USER + 9)
define CBEM_GETEXTENDEDSTYLE	(WM_USER + 9)
define CBEM_SETUNICODEFORMAT	CCM_SETUNICODEFORMAT
define CBEM_GETUNICODEFORMAT	CCM_GETUNICODEFORMAT
else
define CBEM_SETEXSTYLE		(WM_USER + 8)
define CBEM_GETEXSTYLE		(WM_USER + 9)
endif
define CBEM_HASEDITCHANGED	(WM_USER + 10)
define CBEM_INSERTITEMW		(WM_USER + 11)
define CBEM_SETITEMW		(WM_USER + 12)
define CBEM_GETITEMW		(WM_USER + 13)

ifdef _UNICODE
define CBEM_INSERTITEM		CBEM_INSERTITEMW
define CBEM_SETITEM		CBEM_SETITEMW
define CBEM_GETITEM		CBEM_GETITEMW
else
define CBEM_INSERTITEM		CBEM_INSERTITEMA
define CBEM_SETITEM		CBEM_SETITEMA
define CBEM_GETITEM		CBEM_GETITEMA
endif

define CBES_EX_NOEDITIMAGE	0x00000001
define CBES_EX_NOEDITIMAGEINDENT 0x00000002
define CBES_EX_PATHWORDBREAKPROC 0x00000004

if (_WIN32_IE GE 0x0400)
define CBES_EX_NOSIZELIMIT	0x00000008
define CBES_EX_CASESENSITIVE	0x00000010
if (_WIN32_WINNT GE 0x0501)
define CBEM_SETWINDOWTHEME	CCM_SETWINDOWTHEME
endif
if (_WIN32_WINNT GE 0x0600)
define CBES_EX_TEXTENDELLIPSIS	0x00000020
endif
NMCOMBOBOXEXA		STRUC
hdr			NMHDR <>
ceItem			COMBOBOXEXITEMA <>
NMCOMBOBOXEXA		ENDS
PNMCOMBOBOXEXA		typedef ptr NMCOMBOBOXEXA
NMCOMBOBOXEXW		STRUC
hdr			NMHDR <>
ceItem			COMBOBOXEXITEMW <>
NMCOMBOBOXEXW		ENDS
PNMCOMBOBOXEXW		typedef ptr NMCOMBOBOXEXW
ifdef _UNICODE
NMCOMBOBOXEX		typedef NMCOMBOBOXEXW
PNMCOMBOBOXEX		typedef PNMCOMBOBOXEXW
else
NMCOMBOBOXEX		typedef NMCOMBOBOXEXA
PNMCOMBOBOXEX		typedef PNMCOMBOBOXEXA
endif
else
NMCOMBOBOXEX		STRUC
hdr			NMHDR <>
ceItem			COMBOBOXEXITEM ?
NMCOMBOBOXEX		ENDS
PNMCOMBOBOXEX		typedef ptr NMCOMBOBOXEX

define CBEN_GETDISPINFO		(CBEN_FIRST - 0)
endif

if (_WIN32_IE GE 0x0400)
define CBEN_GETDISPINFOA	(CBEN_FIRST - 0)
endif
define CBEN_INSERTITEM		(CBEN_FIRST - 1)
define CBEN_DELETEITEM		(CBEN_FIRST - 2)
define CBEN_BEGINEDIT		(CBEN_FIRST - 4)
define CBEN_ENDEDITA		(CBEN_FIRST - 5)
define CBEN_ENDEDITW		(CBEN_FIRST - 6)

if (_WIN32_IE GE 0x0400)
define CBEN_GETDISPINFOW	(CBEN_FIRST - 7)
endif

ifdef _UNICODE
define CBEN_GETDISPINFO		CBEN_GETDISPINFOW
else
define CBEN_GETDISPINFO		CBEN_GETDISPINFOA
endif

if (_WIN32_IE GE 0x0400)
define CBEN_DRAGBEGINA		(CBEN_FIRST - 8)
define CBEN_DRAGBEGINW		(CBEN_FIRST - 9)
ifdef _UNICODE
define CBEN_DRAGBEGIN		CBEN_DRAGBEGINW
else
define CBEN_DRAGBEGIN		CBEN_DRAGBEGINA
endif
endif

define CBENF_KILLFOCUS		1
define CBENF_RETURN		2
define CBENF_ESCAPE		3
define CBENF_DROPDOWN		4

define CBEMAXSTRLEN		260

if (_WIN32_IE GE 0x0400)

NMCBEDRAGBEGINW		STRUC
hdr			NMHDR <>
iItemid			SINT ?
szText			dw CBEMAXSTRLEN dup(?)
NMCBEDRAGBEGINW		ENDS
LPNMCBEDRAGBEGINW	typedef ptr NMCBEDRAGBEGINW
PNMCBEDRAGBEGINW	typedef ptr NMCBEDRAGBEGINW

NMCBEDRAGBEGINA		STRUC
hdr			NMHDR <>
iItemid			SINT ?
szText			SBYTE CBEMAXSTRLEN dup(?)
NMCBEDRAGBEGINA		ENDS
LPNMCBEDRAGBEGINA	typedef ptr NMCBEDRAGBEGINA
PNMCBEDRAGBEGINA	typedef ptr NMCBEDRAGBEGINA

ifdef _UNICODE
NMCBEDRAGBEGIN		typedef NMCBEDRAGBEGINW
LPNMCBEDRAGBEGIN	typedef LPNMCBEDRAGBEGINW
PNMCBEDRAGBEGIN		typedef PNMCBEDRAGBEGINW
else
NMCBEDRAGBEGIN		typedef NMCBEDRAGBEGINA
LPNMCBEDRAGBEGIN	typedef LPNMCBEDRAGBEGINA
PNMCBEDRAGBEGIN		typedef PNMCBEDRAGBEGINA
endif
endif

NMCBEENDEDITW		STRUC
hdr			NMHDR <>
fChanged		BOOL ?
iNewSelection		SINT ?
szText			dw CBEMAXSTRLEN dup(?)
iWhy			SINT ?
NMCBEENDEDITW		ENDS
LPNMCBEENDEDITW		typedef ptr NMCBEENDEDITW
PNMCBEENDEDITW		typedef ptr NMCBEENDEDITW

NMCBEENDEDITA		STRUC
hdr			NMHDR <>
fChanged		BOOL ?
iNewSelection		SINT ?
szText			SBYTE CBEMAXSTRLEN dup(?)
iWhy			SINT ?
NMCBEENDEDITA		ENDS
LPNMCBEENDEDITA		typedef ptr NMCBEENDEDITA
PNMCBEENDEDITA		typedef ptr NMCBEENDEDITA

ifdef _UNICODE
NMCBEENDEDIT		typedef NMCBEENDEDITW
LPNMCBEENDEDIT		typedef LPNMCBEENDEDITW
PNMCBEENDEDIT		typedef PNMCBEENDEDITW
else
NMCBEENDEDIT		typedef NMCBEENDEDITA
LPNMCBEENDEDIT		typedef LPNMCBEENDEDITA
PNMCBEENDEDIT		typedef PNMCBEENDEDITA
endif

endif
endif

ifndef NOTABCONTROL

ifdef _WIN32
define WC_TABCONTROL		<"SysTabControl32">
else
define WC_TABCONTROL		<"SysTabControl">
endif

if (_WIN32_IE GE 0x0300)
define TCS_SCROLLOPPOSITE	0x0001
define TCS_BOTTOM		0x0002
define TCS_RIGHT		0x0002
define TCS_MULTISELECT		0x0004
endif
if (_WIN32_IE GE 0x0400)
define TCS_FLATBUTTONS		0x0008
endif
define TCS_FORCEICONLEFT	0x0010
define TCS_FORCELABELLEFT	0x0020
if (_WIN32_IE GE 0x0300)
define TCS_HOTTRACK		0x0040
define TCS_VERTICAL		0x0080
endif
define TCS_TABS			0x0000
define TCS_BUTTONS		0x0100
define TCS_SINGLELINE		0x0000
define TCS_MULTILINE		0x0200
define TCS_RIGHTJUSTIFY		0x0000
define TCS_FIXEDWIDTH		0x0400
define TCS_RAGGEDRIGHT		0x0800
define TCS_FOCUSONBUTTONDOWN	0x1000
define TCS_OWNERDRAWFIXED	0x2000
define TCS_TOOLTIPS		0x4000
define TCS_FOCUSNEVER		0x8000

if (_WIN32_IE GE 0x0400)
define TCS_EX_FLATSEPARATORS	0x00000001
define TCS_EX_REGISTERDROP	0x00000002
endif

define TCM_GETIMAGELIST		(TCM_FIRST + 2)
TabCtrl_GetImageList macro hwnd
	exitm<SNDMSG(hwnd, TCM_GETIMAGEIST, 0, 0)>
	endm

define TCM_SETIMAGELIST		(TCM_FIRST + 3)
TabCtrl_SetImageList macro hwnd, himl
	exitm<SNDMSG(hwnd, TCM_SETIMAGEIST, 0, himl)>
	endm

define TCM_GETITEMCOUNT		(TCM_FIRST + 4)
TabCtrl_GetItemCount macro hwnd
	exitm<SNDMSG(hwnd, TCM_GETITEMCOUNT, 0, 0)>
	endm

define TCIF_TEXT		0x0001
define TCIF_IMAGE		0x0002
define TCIF_RTLREADING		0x0004
define TCIF_PARAM		0x0008
if (_WIN32_IE GE 0x0300)
define TCIF_STATE		0x0010
define TCIS_BUTTONPRESSED	0x0001
endif
if (_WIN32_IE GE 0x0400)
define TCIS_HIGHLIGHTED		0x0002
endif

TCITEMHEADERA		STRUC
mask			UINT ?
lpReserved1		UINT ?
lpReserved2		UINT ?
pszText			LPSTR ?
cchTextMax		SINT ?
iImage			SINT ?
TCITEMHEADERA		ENDS
LPTCITEMHEADERA		typedef ptr TCITEMHEADERA

TCITEMHEADERW		STRUC
mask			UINT ?
lpReserved1		UINT ?
lpReserved2		UINT ?
pszText			LPWSTR ?
cchTextMax		SINT ?
iImage			SINT ?
TCITEMHEADERW		ENDS
LPTCITEMHEADERW		typedef ptr TCITEMHEADERW

ifdef _UNICODE
TCITEMHEADER		typedef TCITEMHEADERW
LPTCITEMHEADER		typedef LPTCITEMHEADERW
else
TCITEMHEADER		typedef TCITEMHEADERA
LPTCITEMHEADER		typedef LPTCITEMHEADERA
endif
if (_WIN32_IE GE 0x0300)
TC_ITEMHEADERA		typedef TCITEMHEADERA
TC_ITEMHEADERW		typedef TCITEMHEADERW
else
TCITEMHEADERA		typedef TC_ITEMHEADERA
TCITEMHEADERW		typedef TC_ITEMHEADERW
endif
TC_ITEMHEADER		typedef TCITEMHEADER

TCITEMA			STRUC
mask			UINT ?
if (_WIN32_IE GE 0x0300)
dwState			dd ?
dwStateMask		dd ?
else
lpReserved1		UINT ?
lpReserved2		UINT ?
endif
pszText			LPSTR ?
cchTextMax		SINT ?
iImage			SINT ?
lParam			LPARAM ?
TCITEMA			ENDS
LPTCITEMA		typedef ptr TCITEMA

TCITEMW			STRUC
mask			UINT ?
if (_WIN32_IE GE 0x0300)
dwState			dd ?
dwStateMask		dd ?
else
lpReserved1		UINT ?
lpReserved2		UINT ?
endif
pszText			LPWSTR ?
cchTextMax		SINT ?
iImage			SINT ?
lParam			LPARAM ?
TCITEMW			ENDS
LPTCITEMW		typedef ptr TCITEMW

ifdef _UNICODE
TCITEM			typedef TCITEMW
LPTCITEM		typedef LPTCITEMW
else
TCITEM			typedef TCITEMA
LPTCITEM		typedef LPTCITEMA
endif
if (_WIN32_IE GE 0x0300)
TC_ITEMA		typedef TCITEMA
TC_ITEMW		typedef TCITEMW
else
TCITEMA			typedef TC_ITEMA
TCITEMW			typedef TC_ITEMW
endif
TC_ITEM			typedef TCITEM

define TCM_GETITEMA	(TCM_FIRST + 5)
define TCM_GETITEMW	(TCM_FIRST + 60)
ifdef _UNICODE
define TCM_GETITEM	TCM_GETITEMW
else
define TCM_GETITEM	TCM_GETITEMA
endif

TabCtrl_GetItem macro hwnd, iItem, pitem
	exitm<SNDMSG(hwnd, TCM_GETITEM, iItem, pitem)>
	endm

define TCM_SETITEMA	(TCM_FIRST + 6)
define TCM_SETITEMW	(TCM_FIRST + 61)
ifdef _UNICODE
define TCM_SETITEM	TCM_SETITEMW
else
define TCM_SETITEM	TCM_SETITEMA
endif

TabCtrl_SetItem macro hwnd, iItem, pitem
	exitm<SNDMSG(hwnd, TCM_SETITEM, iItem, pitem)>
	endm

define TCM_INSERTITEMA	(TCM_FIRST + 7)
define TCM_INSERTITEMW	(TCM_FIRST + 62)
ifdef _UNICODE
define TCM_INSERTITEM	TCM_INSERTITEMW
else
define TCM_INSERTITEM	TCM_INSERTITEMA
endif

TabCtrl_InsertItem macro hwnd, iItem, pitem
	exitm<SNDMSG(hwnd, TCM_INSERTITEM, iItem, pitem)>
	endm

define TCM_DELETEITEM		(TCM_FIRST + 8)
TabCtrl_DeleteItem macro hwnd, i
	exitm<SNDMSG(hwnd, TCM_DEETEITEM, i, 0)>
	endm

define TCM_DELETEALLITEMS	(TCM_FIRST + 9)
TabCtrl_DeleteAllItems macro hwnd
	exitm<SNDMSG(hwnd, TCM_DELETEALLITEMS, 0, 0)>
	endm

define TCM_GETITEMRECT		(TCM_FIRST + 10)
TabCtrl_GetItemRect macro hwnd, i, prc
	exitm<SNDMSG(hwnd, TCM_GETITEMRECT, i, prc)>
	endm

define TCM_GETCURSEL		(TCM_FIRST + 11)
TabCtrl_GetCurSel macro hwnd
	exitm<SNDMSG(hwnd, TCM_GETCURSE, 0, 0)>
	endm

define TCM_SETCURSEL		(TCM_FIRST + 12)
TabCtrl_SetCurSel macro hwnd, i
	exitm<SNDMSG(hwnd, TCM_SETCURSE, i, 0)>
	endm

define TCHT_NOWHERE		0x0001
define TCHT_ONITEMICON		0x0002
define TCHT_ONITEMLABEL		0x0004
define TCHT_ONITEM		(TCHT_ONITEMICON or TCHT_ONITEMLABEL)

TCHITTESTINFO		STRUC
pt			POINT <>
flags			UINT ?
TCHITTESTINFO		ENDS
LPTCHITTESTINFO		typedef ptr TCHITTESTINFO
if (_WIN32_IE GE 0x0300)
LPTC_HITTESTINFO	typedef LPTCHITTESTINFO
TC_HITTESTINFO		typedef TCHITTESTINFO
else
TCHITTESTINFO		typedef TC_HITTESTINFO
LPTCHITTESTINFO		typedef LPTC_HITTESTINFO
endif

define TCM_HITTEST		(TCM_FIRST + 13)
TabCtrl_HitTest macro hwndTC, pinfo
	exitm<SNDMSG((hwndTC), TCM_HITTEST, 0, pinfo)>
	endm

define TCM_SETITEMEXTRA		(TCM_FIRST + 14)
TabCtrl_SetItemExtra macro hwndTC, cb
	exitm<SNDMSG((hwndTC), TCM_SETITEMEXTRA, cb, 0)>
	endm

define TCM_ADJUSTRECT		(TCM_FIRST + 40)
TabCtrl_AdjustRect macro hwnd, bLarger, prc
	exitm<SNDMSG(hwnd, TCM_ADJUSTRECT, barger, prc)>
	endm

define TCM_SETITEMSIZE		(TCM_FIRST + 41)
TabCtrl_SetItemSize macro hwnd, x, y
	exitm<SNDMSG(hwnd, TCM_SETITEMSIZE, 0, MAKEPARAM(x,y))>
	endm

define TCM_REMOVEIMAGE		(TCM_FIRST + 42)
TabCtrl_RemoveImage macro hwnd, i
	exitm<SNDMSG(hwnd, TCM_REMOVEIMAGE, i, 0)>
	endm

define TCM_SETPADDING		(TCM_FIRST + 43)
TabCtrl_SetPadding macro hwnd, _cx, cy
	exitm<SNDMSG(hwnd, TCM_SETPADDING, 0, MAKEPARAM(_cx, cy))>
	endm

define TCM_GETROWCOUNT		(TCM_FIRST + 44)
TabCtrl_GetRowCount macro hwnd
	exitm<SNDMSG(hwnd, TCM_GETROWCOUNT, 0, 0)>
	endm

define TCM_GETTOOLTIPS		(TCM_FIRST + 45)
TabCtrl_GetToolTips macro hwnd
	exitm<SNDMSG(hwnd, TCM_GETTOOLTIPS, 0, 0)>
	endm

define TCM_SETTOOLTIPS		(TCM_FIRST + 46)
TabCtrl_SetToolTips macro hwnd, hwndTT
	exitm<SNDMSG(hwnd, TCM_SETTOOLTIPS, hwndTT, 0)>
	endm

define TCM_GETCURFOCUS		(TCM_FIRST + 47)
TabCtrl_GetCurFocus macro hwnd
	exitm<SNDMSG(hwnd, TCM_GETCURFOCUS, 0, 0)>
	endm

define TCM_SETCURFOCUS		(TCM_FIRST + 48)
TabCtrl_SetCurFocus macro hwnd, i
	exitm<SNDMSG(hwnd,TCM_SETCURFOCUS, i, 0)>
	endm

if (_WIN32_IE GE 0x0300)
define TCM_SETMINTABWIDTH	(TCM_FIRST + 49)
TabCtrl_SetMinTabWidth macro hwnd, x
	exitm<SNDMSG(hwnd, TCM_SETMINTABWIDTH, 0, x)>
	endm

define TCM_DESELECTALL		(TCM_FIRST + 50)
TabCtrl_DeselectAll macro hwnd, fExcludeFocus
	exitm<SNDMSG(hwnd, TCM_DESELECTALL, fExcludeFocus, 0)>
	endm
endif

if (_WIN32_IE GE 0x0400)

define TCM_HIGHLIGHTITEM	(TCM_FIRST + 51)
TabCtrl_HighlightItem macro hwnd, i, fHighlight
	exitm<SNDMSG(hwnd, TCM_HIGHLIGHTITEM, i, MAKELONG(fHighlight, 0))>
	endm

define TCM_SETEXTENDEDSTYLE	(TCM_FIRST + 52)
TabCtrl_SetExtendedStyle macro hwnd, w
	exitm<SNDMSG(hwnd, TCM_SETEXTENDEDSTYLE, 0, w)>
	endm

define TCM_GETEXTENDEDSTYLE	(TCM_FIRST + 53)
TabCtrl_GetExtendedStyle macro hwnd
	exitm<SNDMSG(hwnd, TCM_GETEXTENDEDSTYLE, 0, 0)>
	endm

define TCM_SETUNICODEFORMAT	CCM_SETUNICODEFORMAT
TabCtrl_SetUnicodeFormat macro hwnd, fUnicode
	exitm<SNDMSG(hwnd, TCM_SETUNICODEFORMAT, fUnicode, 0)>
	endm

define TCM_GETUNICODEFORMAT	CCM_GETUNICODEFORMAT
TabCtrl_GetUnicodeFormat macro hwnd
	exitm<SNDMSG(hwnd, TCM_GETUNICODEFORMAT, 0, 0)>
	endm

endif

define TCN_KEYDOWN	(TCN_FIRST - 0)

.pragma pack(push, 1)

NMTCKEYDOWN		STRUC
hdr			NMHDR <>
wVKey			dw ?
flags			UINT ?
NMTCKEYDOWN		ENDS

.pragma pack(pop)

if (_WIN32_IE GE 0x0300)
TC_KEYDOWN		typedef NMTCKEYDOWN
else
NMTCKEYDOWN		typedef TC_KEYDOWN
endif

define TCN_SELCHANGE		(TCN_FIRST - 1)
define TCN_SELCHANGING		(TCN_FIRST - 2)
if (_WIN32_IE GE 0x0400)
define TCN_GETOBJECT		(TCN_FIRST - 3)
endif
if (_WIN32_IE GE 0x0500)
define TCN_FOCUSCHANGE		(TCN_FIRST - 4)
endif

endif

ifndef NOANIMATE
ifdef _WIN32

define ANIMATE_CLASS		<"SysAnimate32">

define ACS_CENTER		0x0001
define ACS_TRANSPARENT		0x0002
define ACS_AUTOPLAY		0x0004
if (_WIN32_IE GE 0x0300)
define ACS_TIMER		0x0008
endif

define ACM_OPENA		(WM_USER+100)
define ACM_OPENW		(WM_USER+103)
ifdef _UNICODE
define ACM_OPEN			ACM_OPENW
else
define ACM_OPEN			ACM_OPENA
endif

define ACM_PLAY			(WM_USER+101)
define ACM_STOP			(WM_USER+102)
define ACM_ISPLAYING		(WM_USER+104)

define ACN_START		1
define ACN_STOP			2

Animate_Create macro hwndP, id, dwStyle, hInstance
	exitm<CreateWindow(ANIMATE_CLASS,NULL,dwStyle,0,0,0,0,hwndP,id,hInstance,NULL)>
	endm

Animate_Open macro hwnd, szName
	exitm<SNDMSG(hwnd, ACM_OPEN, 0, szName)>
	endm
Animate_OpenEx macro hwnd, hInst, szName
	exitm<SNDMSG(hwnd, ACM_OPEN, hInst,szName)>
	endm
Animate_Play macro hwnd, from, to, _rep
	exitm<SNDMSG(hwnd, ACM_PLAY, _rep, MAKELONG(from, to))>
	endm
Animate_Stop macro hwnd
	exitm<SNDMSG(hwnd, ACM_STOP, 0, 0)>
	endm
Animate_Close macro hwnd
	exitm<Animate_Open(hwnd, NULL)>
	endm
Animate_Seek macro hwnd, _frame
	exitm<Animate_Play(hwnd, _frame, _frame, 1)>
	endm
endif
endif

if (_WIN32_IE GE 0x0300)

ifndef NOMONTHCAL
ifdef _WIN32

define MONTHCAL_CLASS	<"SysMonthCal32">

MONTHDAYSTATE		typedef DWORD
LPMONTHDAYSTATE		typedef ptr DWORD

define MCM_FIRST	0x1000

define MCM_GETCURSEL		(MCM_FIRST + 1)
MonthCal_GetCurSel macro hmc, pst
	exitm<SNDMSG(hmc, MCM_GETCURSEL, 0, pst)>
	endm

define MCM_SETCURSEL		(MCM_FIRST + 2)
MonthCal_SetCurSel macro hmc, pst
	exitm<SNDMSG(hmc, MCM_SETCURSEL, 0, pst)>
	endm

define MCM_GETMAXSELCOUNT	(MCM_FIRST + 3)
MonthCal_GetMaxSelCount macro hmc
	exitm<SNDMSG(hmc, MCM_GETMAXSELCOUNT, 0, 0)>
	endm

define MCM_SETMAXSELCOUNT	(MCM_FIRST + 4)
MonthCal_SetMaxSelCount macro hmc, n
	exitm<SNDMSG(hmc, MCM_SETMAXSELCOUNT, n, 0)>
	endm

define MCM_GETSELRANGE		(MCM_FIRST + 5)
MonthCal_GetSelRange macro hmc, rgst
	exitm<SNDMSG(hmc, MCM_GETSELRANGE, 0, rgst)>
	endm

define MCM_SETSELRANGE		(MCM_FIRST + 6)
MonthCal_SetSelRange macro hmc, rgst
	exitm<SNDMSG(hmc, MCM_SETSELRANGE, 0, rgst)>
	endm

define MCM_GETMONTHRANGE	(MCM_FIRST + 7)
MonthCal_GetMonthRange macro hmc, gmr, rgst
	exitm<SNDMSG(hmc, MCM_GETMONTHRANGE, gmr, rgst)>
	endm

define MCM_SETDAYSTATE		(MCM_FIRST + 8)
MonthCal_SetDayState macro hmc, cbds, rgds
	exitm<SNDMSG(hmc, MCM_SETDAYSTATE, cbds, rgds)>
	endm

define MCM_GETMINREQRECT	(MCM_FIRST + 9)
MonthCal_GetMinReqRect macro hmc, prc
	exitm<SNDMSG(hmc, MCM_GETMINREQRECT, 0, prc)>
	endm

define MCM_SETCOLOR		(MCM_FIRST + 10)
MonthCal_SetColor macro hmc, iColor, clr
	exitm<SNDMSG(hmc, MCM_SETCOLOR, iColor, clr)>
	endm

define MCM_GETCOLOR		(MCM_FIRST + 11)
MonthCal_GetColor macro hmc, iColor
	exitm<SNDMSG(hmc, MCM_SETCOLOR, iColor, 0)>
	endm

define MCSC_BACKGROUND		0
define MCSC_TEXT		1
define MCSC_TITLEBK		2
define MCSC_TITLETEXT		3
define MCSC_MONTHBK		4
define MCSC_TRAILINGTEXT	5

define MCM_SETTODAY		(MCM_FIRST + 12)
MonthCal_SetToday macro hmc, pst
	exitm<SNDMSG(hmc, MCM_SETTODAY, 0, pst)>
	endm

define MCM_GETTODAY		(MCM_FIRST + 13)
MonthCal_GetToday macro hmc, pst
	exitm<SNDMSG(hmc, MCM_GETTODAY, 0, pst)>
	endm

define MCM_HITTEST		(MCM_FIRST + 14)
MonthCal_HitTest macro hmc, pinfo
	exitm<SNDMSG(hmc, MCM_HITTEST, 0, pinfo)>
	endm

MCHITTESTINFO		STRUC
cbSize			UINT ?
pt			POINT <>
uHit			UINT ?
_st			SYSTEMTIME <>
if (NTDDI_VERSION GE NTDDI_VISTA)
rc			RECT <>
iOffset			SINT ?
iRow			SINT ?
iCol			SINT ?
endif
MCHITTESTINFO		ENDS
PMCHITTESTINFO		typedef ptr MCHITTESTINFO

define MCHITTESTINFO_V1_SIZE	CCSIZEOF_STRUCT(MCHITTESTINFO, st)

define MCHT_TITLE		0x00010000
define MCHT_CALENDAR		0x00020000
define MCHT_TODAYLINK		0x00030000

if (NTDDI_VERSION GE NTDDI_VISTA)
define MCHT_CALENDARCONTROL	0x00100000
endif

define MCHT_NEXT		0x01000000
define MCHT_PREV		0x02000000

define MCHT_NOWHERE		0x00000000

define MCHT_TITLEBK		(MCHT_TITLE)
define MCHT_TITLEMONTH		(MCHT_TITLE or 0x0001)
define MCHT_TITLEYEAR		(MCHT_TITLE or 0x0002)
define MCHT_TITLEBTNNEXT	(MCHT_TITLE or MCHT_NEXT or 0x0003)
define MCHT_TITLEBTNPREV	(MCHT_TITLE or MCHT_PREV or 0x0003)

define MCHT_CALENDARBK		(MCHT_CALENDAR)
define MCHT_CALENDARDATE	(MCHT_CALENDAR or 0x0001)
define MCHT_CALENDARDATENEXT	(MCHT_CALENDARDATE or MCHT_NEXT)
define MCHT_CALENDARDATEPREV	(MCHT_CALENDARDATE or MCHT_PREV)
define MCHT_CALENDARDAY		(MCHT_CALENDAR or 0x0002)
define MCHT_CALENDARWEEKNUM	(MCHT_CALENDAR or 0x0003)
define MCHT_CALENDARDATEMIN	(MCHT_CALENDAR or 0x0004)
define MCHT_CALENDARDATEMAX	(MCHT_CALENDAR or 0x0005)

define MCM_SETFIRSTDAYOFWEEK	(MCM_FIRST + 15)
MonthCal_SetFirstDayOfWeek macro hmc, iDay
	exitm<SNDMSG(hmc, MCM_SETFIRSTDAYOFWEEK, 0, iDay)>
	endm

define MCM_GETFIRSTDAYOFWEEK	(MCM_FIRST + 16)
MonthCal_GetFirstDayOfWeek macro hmc
	exitm<SNDMSG(hmc, MCM_GETFIRSTDAYOFWEEK, 0, 0)>
	endm

define MCM_GETRANGE		(MCM_FIRST + 17)
MonthCal_GetRange macro hmc, rgst
	exitm<SNDMSG(hmc, MCM_GETRANGE, 0, rgst)>
	endm

define MCM_SETRANGE		(MCM_FIRST + 18)
MonthCal_SetRange macro hmc, gd, rgst
	exitm<SNDMSG(hmc, MCM_SETRANGE, gd, rgst)>
	endm

define MCM_GETMONTHDELTA	(MCM_FIRST + 19)
MonthCal_GetMonthDelta macro hmc
	exitm<SNDMSG(hmc, MCM_GETMONTHDETA, 0, 0)>
	endm

define MCM_SETMONTHDELTA	(MCM_FIRST + 20)
MonthCal_SetMonthDelta macro hmc, n
	exitm<SNDMSG(hmc, MCM_SETMONTHDETA, n, 0)>
	endm

define MCM_GETMAXTODAYWIDTH	(MCM_FIRST + 21)
MonthCal_GetMaxTodayWidth macro hmc
	exitm<SNDMSG(hmc, MCM_GETMAXTODAYWIDTH, 0, 0)>
	endm

if (_WIN32_IE GE 0x0400)
define MCM_SETUNICODEFORMAT	CCM_SETUNICODEFORMAT
MonthCal_SetUnicodeFormat macro hwnd, fUnicode
	exitm<SNDMSG(hwnd, MCM_SETUNICODEFORMAT, fUnicode, 0)>
	endm

define MCM_GETUNICODEFORMAT	CCM_GETUNICODEFORMAT
MonthCal_GetUnicodeFormat macro hwnd
	exitm<SNDMSG(hwnd, MCM_GETUNICODEFORMAT, 0, 0)>
	endm
endif
if (NTDDI_VERSION GE NTDDI_VISTA)
define MCMV_MONTH		0
define MCMV_YEAR		1
define MCMV_DECADE		2
define MCMV_CENTURY		3
define MCMV_MAX			MCMV_CENTURY

define MCM_GETCURRENTVIEW	(MCM_FIRST + 22)
MonthCal_GetCurrentView macro hmc
	exitm<SNDMSG(hmc, MCM_GETCURRENTVIEW, 0, 0)>
	endm

define MCM_GETCALENDARCOUNT	(MCM_FIRST + 23)
MonthCal_GetCalendarCount macro hmc
	exitm<SNDMSG(hmc, MCM_GETCALENDARCOUNT, 0, 0)>
	endm

define MCGIP_CALENDARCONTROL	0
define MCGIP_NEXT		1
define MCGIP_PREV		2
define MCGIP_FOOTER		3
define MCGIP_CALENDAR		4
define MCGIP_CALENDARHEADER	5
define MCGIP_CALENDARBODY	6
define MCGIP_CALENDARROW	7
define MCGIP_CALENDARCELL	8

define MCGIF_DATE		0x00000001
define MCGIF_RECT		0x00000002
define MCGIF_NAME		0x00000004

MCGRIDINFO		STRUC
cbSize			UINT ?
dwPart			DWORD ?
dwFlags			DWORD ?
iCalendar		SINT ?
iRow			SINT ?
iCol			SINT ?
bSelected		BOOL ?
stStart			SYSTEMTIME <>
stEnd			SYSTEMTIME <>
rc			RECT <>
pszName			PWSTR ?
cchName			size_t ?
MCGRIDINFO		ENDS
PMCGRIDINFO		typedef ptr MCGRIDINFO

define MCM_GETCALENDARGRIDINFO	(MCM_FIRST + 24)
MonthCal_GetCalendarGridInfo macro hmc, pmcGridInfo
	exitm<SNDMSG(hmc, MCM_GETCALENDARGRIDINFO, 0, pmcGridInfo)>
	endm

define MCM_GETCALID		(MCM_FIRST + 27)
MonthCal_GetCALID macro hmc
	exitm<SNDMSG(hmc, MCM_GETCALID, 0, 0)>
	endm

define MCM_SETCALID		(MCM_FIRST + 28)
MonthCal_SetCALID macro hmc, calid
	exitm<SNDMSG(hmc, MCM_SETCALID, calid, 0)>
	endm

define MCM_SIZERECTTOMIN	(MCM_FIRST + 29)
MonthCal_SizeRectToMin macro hmc, prc
	exitm<SNDMSG(hmc, MCM_SIZERECTTOMIN, 0, prc)>
	endm

define MCM_SETCALENDARBORDER	(MCM_FIRST + 30)
MonthCal_SetCalendarBorder macro hmc, fset, xyborder
	exitm<SNDMSG(hmc, MCM_SETCALENDARBORDER, fset, xyborder)>
	endm

define MCM_GETCALENDARBORDER	(MCM_FIRST + 31)
MonthCal_GetCalendarBorder macro hmc
	exitm<SNDMSG(hmc, MCM_GETCALENDARBORDER, 0, 0)>
	endm

define MCM_SETCURRENTVIEW	(MCM_FIRST + 32)
MonthCal_SetCurrentView macro hmc, dwNewView
	exitm<SNDMSG(hmc, MCM_SETCURRENTVIEW, 0, dwNewView)>
	endm

endif

NMSELCHANGE		STRUC
nmhdr			NMHDR <>
stSelStart		SYSTEMTIME <>
stSelEnd		SYSTEMTIME <>
NMSELCHANGE		ENDS
LPNMSELCHANGE		typedef ptr NMSELCHANGE

define MCN_SELCHANGE	(MCN_FIRST - 3)

NMDAYSTATE		STRUC
nmhdr			NMHDR <>
stStart			SYSTEMTIME <>
cDayState		SINT ?
prgDayState		LPMONTHDAYSTATE ?
NMDAYSTATE		ENDS
LPNMDAYSTATE		typedef ptr NMDAYSTATE

define MCN_GETDAYSTATE	(MCN_FIRST - 1)

NMSELECT		typedef NMSELCHANGE
LPNMSELECT		typedef ptr NMSELCHANGE

define MCN_SELECT	(MCN_FIRST)

NMVIEWCHANGE		struct
nmhdr			NMHDR <>
dwOldView		DWORD ?
dwNewView		DWORD ?
NMVIEWCHANGE		ends
LPNMVIEWCHANGE		typedef ptr NMVIEWCHANGE

define MCN_VIEWCHANGE	(MCN_FIRST - 4)

define MCS_DAYSTATE		0x0001
define MCS_MULTISELECT		0x0002
define MCS_WEEKNUMBERS		0x0004
if (_WIN32_IE GE 0x0400)
define MCS_NOTODAYCIRCLE	0x0008
define MCS_NOTODAY		0x0010
else
define MCS_NOTODAY		0x0008
endif
if (NTDDI_VERSION GE NTDDI_VISTA)
define MCS_NOTRAILINGDATES	0x0040
define MCS_SHORTDAYSOFWEEK	0x0080
define MCS_NOSELCHANGEONNAV	0x0100
endif
define GMR_VISIBLE		0
define GMR_DAYSTATE		1

endif
endif

ifndef NODATETIMEPICK
ifdef _WIN32

define DATETIMEPICK_CLASS	<"SysDateTimePick32">

if (NTDDI_VERSION GE NTDDI_VISTA)

DATETIMEPICKERINFO	STRUC
cbSize			DWORD ?
rcCheck			RECT <>
stateCheck		DWORD ?
rcButton		RECT <>
stateButton		DWORD ?
hwndEdit		HWND ?
hwndUD			HWND ?
hwndDropDown		HWND ?
DATETIMEPICKERINFO	ENDS
LPDATETIMEPICKERINFO	typedef ptr DATETIMEPICKERINFO

endif

define DTM_FIRST		0x1000

define DTM_GETSYSTEMTIME	(DTM_FIRST + 1)
DateTime_GetSystemtime macro hdp, pst
	exitm<SNDMSG(hdp, DTM_GETSYSTEMTIME, 0, pst)>
	endm

define DTM_SETSYSTEMTIME	(DTM_FIRST + 2)
DateTime_SetSystemtime macro hdp, gd, pst
	exitm<SNDMSG(hdp, DTM_SETSYSTEMTIME, gd, pst)>
	endm

define DTM_GETRANGE		(DTM_FIRST + 3)
DateTime_GetRange macro hdp, rgst
	exitm<SNDMSG(hdp, DTM_GETRANGE, 0, rgst)>
	endm

define DTM_SETRANGE		(DTM_FIRST + 4)
DateTime_SetRange macro hdp, gd, rgst
	exitm<SNDMSG(hdp, DTM_SETRANGE, gd, rgst)>
	endm

define DTM_SETFORMATA		(DTM_FIRST + 5)
define DTM_SETFORMATW		(DTM_FIRST + 50)
ifdef _UNICODE
define DTM_SETFORMAT		DTM_SETFORMATW
else
define DTM_SETFORMAT		DTM_SETFORMATA
endif

DateTime_SetFormat macro hdp, sz
	exitm<SNDMSG(hdp, DTM_SETFORMAT, 0, sz)>
	endm


define DTM_SETMCCOLOR		(DTM_FIRST + 6)
DateTime_SetMonthCalColor macro hdp, iColor, clr
	exitm<SNDMSG(hdp, DTM_SETMCCOLOR, iColor, clr)>
	endm

define DTM_GETMCCOLOR		(DTM_FIRST + 7)
DateTime_GetMonthCalColor macro hdp, iColor
	exitm<SNDMSG(hdp, DTM_GETMCCOLOR, iColor, 0)>
	endm

define DTM_GETMONTHCAL		(DTM_FIRST + 8)
DateTime_GetMonthCal macro hdp
	exitm<SNDMSG(hdp, DTM_GETMONTHCA, 0, 0)>
	endm

if (_WIN32_IE GE 0x0400)

define DTM_SETMCFONT		(DTM_FIRST + 9)
DateTime_SetMonthCalFont macro hdp, hfont, fRedraw
	exitm<SNDMSG(hdp, DTM_SETMCFONT, hfont, fRedraw)>
	endm

define DTM_GETMCFONT		(DTM_FIRST + 10)
DateTime_GetMonthCalFont macro hdp
	exitm<SNDMSG(hdp, DTM_GETMCFONT, 0, 0)>
	endm

endif

if (NTDDI_VERSION GE NTDDI_VISTA)
define DTM_SETMCSTYLE		(DTM_FIRST + 11)
DateTime_SetMonthCalStyle macro hdp, dwStyle
	exitm<SNDMSG(hdp, DTM_SETMCSTYLE, 0, dwStyle)>
	endm
define DTM_GETMCSTYLE		(DTM_FIRST + 12)
DateTime_GetMonthCalStyle macro hdp
	exitm<SNDMSG(hdp, DTM_GETMCSTYLE, 0, 0)>
	endm
define DTM_CLOSEMONTHCAL	(DTM_FIRST + 13)
DateTime_CloseMonthCal macro hdp
	exitm<SNDMSG(hdp, DTM_CLOSEMONTHCAL, 0, 0)>
	endm
define DTM_GETDATETIMEPICKERINFO (DTM_FIRST + 14)
DateTime_GetDateTimePickerInfo macro hdp, pdtpi
	exitm<SNDMSG(hdp, DTM_GETDATETIMEPICKERINFO, 0, pdtpi)>
	endm
define DTM_GETIDEALSIZE		(DTM_FIRST + 15)
DateTime_GetIdealSize macro hdp, psize
	exitm<SNDMSG(hdp, DTM_GETIDEALSIZE, 0, psize)>
	endm
endif

define DTS_UPDOWN		0x0001
define DTS_SHOWNONE		0x0002
define DTS_SHORTDATEFORMAT	0x0000
define DTS_LONGDATEFORMAT	0x0004
if (_WIN32_IE GE 0x500)
define DTS_SHORTDATECENTURYFORMAT 0x000C
endif
define DTS_TIMEFORMAT		0x0009
define DTS_APPCANPARSE		0x0010
define DTS_RIGHTALIGN		0x0020

define DTN_DATETIMECHANGE	(DTN_FIRST2 - 6)

NMDATETIMECHANGE	STRUC
nmhdr			NMHDR <>
dwFlags			dd ?
_st			SYSTEMTIME <>
NMDATETIMECHANGE	ENDS
LPNMDATETIMECHANGE	typedef ptr NMDATETIMECHANGE

define DTN_USERSTRINGA	(DTN_FIRST2 - 5)
define DTN_USERSTRINGW	(DTN_FIRST - 5)

NMDATETIMESTRINGA	STRUC
nmhdr			NMHDR <>
pszUserString		LPCSTR ?
_st			SYSTEMTIME <>
dwFlags			dd ?
NMDATETIMESTRINGA	ENDS
LPNMDATETIMESTRINGA	typedef ptr NMDATETIMESTRINGA

NMDATETIMESTRINGW	STRUC
nmhdr			NMHDR <>
pszUserString		LPCWSTR ?
_st			SYSTEMTIME <>
dwFlags			dd ?
NMDATETIMESTRINGW	ENDS
LPNMDATETIMESTRINGW	typedef ptr NMDATETIMESTRINGW

ifdef _UNICODE
define DTN_USERSTRING	DTN_USERSTRINGW
NMDATETIMESTRING	typedef NMDATETIMESTRINGW
LPNMDATETIMESTRING	typedef LPNMDATETIMESTRINGW
else
define DTN_USERSTRING	DTN_USERSTRINGA
NMDATETIMESTRING	typedef NMDATETIMESTRINGA
LPNMDATETIMESTRING	typedef LPNMDATETIMESTRINGA
endif

define DTN_WMKEYDOWNA	(DTN_FIRST2 - 4)
define DTN_WMKEYDOWNW	(DTN_FIRST - 4)

NMDATETIMEWMKEYDOWNA	STRUC
nmhdr			NMHDR <>
nVirtKey		SINT ?
pszFormat		LPCSTR ?
_st			SYSTEMTIME <>
NMDATETIMEWMKEYDOWNA	ENDS
LPNMDATETIMEWMKEYDOWNA	typedef ptr NMDATETIMEWMKEYDOWNA

NMDATETIMEWMKEYDOWNW	STRUC
nmhdr			NMHDR <>
nVirtKey		SINT ?
pszFormat		LPCWSTR ?
_st			SYSTEMTIME <>
NMDATETIMEWMKEYDOWNW	ENDS
LPNMDATETIMEWMKEYDOWNW	typedef ptr NMDATETIMEWMKEYDOWNW

ifdef _UNICODE
define DTN_WMKEYDOWN	DTN_WMKEYDOWNW
NMDATETIMEWMKEYDOWN	typedef NMDATETIMEWMKEYDOWNW
LPNMDATETIMEWMKEYDOWN	typedef LPNMDATETIMEWMKEYDOWNW
else
define DTN_WMKEYDOWN	DTN_WMKEYDOWNA
NMDATETIMEWMKEYDOWN	typedef NMDATETIMEWMKEYDOWNA
LPNMDATETIMEWMKEYDOWN	typedef LPNMDATETIMEWMKEYDOWNA
endif

define DTN_FORMATA	(DTN_FIRST2 - 3)
define DTN_FORMATW	(DTN_FIRST - 3)

NMDATETIMEFORMATA	STRUC
nmhdr			NMHDR <>
pszFormat		LPCSTR ?
_st			SYSTEMTIME <>
pszDisplay		LPCSTR ?
szDisplay		CHAR 64 dup(?)
NMDATETIMEFORMATA	ENDS
LPNMDATETIMEFORMATA	typedef ptr NMDATETIMEFORMATA

NMDATETIMEFORMATW	STRUC
nmhdr			NMHDR <>
pszFormat		LPCWSTR ?
_st			SYSTEMTIME <>
pszDisplay		LPCWSTR ?
szDisplay		WCHAR 64 dup(?)
NMDATETIMEFORMATW	ENDS
LPNMDATETIMEFORMATW	typedef ptr NMDATETIMEFORMATW

ifdef _UNICODE
define DTN_FORMAT	DTN_FORMATW
NMDATETIMEFORMAT	typedef NMDATETIMEFORMATW
LPNMDATETIMEFORMAT	typedef LPNMDATETIMEFORMATW
else
define DTN_FORMAT	DTN_FORMATA
NMDATETIMEFORMAT	typedef NMDATETIMEFORMATA
LPNMDATETIMEFORMAT	typedef LPNMDATETIMEFORMATA
endif

define DTN_FORMATQUERYA (DTN_FIRST2 - 2)
define DTN_FORMATQUERYW (DTN_FIRST - 2)

NMDATETIMEFORMATQUERYA	STRUC
nmhdr			NMHDR <>
pszFormat		LPCSTR ?
szMax			tagSIZE <>
NMDATETIMEFORMATQUERYA	ENDS
LPNMDATETIMEFORMATQUERYA typedef ptr NMDATETIMEFORMATQUERYA

NMDATETIMEFORMATQUERYW	STRUC
nmhdr			NMHDR <>
pszFormat		LPCWSTR ?
szMax			tagSIZE <>
NMDATETIMEFORMATQUERYW	ENDS
LPNMDATETIMEFORMATQUERYW typedef ptr NMDATETIMEFORMATQUERYW

ifdef _UNICODE
define DTN_FORMATQUERY	DTN_FORMATQUERYW
NMDATETIMEFORMATQUERY	typedef NMDATETIMEFORMATQUERYW
LPNMDATETIMEFORMATQUERY typedef LPNMDATETIMEFORMATQUERYW
else
define DTN_FORMATQUERY	DTN_FORMATQUERYA
NMDATETIMEFORMATQUERY	typedef NMDATETIMEFORMATQUERYA
LPNMDATETIMEFORMATQUERY typedef LPNMDATETIMEFORMATQUERYA
endif

define DTN_DROPDOWN	(DTN_FIRST2 - 1)
define DTN_CLOSEUP	(DTN_FIRST2)

define GDTR_MIN		0x0001
define GDTR_MAX		0x0002

define GDT_ERROR	(-1)
define GDT_VALID	0
define GDT_NONE		1

endif
endif

if (_WIN32_IE GE 0x0400)
ifndef NOIPADDRESS

define IPM_CLEARADDRESS (WM_USER+100)
define IPM_SETADDRESS	(WM_USER+101)
define IPM_GETADDRESS	(WM_USER+102)
define IPM_SETRANGE	(WM_USER+103)
define IPM_SETFOCUS	(WM_USER+104)
define IPM_ISBLANK	(WM_USER+105)

define WC_IPADDRESS	<"SysIPAddress32">

define IPN_FIELDCHANGED (IPN_FIRST - 0)

NMIPADDRESS		STRUC
hdr			NMHDR <>
iField			SINT ?
iValue			SINT ?
NMIPADDRESS		ENDS
LPNMIPADDRESS		typedef ptr NMIPADDRESS

MAKEIPRANGE macro l, h
	exitm<((h SHL 8) + l)>
	endm

MAKEIPADDRESS macro b1,b2,b3,b4
	exitm<((b1 SHL 24)+(b2 SHL 16)+(b3 SHL 8)+b4)>
	endm

FIRST_IPADDRESS macro x
	exitm<((x SHR 24) AND 0xff)>
	endm
SECOND_IPADDRESS macro x
	exitm<((x SHR 16) AND 0xff)>
	endm
THIRD_IPADDRESS macro x
	exitm<((x SHR 8) AND 0xff)>
	endm
FOURTH_IPADDRESS macro x
	exitm<(x AND 0xff)>
	endm
endif

ifndef NOPAGESCROLLER

define WC_PAGESCROLLER		<"SysPager">

define PGS_VERT			0x00000000
define PGS_HORZ			0x00000001
define PGS_AUTOSCROLL		0x00000002
define PGS_DRAGNDROP		0x00000004

define	PGF_INVISIBLE		0
define	PGF_NORMAL		1
define	PGF_GRAYED		2
define	PGF_DEPRESSED		4
define	PGF_HOT			8

define PGB_TOPORLEFT		0
define PGB_BOTTOMORRIGHT	1

define PGM_SETCHILD		(PGM_FIRST + 1)
Pager_SetChild macro hwnd, hwndChild
	exitm<SNDMSG(hwnd, PGM_SETCHILD, 0, hwndChild)>
	endm

define PGM_RECALCSIZE		(PGM_FIRST + 2)
Pager_RecalcSize macro hwnd
	exitm<SNDMSG(hwnd, PGM_RECACSIZE, 0, 0)>
	endm

define PGM_FORWARDMOUSE		(PGM_FIRST + 3)
Pager_ForwardMouse macro hwnd, bForward
	exitm<SNDMSG(hwnd, PGM_FORWARDMOUSE, bForward, 0)>
	endm

define PGM_SETBKCOLOR		(PGM_FIRST + 4)
Pager_SetBkColor macro hwnd, clr
	exitm<SNDMSG(hwnd, PGM_SETBKCOLOR, 0, clr)>
	endm

define PGM_GETBKCOLOR		(PGM_FIRST + 5)
Pager_GetBkColor macro hwnd
	exitm<SNDMSG((hwnd), PGM_GETBKCOLOR, 0, 0)>
	endm

define PGM_SETBORDER		(PGM_FIRST + 6)
Pager_SetBorder macro hwnd, iBorder
	exitm<SNDMSG((hwnd), PGM_SETBORDER, 0, iBorder)>
	endm

define PGM_GETBORDER		(PGM_FIRST + 7)
Pager_GetBorder macro hwnd
	exitm<SNDMSG((hwnd), PGM_GETBORDER, 0, 0)>
	endm

define PGM_SETPOS		(PGM_FIRST + 8)
Pager_SetPos macro hwnd, iPos
	exitm<SNDMSG((hwnd), PGM_SETPOS, 0, iPos)>
	endm

define PGM_GETPOS		(PGM_FIRST + 9)
Pager_GetPos macro hwnd
	exitm<SNDMSG((hwnd), PGM_GETPOS, 0, 0)>
	endm

define PGM_SETBUTTONSIZE	(PGM_FIRST + 10)
Pager_SetButtonSize macro hwnd, iSize
	exitm<SNDMSG((hwnd), PGM_SETBUTTONSIZE, 0, iSize)>
	endm

define PGM_GETBUTTONSIZE	(PGM_FIRST + 11)
Pager_GetButtonSize macro hwnd
	exitm<SNDMSG((hwnd), PGM_GETBUTTONSIZE, 0,0)>
	endm

define PGM_GETBUTTONSTATE	(PGM_FIRST + 12)
Pager_GetButtonState macro hwnd, iButton
	exitm<SNDMSG((hwnd), PGM_GETBUTTONSTATE, 0, iButton)>
	endm

define PGM_GETDROPTARGET	CCM_GETDROPTARGET
Pager_GetDropTarget macro hwnd, ppdt
	exitm<SNDMSG((hwnd), PGM_GETDROPTARGET, 0, ppdt)>
	endm

define PGM_SETSCROLLINFO	(PGM_FIRST + 13)
Pager_SetScrollInfo macro hwnd, cTimeOut, cLinesPer, cPixelsPerLine
	exitm<SNDMSG(hwnd, PGM_SETSCROLLINFO, cTimeOut, MAKELONG(cLinesPer, cPixelsPerLine))>
	endm

define PGN_SCROLL		(PGN_FIRST-1)

define PGF_SCROLLUP		1
define PGF_SCROLLDOWN		2
define PGF_SCROLLLEFT		4
define PGF_SCROLLRIGHT		8

define PGK_SHIFT		1
define PGK_CONTROL		2
define PGK_MENU			4

.pragma pack(push, 1)

NMPGSCROLL		STRUC
hdr			NMHDR <>
fwKeys			dw ?
rcParent		RECT <>
iDir			SINT ?
iXpos			SINT ?
iYpos			SINT ?
iScroll			SINT ?
NMPGSCROLL		ENDS
LPNMPGSCROLL		typedef ptr NMPGSCROLL

.pragma pack(pop)

define PGN_CALCSIZE		(PGN_FIRST-2)

define PGF_CALCWIDTH		1
define PGF_CALCHEIGHT		2

NMPGCALCSIZE		STRUC
hdr			NMHDR <>
dwFlag			dd ?
iWidth			SINT ?
iHeight			SINT ?
NMPGCALCSIZE		ENDS
LPNMPGCALCSIZE		typedef ptr NMPGCALCSIZE

define PGN_HOTITEMCHANGE	(PGN_FIRST-3)

NMPGHOTITEM		STRUC
hdr			NMHDR <>
idOld			SINT ?
idNew			SINT ?
dwFlags			DWORD ?
NMPGHOTITEM		ENDS
LPNMPGHOTITEM		typedef ptr NMPGHOTITEM

endif

ifndef NONATIVEFONTCTL
define WC_NATIVEFONTCTL		<"NativeFontCtl">

define NFS_EDIT			0x0001
define NFS_STATIC		0x0002
define NFS_LISTCOMBO		0x0004
define NFS_BUTTON		0x0008
define NFS_ALL			0x0010
define NFS_USEFONTASSOC		0x0020

endif

ifndef NOBUTTON
define WC_BUTTON		<"Button">

if (_WIN32_WINNT GE 0x0501)
define BUTTON_IMAGELIST_ALIGN_LEFT	0
define BUTTON_IMAGELIST_ALIGN_RIGHT	1
define BUTTON_IMAGELIST_ALIGN_TOP	2
define BUTTON_IMAGELIST_ALIGN_BOTTOM	3
define BUTTON_IMAGELIST_ALIGN_CENTER	4

BUTTON_IMAGELIST	STRUC
himl			HIMAGELIST ?
margin			RECT <>
uAlign			UINT ?
BUTTON_IMAGELIST	ENDS
PBUTTON_IMAGELIST	typedef ptr BUTTON_IMAGELIST

define BCM_GETIDEALSIZE		(BCM_FIRST + 0x0001)
Button_GetIdealSize macro hwnd, psize
	exitm<SNDMSG(hwnd, BCM_GETIDEALSIZE, 0, psize)>
	endm

define BCM_SETIMAGELIST		(BCM_FIRST + 0x0002)
Button_SetImageList macro hwnd, pbuttonImagelist
	exitm<SNDMSG(hwnd, BCM_SETIMAGELIST, 0, pbuttonImagelist)>
	endm

define BCM_GETIMAGELIST		(BCM_FIRST + 0x0003)
Button_GetImageList macro hwnd, pbuttonImagelist
	exitm<SNDMSG(hwnd, BCM_GETIMAGELIST, 0, pbuttonImagelist)>
	endm

define BCM_SETTEXTMARGIN	(BCM_FIRST + 0x0004)
Button_SetTextMargin macro hwnd, pmargin
	exitm<SNDMSG(hwnd, BCM_SETTEXTMARGIN, 0, pmargin)>
	endm

define BCM_GETTEXTMARGIN	(BCM_FIRST + 0x0005)
Button_GetTextMargin macro hwnd, pmargin
	exitm<SNDMSG(hwnd, BCM_GETTEXTMARGIN, 0, pmargin)>
	endm

NMBCHOTITEM		STRUC
hdr			NMHDR <>
dwFlags			dd ?
NMBCHOTITEM		ENDS
LPNMBCHOTITEM		typedef ptr NMBCHOTITEM

define BCN_HOTITEMCHANGE	(BCN_FIRST + 0x0001)
define BST_HOT			0x0200

endif

if _WIN32_WINNT GE 0x0600

define BST_DROPDOWNPUSHED	0x0400

define BS_SPLITBUTTON		0x0000000C
define BS_DEFSPLITBUTTON	0x0000000D
define BS_COMMANDLINK		0x0000000E
define BS_DEFCOMMANDLINK	0x0000000F

define BCSIF_GLYPH		0x0001
define BCSIF_IMAGE		0x0002
define BCSIF_STYLE		0x0004
define BCSIF_SIZE		0x0008

define BCSS_NOSPLIT		0x0001
define BCSS_STRETCH		0x0002
define BCSS_ALIGNLEFT		0x0004
define BCSS_IMAGE		0x0008

BUTTON_SPLITINFO	STRUC
mask			UINT ?
himlGlyph		HIMAGELIST ?
uSplitStyle		UINT ?
size			POINT <>
BUTTON_SPLITINFO	ENDS
PBUTTON_SPLITINFO	typedef ptr BUTTON_SPLITINFO

define BCM_SETDROPDOWNSTATE	(BCM_FIRST + 0x0006)
Button_SetDropDownState macro hwnd, fDropDown
	exitm<SNDMSG(hwnd, BCM_SETDROPDOWNSTATE, fDropDown, 0)>
	endm

define BCM_SETSPLITINFO		(BCM_FIRST + 0x0007)
Button_SetSplitInfo macro hwnd, pInfo
	exitm<SNDMSG(hwnd, BCM_SETSPLITINFO, 0, pInfo)>
	endm

define BCM_GETSPLITINFO		(BCM_FIRST + 0x0008)
Button_GetSplitInfo macro hwnd, pInfo
	exitm<SNDMSG(hwnd, BCM_GETSPLITINFO, 0, pInfo)>
	endm

define BCM_SETNOTE		(BCM_FIRST + 0x0009)
Button_SetNote macro hwnd, psz
	exitm<SNDMSG(hwnd, BCM_SETNOTE, 0, psz)>
	endm

define BCM_GETNOTE		(BCM_FIRST + 0x000A)
Button_GetNote macro hwnd, psz, pcc
	exitm<SNDMSG(hwnd, BCM_GETNOTE, pcc, psz)>
	endm

define BCM_GETNOTELENGTH	(BCM_FIRST + 0x000B)
Button_GetNoteLength macro hwnd
	exitm<SNDMSG(hwnd, BCM_GETNOTELENGTH, 0, 0)>
	endm

if _WIN32_WINNT GE 0x0600
define BCM_SETSHIELD		(BCM_FIRST + 0x000C)
Button_SetElevationRequiredState macro hwnd, fRequired
	exitm<SNDMSG(hwnd, BCM_SETSHIELD, 0, fRequired)>
	endm
endif

define BCCL_NOGLYPH	(-1)

NMBCDROPDOWN		STRUC
hdr			NMHDR <>
rcButton		RECT <>
NMBCDROPDOWN		ENDS
LPNMBCDROPDOWN		typedef ptr NMBCDROPDOWN

define BCN_DROPDOWN	(BCN_FIRST + 0x0002)

endif

endif

ifndef NOSTATIC
define WC_STATIC	<"Static">
endif

ifndef NOEDIT
define WC_EDIT		<"Edit">

if (_WIN32_WINNT GE 0x0501)
define EM_SETCUEBANNER	(ECM_FIRST + 1)
Edit_SetCueBannerText macro hwnd, lpcwText
	exitm<SNDMSG(hwnd, EM_SETCUEBANNER, 0, lpcwText)>
	endm

Edit_SetCueBannerTextFocused macro hwnd, lpcwText, fDrawFocused
	exitm<SNDMSG(hwnd, EM_SETCUEBANNER, fDrawFocused, lpcwText)>
	endm

define EM_GETCUEBANNER	(ECM_FIRST + 2)
Edit_GetCueBannerText macro hwnd, lpwText, cchText
	exitm<SNDMSG(hwnd, EM_GETCUEBANNER, lpwText, cchText)>
	endm

EDITBALLOONTIP		STRUC
cbStruct		dd ?
pszTitle		LPCWSTR ?
pszText			LPCWSTR ?
ttiIcon			SINT ?
EDITBALLOONTIP		ENDS
PEDITBALLOONTIP		typedef ptr EDITBALLOONTIP

define EM_SHOWBALLOONTIP	(ECM_FIRST + 3)
Edit_ShowBalloonTip macro hwnd, peditballoontip
	exitm<SNDMSG(hwnd, EM_SHOWBALLOONTIP, 0, peditballoontip)>
	endm

define EM_HIDEBALLOONTIP	(ECM_FIRST + 4)
Edit_HideBalloonTip macro hwnd
	exitm<SNDMSG(hwnd, EM_HIDEBALLOONTIP, 0, 0)>
	endm

endif ; (_WIN32_WINNT GE 0x0501)

if _WIN32_WINNT GE 0x0600
define EM_SETHILITE		(ECM_FIRST + 5)
Edit_SetHilite macro hwndCtl, ichStart, ichEnd
	exitm<SNDMSG(hwndCtl, EM_SETHILITE, ichStart, ichEnd)>
	endm
define EM_GETHILITE		(ECM_FIRST + 6)
Edit_GetHilite macro hwndCtl
	exitm<SNDMSG(hwndCtl, EM_GETHILITE, 0, 0)>
	endm
endif

define EM_NOSETFOCUS		(ECM_FIRST + 7)
Edit_NoSetFocus macro hwndCtl
	exitm<SNDMSG(hwndCtl, EM_NOSETFOCUS, 0, 0)>
	endm

define EM_TAKEFOCUS		(ECM_FIRST + 8)
Edit_TakeFocus macro hwndCtl
	exitm<SNDMSG(hwndCtl, EM_TAKEFOCUS, 0, 0)>
	endm

endif

ifndef NOLISTBOX
define WC_LISTBOX		<"ListBox">
endif

ifndef NOCOMBOBOX
define WC_COMBOBOX		<"ComboBox">
endif

if (_WIN32_WINNT GE 0x0501)

define CB_SETMINVISIBLE		(CBM_FIRST + 1)
define CB_GETMINVISIBLE		(CBM_FIRST + 2)
define CB_SETCUEBANNER		(CBM_FIRST + 3)
define CB_GETCUEBANNER		(CBM_FIRST + 4)

ComboBox_SetMinVisible macro hwnd, iMinVisible
	exitm<SNDMSG(hwnd, CB_SETMINVISIBLE, iMinVisible, 0)>
	endm
ComboBox_GetMinVisible macro hwnd
	exitm<SNDMSG(hwnd, CB_GETMINVISIBLE, 0, 0)>
	endm
ComboBox_SetCueBannerText macro hwnd, lpcwText
	exitm<SNDMSG(hwnd, CB_SETCUEBANNER, 0, lpcwText)>
	endm
ComboBox_GetCueBannerText macro hwnd, lpwText, cchText
	exitm<SNDMSG(hwnd, CB_GETCUEBANNER, lpwText, cchText)>
	endm
endif

ifndef NOSCROLLBAR
define WC_SCROLLBAR		 <"ScrollBar">
endif

ifndef NOTASKDIALOG
if (NTDDI_VERSION GE NTDDI_VISTA)

CALLBACK(PFTASKDIALOGCALLBACK, hwnd:HWND, msg:UINT, wParam:WPARAM, lParam:LPARAM, lpRefData:LPLONG)

.enum TASKDIALOG_FLAGS {
    TDF_ENABLE_HYPERLINKS		= 0x0001,
    TDF_USE_HICON_MAIN			= 0x0002,
    TDF_USE_HICON_FOOTER		= 0x0004,
    TDF_ALLOW_DIALOG_CANCELLATION	= 0x0008,
    TDF_USE_COMMAND_LINKS		= 0x0010,
    TDF_USE_COMMAND_LINKS_NO_ICON	= 0x0020,
    TDF_EXPAND_FOOTER_AREA		= 0x0040,
    TDF_EXPANDED_BY_DEFAULT		= 0x0080,
    TDF_VERIFICATION_FLAG_CHECKED	= 0x0100,
    TDF_SHOW_PROGRESS_BAR		= 0x0200,
    TDF_SHOW_MARQUEE_PROGRESS_BAR	= 0x0400,
    TDF_CALLBACK_TIMER			= 0x0800,
    TDF_POSITION_RELATIVE_TO_WINDOW	= 0x1000,
    TDF_RTL_LAYOUT			= 0x2000,
    TDF_NO_DEFAULT_RADIO_BUTTON		= 0x4000,
    TDF_CAN_BE_MINIMIZED		= 0x8000,
if (NTDDI_VERSION ge NTDDI_WIN8)
    TDF_NO_SET_FOREGROUND		= 0x00010000,
endif
    TDF_SIZE_TO_CONTENT			= 0x01000000
    }

.enum TASKDIALOG_MESSAGES {
    TDM_NAVIGATE_PAGE			= WM_USER+101,
    TDM_CLICK_BUTTON			= WM_USER+102,
    TDM_SET_MARQUEE_PROGRESS_BAR	= WM_USER+103,
    TDM_SET_PROGRESS_BAR_STATE		= WM_USER+104,
    TDM_SET_PROGRESS_BAR_RANGE		= WM_USER+105,
    TDM_SET_PROGRESS_BAR_POS		= WM_USER+106,
    TDM_SET_PROGRESS_BAR_MARQUEE	= WM_USER+107,
    TDM_SET_ELEMENT_TEXT		= WM_USER+108,
    TDM_CLICK_RADIO_BUTTON		= WM_USER+110,
    TDM_ENABLE_BUTTON			= WM_USER+111,
    TDM_ENABLE_RADIO_BUTTON		= WM_USER+112,
    TDM_CLICK_VERIFICATION		= WM_USER+113,
    TDM_UPDATE_ELEMENT_TEXT		= WM_USER+114,
    TDM_SET_BUTTON_ELEVATION_REQUIRED_STATE = WM_USER+115,
    TDM_UPDATE_ICON			= WM_USER+116
    }

.enum TASKDIALOG_NOTIFICATIONS {
    TDN_CREATED				= 0,
    TDN_NAVIGATED			= 1,
    TDN_BUTTON_CLICKED			= 2,
    TDN_HYPERLINK_CLICKED		= 3,
    TDN_TIMER				= 4,
    TDN_DESTROYED			= 5,
    TDN_RADIO_BUTTON_CLICKED		= 6,
    TDN_DIALOG_CONSTRUCTED		= 7,
    TDN_VERIFICATION_CLICKED		= 8,
    TDN_HELP				= 9,
    TDN_EXPANDO_BUTTON_CLICKED		= 10
    }

.pragma pack(push, 1)

TASKDIALOG_BUTTON	STRUC
nButtonID		SINT ?
pszButtonText		PCWSTR ?
TASKDIALOG_BUTTON	ENDS
LPTASKDIALOG_BUTTON	typedef ptr TASKDIALOG_BUTTON

.pragma pack(pop)

.enum TASKDIALOG_ELEMENTS {
    TDE_CONTENT,
    TDE_EXPANDED_INFORMATION,
    TDE_FOOTER,
    TDE_MAIN_INSTRUCTION
    }

.enum TASKDIALOG_ICON_ELEMENTS {
    TDIE_ICON_MAIN,
    TDIE_ICON_FOOTER
    }

define TD_WARNING_ICON		<MAKEINTRESOURCEW(-1)>
define TD_ERROR_ICON		<MAKEINTRESOURCEW(-2)>
define TD_INFORMATION_ICON	<MAKEINTRESOURCEW(-3)>
define TD_SHIELD_ICON		<MAKEINTRESOURCEW(-4)>

endif

if (NTDDI_VERSION GE NTDDI_VISTA)

.enum TASKDIALOG_COMMON_BUTTON_FLAGS {
    TDCBF_OK_BUTTON	       = 0x0001,
    TDCBF_YES_BUTTON	       = 0x0002,
    TDCBF_NO_BUTTON	       = 0x0004,
    TDCBF_CANCEL_BUTTON	       = 0x0008,
    TDCBF_RETRY_BUTTON	       = 0x0010,
    TDCBF_CLOSE_BUTTON	       = 0x0020
    }

.pragma pack(push, 1)

TASKDIALOGCONFIG	STRUC
cbSize			UINT ?
hwndParent		HWND ?
hInstance		HINSTANCE ?
dwFlags			TASKDIALOG_FLAGS ?
dwCommonButtons		TASKDIALOG_COMMON_BUTTON_FLAGS ?
pszWindowTitle		PCWSTR ?
UNION
 hMainIcon		HICON ?
 pszMainIcon		PCWSTR ?
ENDS
pszMainInstruction	PCWSTR ?
pszContent		PCWSTR ?
cButtons		UINT ?
pButtons		LPTASKDIALOG_BUTTON ?
nDefaultButton		SINT ?
cRadioButtons		UINT ?
pRadioButtons		LPTASKDIALOG_BUTTON ?
nDefaultRadioButton	SINT ?
pszVerificationText	PCWSTR ?
pszExpandedInformation	PCWSTR ?
pszExpandedControlText	PCWSTR ?
pszCollapsedControlText PCWSTR ?
UNION
 hFooterIcon		HICON ?
 pszFooterIcon		PCWSTR ?
ENDS
pszFooter		PCWSTR ?
pfCallback		PFTASKDIALOGCALLBACK ?
lpCallbackData		LPLONG ?
cxWidth			UINT ?
TASKDIALOGCONFIG	ENDS

.pragma pack(pop)

TaskDialogIndirect proto WINAPI :ptr, :ptr, :ptr, :ptr
TaskDialog proto WINAPI :HWND, :HINSTANCE, :PCWSTR, :PCWSTR, :PCWSTR, :TASKDIALOG_COMMON_BUTTON_FLAGS, :PCWSTR, :ptr

endif
endif

ifndef NOMUI
InitMUILanguage proto WINAPI :LANGID
GetMUILanguage proto WINAPI
endif

endif

ifndef NO_COMMCTRL_DA
define __COMMCTRL_DA_DEFINED__

define DA_LAST		0x7FFFFFFF
define DA_ERR		(-1)

CALLBACK(PFNDAENUMCALLBACK, :ptr, :ptr)
CALLBACK(PFNDAENUMCALLBACKCONST, :ptr, :ptr)
CALLBACK(PFNDACOMPARE, :ptr, :ptr, :LPARAM)
CALLBACK(PFNDACOMPARECONST, :ptr, :ptr, :LPARAM)

HDSA typedef ptr DSA

DSA_Create proto WINAPI :sdword, :sdword
DSA_Destroy proto WINAPI :HDSA
DSA_DestroyCallback proto WINAPI :HDSA, :PFNDAENUMCALLBACK, :ptr
DSA_DeleteItem proto WINAPI :HDSA, :sdword
DSA_DeleteAllItems proto WINAPI :HDSA
DSA_EnumCallback proto WINAPI :HDSA, :PFNDAENUMCALLBACK, :ptr
DSA_InsertItem proto WINAPI :HDSA, :sdword, :ptr
DSA_GetItemPtr proto WINAPI :HDSA, :sdword
DSA_GetItem proto WINAPI :HDSA, :sdword, :ptr
DSA_SetItem proto WINAPI :HDSA, :sdword, :ptr

DSA_GetItemCount macro hdsa
	exitm<SINT PTR [hdsa]>
	endm
DSA_AppendItem macro hdsa, pitem
	exitm<DSA_InsertItem(hdsa, DA_LAST, pitem)>
	endm

if (NTDDI_VERSION GE NTDDI_VISTA)
DSA_Clone proto WINAPI :HDSA
DSA_GetSize proto WINAPI :HDSA
DSA_Sort proto WINAPI :HDSA, :PFNDACOMPARE, :LPARAM
endif

define DSA_APPEND      DA_LAST
define DSA_ERR	       DA_ERR

PFNDSAENUMCALLBACK	equ <PFNDAENUMCALLBACK>
PFNDSAENUMCALLBACKCONST equ <PFNDAENUMCALLBACKCONST>
PFNDSACOMPARE		equ <PFNDACOMPARE>
PFNDSACOMPARECONST	equ <PFNDACOMPARECONST>

HDPA typedef ptr DPA

DPA_Create proto WINAPI :sdword
DPA_CreateEx proto WINAPI :sdword, :HANDLE
DPA_Clone proto WINAPI :HDPA, :HDPA
DPA_Destroy proto WINAPI :HDPA
DPA_DestroyCallback proto WINAPI :HDPA, :PFNDAENUMCALLBACK, :ptr
DPA_DeletePtr proto WINAPI :HDPA, :sdword
DPA_DeleteAllPtrs proto WINAPI :HDPA
DPA_EnumCallback proto WINAPI :HDPA, :PFNDAENUMCALLBACK, :ptr
DPA_Grow proto WINAPI :HDPA, :sdword
DPA_InsertPtr proto WINAPI :HDPA, :sdword, :ptr
DPA_SetPtr proto WINAPI :HDPA, :sdword, :ptr
DPA_GetPtr proto WINAPI :HDPA, :INT_PTR
DPA_GetPtrIndex proto WINAPI :HDPA, :ptr

DPA_GetPtrCount macro hdpa
	mov eax,[hdpa]
	exitm<eax>
	endm
DPA_SetPtrCount macro hdpa, cItems
	mov eax,cItems
	mov [hdpa],eax
	exitm<eax>
	endm
DPA_FastDeleteLastPtr macro hdpa
	dec SINT PTR [hdpa]
	mov eax,[hdpa]
	exitm<eax>
	endm
DPA_GetPtrPtr macro hdpa
	exitm<BYTE PTR [hdpa+PVOID]>
	endm
DPA_FastGetPtr macro hdpa, i
	exitm<BYTE PTR [hdpa+PVOID+i]>
	endm
DPA_AppendPtr macro hdpa, pitem
	exitm<DPA_InsertPtr(hdpa, DA_LAST, pitem)>
	endm

if (NTDDI_VERSION GE NTDDI_VISTA)
DPA_GetSize proto WINAPI :HDPA
endif
DPA_Sort proto WINAPI :HDPA, :PFNDACOMPARE, :LPARAM

DPASTREAMINFO		STRUC
iPos			SINT ?
pvItem			PVOID ?
DPASTREAMINFO		ENDS

CALLBACK(PFNDPASTREAM, pinfo:ptr DPASTREAMINFO, pstream:ptr IStream, pvInstData:PVOID)

DPA_LoadStream proto WINAPI :ptr, :PFNDPASTREAM, :ptr, :ptr
DPA_SaveStream proto WINAPI :HDPA, :PFNDPASTREAM, :ptr, :ptr

define DPAM_SORTED		0x00000001
define DPAM_NORMAL		0x00000002
define DPAM_UNION		0x00000004
define DPAM_INTERSECT		0x00000008

CALLBACK(PFNDPAMERGE, :UINT, :ptr, :ptr, :LPARAM)
CALLBACK(PFNDPAMERGECONST, :UINT, :ptr, :ptr, :LPARAM)

define DPAMM_MERGE		1
define DPAMM_DELETE		2
define DPAMM_INSERT		3

DPA_Merge proto WINAPI :HDPA, :HDPA, :DWORD, :PFNDACOMPARE, :PFNDPAMERGE, :LPARAM

define DPAS_SORTED		0x0001
define DPAS_INSERTBEFORE	0x0002
define DPAS_INSERTAFTER		0x0004

DPA_Search proto WINAPI :HDPA, :ptr, :sdword, :PFNDACOMPARE, :LPARAM, :UINT

DPA_SortedInsertPtr macro hdpa, pFind, iStart, pfnCompare, lParam, options, pitem
	exitm<DPA_InsertPtr(hdpa,DPA_Search(hdpa,pFind,iStart,pfnCompare,lParam,DPAS_SORTED OR options),pitem)>
	endm

define DPA_APPEND		DA_LAST
define DPA_ERR			DA_ERR

define PFNDPAENUMCALLBACK	<PFNDAENUMCALLBACK>
define PFNDPAENUMCALLBACKCONST	<PFNDAENUMCALLBACKCONST>
define PFNDPACOMPARE		<PFNDACOMPARE>
define PFNDPACOMPARECONST	<PFNDACOMPARECONST>

endif

Str_SetPtrW proto WINAPI :ptr, :LPCWSTR

ifdef _WIN32

ifndef NOTRACKMOUSEEVENT
ifndef WM_MOUSEHOVER
define WM_MOUSEHOVER 0x02A1
define WM_MOUSELEAVE 0x02A3
endif

ifndef TME_HOVER

define TME_HOVER	0x00000001
define TME_LEAVE	0x00000002
if (WINVER ge 0x0500)
define TME_NONCLIENT	0x00000010
endif
define TME_QUERY	0x40000000
define TME_CANCEL	0x80000000

define HOVER_DEFAULT	0xFFFFFFFF

TRACKMOUSEEVENT		STRUC
cbSize			dd ?
dwFlags			dd ?
hwndTrack		HWND ?
dwHoverTime		dd ?
TRACKMOUSEEVENT		ENDS
LPTRACKMOUSEEVENT	typedef ptr TRACKMOUSEEVENT

endif

_TrackMouseEvent proto WINAPI :LPTRACKMOUSEEVENT

endif

if (_WIN32_IE GE 0x0400)

ifndef NOFLATSBAPIS

define WSB_PROP_CYVSCROLL	0x00000001
define WSB_PROP_CXHSCROLL	0x00000002
define WSB_PROP_CYHSCROLL	0x00000004
define WSB_PROP_CXVSCROLL	0x00000008
define WSB_PROP_CXHTHUMB	0x00000010
define WSB_PROP_CYVTHUMB	0x00000020
define WSB_PROP_VBKGCOLOR	0x00000040
define WSB_PROP_HBKGCOLOR	0x00000080
define WSB_PROP_VSTYLE		0x00000100
define WSB_PROP_HSTYLE		0x00000200
define WSB_PROP_WINSTYLE	0x00000400
define WSB_PROP_PALETTE		0x00000800
define WSB_PROP_MASK		0x00000FFF

define FSB_FLAT_MODE		2
define FSB_ENCARTA_MODE		1
define FSB_REGULAR_MODE		0

FlatSB_EnableScrollBar proto WINAPI :HWND, :sdword, :UINT
FlatSB_ShowScrollBar proto WINAPI :HWND, :sdword, :BOOL
FlatSB_GetScrollRange proto WINAPI :HWND, :sdword, :LPINT, :LPINT
FlatSB_GetScrollInfo proto WINAPI :HWND, :sdword, :LPSCROLLINFO
FlatSB_GetScrollPos proto WINAPI :HWND, :sdword
FlatSB_GetScrollProp proto WINAPI :HWND, :sdword, :LPINT

ifdef _WIN64
FlatSB_GetScrollPropPtr proto WINAPI :HWND, :sdword, :PINT_PTR
else
define FlatSB_GetScrollPropPtr <FlatSB_GetScrollProp>
endif

FlatSB_SetScrollPos proto WINAPI :HWND, :sdword, :sdword, :BOOL
FlatSB_SetScrollInfo proto WINAPI :HWND, :sdword, :LPSCROLLINFO, :BOOL
FlatSB_SetScrollRange proto WINAPI :HWND, :sdword, :sdword, :sdword, :BOOL
FlatSB_SetScrollProp proto WINAPI :HWND, :UINT, :INT_PTR, :BOOL
define FlatSB_SetScrollPropPtr <FlatSB_SetScrollProp>

InitializeFlatSB proto WINAPI :HWND
UninitializeFlatSB proto WINAPI :HWND

endif
endif
endif
endif

if (_WIN32_WINNT GE 0x0501)
CALLBACK(SUBCLASSPROC, :HWND, :UINT, :WPARAM, :LPARAM, :UINT_PTR, :DWORD_PTR)
SetWindowSubclass proto WINAPI :HWND, :SUBCLASSPROC, :UINT_PTR, :DWORD_PTR
GetWindowSubclass proto WINAPI :HWND, :SUBCLASSPROC, :UINT_PTR, :ptr
RemoveWindowSubclass proto WINAPI :HWND, :SUBCLASSPROC, :UINT_PTR
DefSubclassProc proto WINAPI :HWND, :UINT, :WPARAM, :LPARAM
endif

if (NTDDI_VERSION GE NTDDI_VISTA)

.enum LI_METRIC {
    LIM_SMALL,
    LIM_LARGE,
    }

LoadIconMetric proto WINAPI :HINSTANCE, :PCWSTR, :sdword, :ptr
LoadIconWithScaleDown proto WINAPI :HINSTANCE, :PCWSTR, :sdword, :sdword, :ptr

endif

if (_WIN32_WINNT GE 0x0501)
DrawShadowText proto WINAPI :HDC, :LPCWSTR, :UINT, :ptr, :DWORD, :COLORREF, :COLORREF, :sdword, :sdword
endif

ifdef ISOLATION_AWARE_ENABLED
if ISOLATION_AWARE_ENABLED
include commctrl.inl
endif
endif

endif
endif
