' api_window.sbp - Window Control API

'-------------
' Window API Function Names
#ifdef UNICODE
Const _FuncName_CallWindowProc = "CallWindowProcW"
Const _FuncName_CharLower = "CharLowerW"
Const _FuncName_CharNext = "CharNextW"
Const _FuncName_CharPrev = "CharPrevW"
Const _FuncName_CharUpper = "CharUpperW"
Const _FuncName_CreateAcceleratorTable = "CreateAcceleratorTableW"
Const _FuncName_CreateWindowEx = "CreateWindowExW"
Const _FuncName_DefDlgProc = "DefDlgProcW"
Const _FuncName_DefWindowProc = "DefWindowProcW"
Const _FuncName_DialogBoxIndirectParam = "DialogBoxIndirectParamW"
Const _FuncName_DispatchMessage = "DispatchMessageW"
Const _FuncName_DlgDirList = "DlgDirListW"
Const _FuncName_DlgDirListComboBox = "DlgDirListComboBoxW"
Const _FuncName_DlgDirSelectComboBoxEx = "DlgDirSelectComboBoxExW"
Const _FuncName_DlgDirSelectEx = "DlgDirSelectExW"
Const _FuncName_DrawText = "DrawTextW"
Const _FuncName_DrawTextEx = "DrawTextExW"
Const _FuncName_FindWindow = "FindWindowW"
Const _FuncName_FindWindowEx = "FindWindowExW"
Const _FuncName_GetClassInfoEx = "GetClassInfoExW"
Const _FuncName_GetClassLong = "GetClassLongW"
Const _FuncName_GetClassLongPtr = "GetClassLongPtrW"
Const _FuncName_GetClassName = "GetClassNameW"
Const _FuncName_GetClipboardFormatName = "GetClipboardFormatNameW"
Const _FuncName_GetDlgItemText = "GetDlgItemTextW"
Const _FuncName_GetMonitorInfo = "GetMonitorInfoW"
Const _FuncName_GetMenuItemInfo = "GetMenuItemInfoW"
Const _FuncName_GetMessage = "GetMessageW"
Const _FuncName_GetProp = "GetPropW"
Const _FuncName_GetWindowLong = "GetWindowLongW"
Const _FuncName_GetWindowLongPtr = "GetWindowLongPtrW"
Const _FuncName_GetWindowText = "GetWindowTextW"
Const _FuncName_GetWindowTextLength = "GetWindowTextLengthW"
Const _FuncName_GetWindowModuleFileName = "GetWindowModuleFileNameW"
Const _FuncName_InsertMenuItem = "InsertMenuItemW"
Const _FuncName_IsCharAlpha = "IsCharAlphaW"
Const _FuncName_IsCharAlphaNumeric = "IsCharAlphaNumericW"
Const _FuncName_IsCharLower = "IsCharLowerW"
Const _FuncName_IsCharUpper = "IsCharUpperW"
Const _FuncName_IsDialogMessage = "IsDialogMessageW"
Const _FuncName_LoadBitmap = "LoadBitmapW"
Const _FuncName_LoadCursor = "LoadCursorW"
Const _FuncName_LoadCursorFromFile = "LoadCursorFromFileW"
Const _FuncName_LoadIcon = "LoadIconW"
Const _FuncName_LoadImage = "LoadImageW"
Const _FuncName_LoadString = "LoadStringW"
Const _FuncName_MapVirtualKey = "MapVirtualKeyW"
Const _FuncName_PeekMessage = "PeekMessageW"
Const _FuncName_PostMessage = "PostMessageW"
Const _FuncName_PostThreadMessage = "PostThreadMessageW"
Const _FuncName_RegisterClassEx = "RegisterClassExW"
Const _FuncName_RegisterClipboardFormat = "RegisterClipboardFormatW"
Const _FuncName_RegisterWindowMessage = "RegisterWindowMessageW"
Const _FuncName_RemoveProp = "RemovePropW"
Const _FuncName_SendDlgItemMessage = "SendDlgItemMessageW"
Const _FuncName_SendMessage = "SendMessageW"
Const _FuncName_SendMessageCallback = "SendMessageCallbackW"
Const _FuncName_SendMessageTimeout = "SendMessageTimeoutW"
Const _FuncName_SendNotifyMessage = "SendNotifyMessageW"
Const _FuncName_SetDlgItemText = "SetDlgItemTextW"
Const _FuncName_SetClassLong = "SetClassLongW"
Const _FuncName_SetClassLongPtr = "SetClassLongPtrW"
Const _FuncName_SetMenuItemInfo = "SetMenuItemInfoW"
Const _FuncName_SetProp = "SetPropW"
Const _FuncName_SetWindowLong = "SetWindowLongW"
Const _FuncName_SetWindowLongPtr = "SetWindowLongPtrW"
Const _FuncName_SetWindowText = "SetWindowTextW"
Const _FuncName_SetWindowsHookEx = "SetWindowsHookExW"
Const _FuncName_SystemParametersInfo = "SystemParametersInfoW"
Const _FuncName_TranslateAccelerator = "TranslateAcceleratorW"
Const _FuncName_UnregisterClass = "UnregisterClassW"
Const _FuncName_wsprintf = "wsprintfW"
Const _FuncName_wvsprintf = "wvsprintfW"
Const _FuncName_ChangeDisplaySettings = "ChangeDisplaySettingsW"
Const _FuncName_ChangeDisplaySettingsEx= "ChangeDisplaySettingsExW"
Const _FuncName_EnumDisplaySettings= "EnumDisplaySettingsW"
Const _FuncName_EnumDisplaySettingsEx= "EnumDisplaySettingsExW"
Const _FuncName_EnumDisplayDevices= "EnumDisplayDevicesW"
#else
Const _FuncName_CallWindowProc = "CallWindowProcA"
Const _FuncName_CharLower = "CharLowerA"
Const _FuncName_CharNext = "CharNextA"
Const _FuncName_CharPrev = "CharPrevA"
Const _FuncName_CharUpper = "CharUpperA"
Const _FuncName_CreateAcceleratorTable = "CreateAcceleratorTableA"
Const _FuncName_CreateWindowEx = "CreateWindowExA"
Const _FuncName_DefDlgProc = "DefDlgProcA"
Const _FuncName_DefWindowProc = "DefWindowProcA"
Const _FuncName_DialogBoxIndirectParam = "DialogBoxIndirectParamA"
Const _FuncName_DispatchMessage = "DispatchMessageA"
Const _FuncName_DlgDirList = "DlgDirListA"
Const _FuncName_DlgDirListComboBox = "DlgDirListComboBoxA"
Const _FuncName_DlgDirSelectComboBoxEx = "DlgDirSelectComboBoxExA"
Const _FuncName_DlgDirSelectEx = "DlgDirSelectExA"
Const _FuncName_DrawText = "DrawTextA"
Const _FuncName_DrawTextEx = "DrawTextExA"
Const _FuncName_FindWindow = "FindWindowA"
Const _FuncName_FindWindowEx = "FindWindowExA"
Const _FuncName_GetClassInfoEx = "GetClassInfoExA"
Const _FuncName_GetClassLong = "GetClassLongA"
Const _FuncName_GetClassLongPtr = "GetClassLongPtrA"
Const _FuncName_GetClassName = "GetClassNameA"
Const _FuncName_GetClipboardFormatName = "GetClipboardFormatNameA"
Const _FuncName_GetDlgItemText = "GetDlgItemTextA"
Const _FuncName_GetMenuItemInfo = "GetMenuItemInfoA"
Const _FuncName_GetMessage = "GetMessageA"
Const _FuncName_GetMonitorInfo = "GetMonitorInfoA"
Const _FuncName_GetProp = "GetPropA"
Const _FuncName_GetWindowLong = "GetWindowLongA"
Const _FuncName_GetWindowLongPtr = "GetWindowLongPtrA"
Const _FuncName_GetWindowText = "GetWindowTextA"
Const _FuncName_GetWindowTextLength = "GetWindowTextLengthA"
Const _FuncName_GetWindowModuleFileName = "GetWindowModuleFileNameA"
Const _FuncName_InsertMenuItem = "InsertMenuItemA"
Const _FuncName_IsCharAlpha = "IsCharAlphaA"
Const _FuncName_IsCharAlphaNumeric = "IsCharAlphaNumericA"
Const _FuncName_IsCharLower = "IsCharLowerA"
Const _FuncName_IsCharUpper = "IsCharUpperA"
Const _FuncName_IsDialogMessage = "IsDialogMessageA"
Const _FuncName_LoadBitmap = "LoadBitmapA"
Const _FuncName_LoadCursor = "LoadCursorA"
Const _FuncName_LoadCursorFromFile = "LoadCursorFromFileA"
Const _FuncName_LoadIcon = "LoadIconA"
Const _FuncName_LoadImage = "LoadImageA"
Const _FuncName_LoadString = "LoadStringA"
Const _FuncName_MapVirtualKey = "MapVirtualKeyA"
Const _FuncName_PeekMessage = "PeekMessageA"
Const _FuncName_PostMessage = "PostMessageA"
Const _FuncName_PostThreadMessage = "PostThreadMessageA"
Const _FuncName_RegisterClassEx = "RegisterClassExA"
Const _FuncName_RegisterClipboardFormat = "RegisterClipboardFormatA"
Const _FuncName_RegisterWindowMessage = "RegisterWindowMessageA"
Const _FuncName_RemoveProp = "RemovePropA"
Const _FuncName_SendDlgItemMessage = "SendDlgItemMessageA"
Const _FuncName_SendMessage = "SendMessageA"
Const _FuncName_SendMessageCallback = "SendMessageCallbackA"
Const _FuncName_SendMessageTimeout = "SendMessageTimeoutA"
Const _FuncName_SendNotifyMessage = "SendNotifyMessageA"
Const _FuncName_SetDlgItemText = "SetDlgItemTextA"
Const _FuncName_SetClassLong = "SetClassLongA"
Const _FuncName_SetClassLongPtr = "SetClassLongPtrA"
Const _FuncName_SetMenuItemInfo = "SetMenuItemInfoA"
Const _FuncName_SetProp = "SetPropA"
Const _FuncName_SetWindowLong = "SetWindowLongA"
Const _FuncName_SetWindowLongPtr = "SetWindowLongPtrA"
Const _FuncName_SetWindowsHookEx = "SetWindowsHookExA"
Const _FuncName_SetWindowText = "SetWindowTextA"
Const _FuncName_SystemParametersInfo = "SystemParametersInfoA"
Const _FuncName_TranslateAccelerator = "TranslateAcceleratorA"
Const _FuncName_UnregisterClass = "UnregisterClassA"
Const _FuncName_wsprintf = "wsprintfA"
Const _FuncName_wvsprintf = "wvsprintfA"
Const _FuncName_ChangeDisplaySettings = "ChangeDisplaySettingsA"
Const _FuncName_ChangeDisplaySettingsEx= "ChangeDisplaySettingsExA"
Const _FuncName_EnumDisplaySettings= "EnumDisplaySettingsA"
Const _FuncName_EnumDisplaySettingsEx= "EnumDisplaySettingsExA"
Const _FuncName_EnumDisplayDevices= "EnumDisplayDevicesA"
#endif

Type _System_DeclareHandle_HDWP:unused As DWord:End Type
TypeDef HDWP = *_System_DeclareHandle_HDWP

TypeDef WNDPROC = *Function(hwnd As HWND, msg As DWord, wParam As WPARAM, lParam As LPARAM) As LRESULT
TypeDef DLGPROC = *Function(hwnd As HWND, msg As DWord, wParam As WPARAM, lParam As LPARAM) As LONG_PTR

Type MSG
	hwnd As HWND
	message As DWord
	wParam As WPARAM
	lParam As LPARAM
	time As DWord
	pt As POINTAPI
End Type

Const IS_INTRESOURCE(_r) = ((((_r) As ULONG_PTR) >> 16) = 0)
Const MAKEINTRESOURCEW(i) = ((((i) As Word) As ULONG_PTR) As PCWSTR)
Const MAKEINTRESOURCEA(i) = ((((i) As Word) As ULONG_PTR) As PCSTR)
Const MAKEINTRESOURCE(i) = ((((i) As Word) As ULONG_PTR) As PCTSTR)

Const RT_CURSOR = MAKEINTRESOURCE(1)
Const RT_BITMAP = MAKEINTRESOURCE(2)
Const RT_ICON = MAKEINTRESOURCE(3)
Const RT_MENU = MAKEINTRESOURCE(4)
Const RT_DIALOG = MAKEINTRESOURCE(5)
Const RT_STRING = MAKEINTRESOURCE(6)
Const RT_FONTDIR = MAKEINTRESOURCE(7)
Const RT_FONT = MAKEINTRESOURCE(8)
Const RT_ACCELERATOR = MAKEINTRESOURCE(9)
Const RT_RCDATA = MAKEINTRESOURCE(10)
Const RT_MESSAGETABLE = MAKEINTRESOURCE(11)

Const DIFFERENCE = 11
Const RT_GROUP_CURSOR = MAKEINTRESOURCE((RT_CURSOR) As ULONG_PTR + DIFFERENCE)
Const RT_GROUP_ICON = MAKEINTRESOURCE((RT_ICON) As ULONG_PTR + DIFFERENCE)
Const RT_VERSION = MAKEINTRESOURCE(16)
Const RT_DLGINCLUDE = MAKEINTRESOURCE(17)
Const RT_PLUGPLAY = MAKEINTRESOURCE(19)
Const RT_VXD = MAKEINTRESOURCE(20)
Const RT_ANICURSOR = MAKEINTRESOURCE(21)
Const RT_ANIICON = MAKEINTRESOURCE(22)
Const RT_HTML = MAKEINTRESOURCE(23)
Const RT_MANIFEST = MAKEINTRESOURCE(24)
Const CREATEPROCESS_MANIFEST_RESOURCE_ID = MAKEINTRESOURCE(1)
Const ISOLATIONAWARE_MANIFEST_RESOURCE_ID = MAKEINTRESOURCE(2)
Const ISOLATIONAWARE_NOSTATICIMPORT_MANIFEST_RESOURCE_ID = MAKEINTRESOURCE(3)
Const MINIMUM_RESERVED_MANIFEST_RESOURCE_ID = MAKEINTRESOURCE(1)
Const MAXIMUM_RESERVED_MANIFEST_RESOURCE_ID = MAKEINTRESOURCE(16)

TypeDef WNDENUMPROC = *Function(hwnd As HWND, lParam As LPARAM) As BOOL
TypeDef HOOKPROC = *Function(code As Long, wParam As WPARAM, lParam As LPARAM) As LRESULT
TypeDef MONITORENUMPROC = *Function(hm As HMONITOR, hdc As HDC, ByRef rc As RECT, dwData As LPARAM) As BOOL

Const CS_VREDRAW =         &H0001
Const CS_HREDRAW =         &H0002
Const CS_DBLCLKS =         &H0008
Const CS_OWNDC =           &H0020
Const CS_CLASSDC =         &H0040
Const CS_PARENTDC =        &H0080
Const CS_NOCLOSE =         &H0200
Const CS_SAVEBITS =        &H0800
Const CS_BYTEALIGNCLIENT = &H1000
Const CS_BYTEALIGNWINDOW = &H2000
Const CS_GLOBALCLASS =     &H4000
Type WNDCLASSEXA
	cbSize        As DWord
	style         As DWord
	lpfnWndProc   As WNDPROC
	cbClsExtra    As Long
	cbWndExtra    As Long
	hInstance     As HINSTANCE
	hIcon         As HICON
	hCursor       As HCURSOR
	hbrBackground As HBRUSH
	lpszMenuName  As LPCSTR
	lpszClassName As LPCSTR
	hIconSm       As HICON
End Type
Type WNDCLASSEXW
	cbSize        As DWord
	style         As DWord
	lpfnWndProc   As WNDPROC
	cbClsExtra    As Long
	cbWndExtra    As Long
	hInstance     As HINSTANCE
	hIcon         As HICON
	hCursor       As HCURSOR
	hbrBackground As HBRUSH
	lpszMenuName  As LPCWSTR
	lpszClassName As LPCWSTR
	hIconSm       As HICON
End Type
#ifdef UNICODE
TypeDef WNDCLASSEX = WNDCLASSEXW
#else
TypeDef WNDCLASSEX = WNDCLASSEXA
#endif

'------------------------
' Dialog Box Command IDs
Const IDOK =              1
Const IDCANCEL =          2
Const IDABORT =           3
Const IDRETRY =           4
Const IDIGNORE =          5
Const IDYES =             6
Const IDNO =              7
Const IDCLOSE =           8
Const IDHELP =            9


'------------------------
' Menu flags and structs
Const MF_INSERT =          &H00000000
Const MF_CHANGE =          &H00000080
Const MF_APPEND =          &H00000100
Const MF_DELETE =          &H00000200
Const MF_REMOVE =          &H00001000
Const MF_BYCOMMAND =       &H00000000
Const MF_BYPOSITION =      &H00000400
Const MF_SEPARATOR =       &H00000800
Const MF_ENABLED =         &H00000000
Const MF_GRAYED =          &H00000001
Const MF_DISABLED =        &H00000002
Const MF_UNCHECKED =       &H00000000
Const MF_CHECKED =         &H00000008
Const MF_USECHECKBITMAPS = &H00000200
Const MF_STRING =          &H00000000
Const MF_BITMAP =          &H00000004
Const MF_OWNERDRAW =       &H00000100
Const MF_POPUP =           &H00000010
Const MF_MENUBARBREAK =    &H00000020
Const MF_MENUBREAK =       &H00000040
Const MF_UNHILITE =        &H00000000
Const MF_HILITE =          &H00000080
Const MF_DEFAULT =         &H00001000
Const MF_SYSMENU =         &H00002000
Const MF_HELP =            &H00004000
Const MF_RIGHTJUSTIFY =    &H00004000
Const MF_MOUSESELECT =     &H00008000

Const MFS_GRAYED =        &H00000003
Const MFS_DISABLED =      MFS_GRAYED
Const MFS_CHECKED =       MF_CHECKED
Const MFS_HILITE =        MF_HILITE
Const MFS_ENABLED =       MF_ENABLED
Const MFS_UNCHECKED =     MF_UNCHECKED
Const MFS_UNHILITE =      MF_UNHILITE
Const MFS_DEFAULT =       MF_DEFAULT
Const MFS_MASK =          &H0000108B
Const MFS_HOTTRACKDRAWN = &H10000000
Const MFS_CACHEDBMP =     &H20000000
Const MFS_BOTTOMGAPDROP = &H40000000
Const MFS_TOPGAPDROP =    &H80000000
Const MFS_GAPDROP =       &HC0000000

Const MIIM_STATE =      &H00000001
Const MIIM_ID =         &H00000002
Const MIIM_SUBMENU =    &H00000004
Const MIIM_CHECKMARKS = &H00000008
Const MIIM_TYPE =       &H00000010
Const MIIM_DATA =       &H00000020
Const MIIM_STRING =     &H00000040
Const MIIM_BITMAP =     &H00000080
Const MIIM_FTYPE =      &H00000100
Const MFT_STRING =        MF_STRING
Const MFT_BITMAP =        MF_BITMAP
Const MFT_MENUBARBREAK =  MF_MENUBARBREAK
Const MFT_MENUBREAK =     MF_MENUBREAK
Const MFT_OWNERDRAW =     MF_OWNERDRAW
Const MFT_RADIOCHECK =    &H00000200
Const MFT_SEPARATOR =     MF_SEPARATOR
Const MFT_RIGHTORDER =    &H00002000
Const MFT_RIGHTJUSTIFY =  MF_RIGHTJUSTIFY

Type MENUITEMINFOW
	cbSize        As DWord
	fMask         As DWord
	fType         As DWord
	fState        As DWord
	wID           As DWord
	hSubMenu      As HMENU
	hbmpChecked   As HBITMAP
	hbmpUnchecked As HBITMAP
	dwItemData    As ULONG_PTR
	dwTypeData    As LPWSTR
	cch           As DWord
End Type
Type MENUITEMINFOA
	cbSize        As DWord
	fMask         As DWord
	fType         As DWord
	fState        As DWord
	wID           As DWord
	hSubMenu      As HMENU
	hbmpChecked   As HBITMAP
	hbmpUnchecked As HBITMAP
	dwItemData    As ULONG_PTR
	dwTypeData    As LPSTR
	cch           As DWord
End Type
#ifdef UNICODE
TypeDef MENUITEMINFO = MENUITEMINFOW
#else
TypeDef MENUITEMINFO = MENUITEMINFOA
#endif

'------------
' Scroll Bar
Const SB_HORZ = 0
Const SB_VERT = 1
Const SB_CTL =  2
Const SB_BOTH = 3

' SCROLLINFO struct
Const SIF_RANGE =           &H0001
Const SIF_PAGE =            &H0002
Const SIF_POS =             &H0004
Const SIF_DISABLENOSCROLL = &H0008
Const SIF_TRACKPOS =        &H0010
Const SIF_ALL =             SIF_RANGE or SIF_PAGE or SIF_POS or SIF_TRACKPOS
Type SCROLLINFO
	cbSize As DWord
	fMask As DWord
	nMin As Long
	nMax As Long
	nPage As DWord
	nPos As Long
	nTrackPos As Long
End Type


' combo box
Const CB_ERR =      -1
Const CB_ERRSPACE = -2


' Clipboard Formats
Const CF_TEXT =         1
Const CF_BITMAP =       2
Const CF_METAFILEPICT = 3
Const CF_SYLK =         4
Const CF_DIF =          5
Const CF_TIFF =         6
Const CF_OEMTEXT =      7
Const CF_DIB =          8
Const CF_PALETTE =      9
Const CF_PENDATA =      10
Const CF_RIFF =         11
Const CF_WAVE =         12
Const CF_UNICODETEXT =  13
Const CF_ENHMETAFILE =  14
Const CF_HDROP =        15
Const CF_LOCALE =       16
Const CF_MAX =          17
Const CF_OWNERDISPLAY =    &H0080
Const CF_DSPTEXT =         &H0081
Const CF_DSPBITMAP =       &H0082
Const CF_DSPMETAFILEPICT = &H0083
Const CF_DSPENHMETAFILE =  &H008E
Const CF_PRIVATEFIRST =    &H0200
Const CF_PRIVATELAST =     &H02FF
Const CF_GDIOBJFIRST =     &H0300
Const CF_GDIOBJLAST =      &H03FF

'-------------
' Window API

Declare Function AdjustWindowRect Lib "user32" (ByRef Rect As RECT, dwStyle As DWord, bMenu As BOOL) As BOOL
Declare Function AdjustWindowRectEx Lib "user32" (ByRef Rect As RECT, dwStyle As DWord, bMenu As BOOL, dwExStyle As DWord) As BOOL
Declare Function AnyPopup Lib "user32" () As BOOL
Declare Function ArrangeIconicWindows Lib "user32" (hWnd As HWND) As DWord

Type PAINTSTRUCT
	hdc As HDC
	fErase As BOOL
	rcPaint As RECT
	fRestore As BOOL
	fIncUpdate As BOOL
	rgbReserved[ELM(32)] As Byte
End Type
Declare Function BeginPaint Lib "user32" (hWnd As HWND, ByRef Paint As PAINTSTRUCT) As HDC
Declare Function BringWindowToTop Lib "user32" (hWnd As HWND) As Long

Declare Function CallNextHookEx Lib "user32" (hHook As HHOOK, nCode As Long, wParam As WPARAM, lParam As LPARAM) As LRESULT
Function DefHookProc(ByVal nCode As Long, ByVal wParam As WPARAM, ByVal lParam As LPARAM, ByVal phhk As *HHOOK) As LRESULT
	Return CallNextHookEx(phhk[0], nCode, wParam, lParam)
End Function

Declare Function CallWindowProc Lib "user32" Alias _FuncName_CallWindowProc (lpPrevWndFunc As WNDPROC, hWnd As HWND, Msg As DWord, wParam As WPARAM, lParam As LPARAM) As LRESULT
Declare Function ChangeClipboardChain Lib "user32" (hwndRemove As HWND, hwndNewNext As HWND) As BOOL
Declare Function CharLower Lib "user32" Alias _FuncName_CharLower (psz As PTSTR) As PTSTR
Declare Function CharNext Lib "user32" Alias _FuncName_CharNext (lpszCurrent As LPCTSTR) As LPTSTR
Declare Function CharNextExA Lib "user32" (CodePage As Word, lpCurrentChar As LPCSTR, dwFlags As DWord) As LPSTR
Declare Function CharPrev Lib "user32" Alias _FuncName_CharPrev (lpszStart As LPCTSTR, lpszCurrent As LPCTSTR) As LPTSTR
Declare Function CharPrevExA Lib "user32" (CodePage As Word, lpStart As LPCSTR, lpCurrentChar As LPCSTR, dwFlags As DWord) As LPSTR
Declare Function CharUpper Lib "user32" Alias _FuncName_CharUpper (psz As PTSTR) As PTSTR
Declare Function CheckMenuItem Lib "user32" (hMenu As HMENU, uIDCheckItem As DWord, uCheck As DWord) As DWord
Declare Function CheckMenuRadioItem Lib "user32" (hMenu As HMENU, idFirst As DWord, idLast As DWord, idCheck As DWord, uFlags As DWord) As BOOL
Declare Function CheckDlgButton Lib "user32" (hDlg As HWND, nIDButton As Long, uCheck As DWord) As BOOL
Declare Function CheckRadioButton Lib "user32" (hDlg As HWND, nIDFirstButton As Long, nIDLastButton As Long, nIDCheckButton As Long) As BOOL
Declare Function ChildWindowFromPoint Lib "user32" (hWndParent As HWND, x As Long, y As Long) As HWND
Const CWP_ALL =             &H0000
Const CWP_SKIPINVISIBLE =   &H0001
Const CWP_SKIPDISABLED =    &H0002
Const CWP_SKIPTRANSPARENT = &H0004
Declare Function ChildWindowFromPointEx Lib "user32" (hWndParent As HWND, x As Long, y As Long, uFlags As DWord) As HWND

Declare Function ClientToScreen Lib "user32" (hWnd As HWND, ByRef lpPoint As POINTAPI) As BOOL
Declare Function ClipCursor Lib "user32" (ByRef lpRect As RECT) As BOOL
Declare Function CloseClipboard Lib "user32" () As BOOL
Declare Function CloseWindow Lib "user32" (hWnd As HWND) As BOOL
Declare Function CopyImage Lib "user32" (hImage As HANDLE, uType As DWord, cxDesired As Long, cyDesired As Long, fuFlags As DWord) As HANDLE
Declare Function CountClipboardFormats Lib "user32" () As Long
Const FVIRTKEY = &H01
Const FNOINVERT = &H02
Const FSHIFT = &H04
Const FCONTROL = &H08
Const FALT = &H10
Type ACCEL
	fVirt As Byte
	key As Word
	cmd As Word
End Type
Declare Function CreateAcceleratorTable Lib "user32" Alias _FuncName_CreateAcceleratorTable (ByRef acl As ACCEL, i As Long) As HACCEL
Declare Function CreateCaret Lib "user32" (hWnd As HWND, hBitmap As HBITMAP, nWidth As Long, nHeight As Long) As BOOL
Declare Function CreateCursor Lib "user32" (hInst As HINSTANCE, xHotSpot As Long, yHotSpot As Long, nWidth As Long, nHeight As Long, pvANDPlane As VoidPtr, pvXORPlane As VoidPtr) As HCURSOR
Declare Function CreateIcon Lib "user32" (hInst As HINSTANCE, nWidth As Long, nHeight As Long, cPlanes As Byte, cBitsPixel As Byte, lpbANDbits As VoidPtr, lpbXORbits As VoidPtr) As HICON
Declare Function LookupIconIdFromDirectory Lib "user32" (ByVal presbits As *BYTE, ByVal fIcon As BOOL) As Long
Declare Function LookupIconIdFromDirectoryEx Lib "user32" (ByVal presbits As *BYTE, ByVal fIcon As BOOL, ByVal cxDesired As Long, ByVal cyDesired As Long, ByVal Flags As DWord) As Long

Type ICONINFO
	fIcon As BOOL
	xHotspot As DWord
	yHotspot As DWord
	hbmMask As HBITMAP
	hbmColor As HBITMAP
End Type
Declare Function CreateIconIndirect Lib "user32" (ByRef pIconInfo As ICONINFO) As HICON

Declare Function CreateMenu Lib "user32" () As HMENU
Declare Function CreatePopupMenu Lib "user32" () As HMENU

Const CW_USEDEFAULT = &H80000000
Declare Function CreateWindowEx Lib "user32" Alias _FuncName_CreateWindowEx (dwExStyle As DWord, pClassName As PCTSTR, lpWindowName As PCTSTR, dwStyle As DWord, x As Long, y As Long, nWidth As Long, nHeight As Long, hwndParent As HWND, hmenu As HMENU, hInstance As HINSTANCE, pParm As VoidPtr) As HWND

Declare Function CreateMDIWindowA Lib "user32" (ByVal lpClassName As LPCSTR, ByVal lpWindowName As LPCSTR, ByVal dwStyle As DWord, ByVal X As Long, ByVal Y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hWndParent As HWND, ByVal hInstance As HINSTANCE, ByVal lParam As LPARAM) As HWND
Declare Function CreateMDIWindowW Lib "user32" (ByVal lpClassName As LPCWSTR, ByVal lpWindowName As LPCWSTR, ByVal dwStyle As DWord, ByVal X As Long, ByVal Y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hWndParent As HWND, ByVal hInstance As HINSTANCE, ByVal lParam As LPARAM) As HWND
#ifdef UNICODE
Declare Function CreateMDIWindow Lib "user32" Alias "CreateMDIWindowW" (ByVal lpClassName As LPCWSTR, ByVal lpWindowName As LPCWSTR, ByVal dwStyle As DWord, ByVal X As Long, ByVal Y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hWndParent As HWND, ByVal hInstance As HINSTANCE, ByVal lParam As LPARAM) As HWND
#else
Declare Function CreateMDIWindow Lib "user32" Alias "CreateMDIWindowA" (ByVal lpClassName As LPCSTR, ByVal lpWindowName As LPCSTR, ByVal dwStyle As DWord, ByVal X As Long, ByVal Y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hWndParent As HWND, ByVal hInstance As HINSTANCE, ByVal lParam As LPARAM) As HWND
#endif ' !UNICODE

Declare Function DefDlgProc Lib "user32" Alias _FuncName_DefWindowProc (hDlg As HWND, Msg As DWord, wParam As WPARAM, lParam As LPARAM) As LRESULT
Declare Function DefWindowProc Lib "user32" Alias _FuncName_DefWindowProc (hWnd As HWND, wMsg As DWord, wParam As WPARAM, lParam As LPARAM) As LRESULT

Declare Function DefFrameProcA Lib "user32" (ByRef hWnd As HWND, ByRef hWndMDIClient As HWND, ByVal uMsg As DWord, ByVal wParam As WPARAM, ByVal lParam As LPARAM) As LRESULT
Declare Function DefFrameProcW Lib "user32" (ByRef hWnd As HWND, ByRef hWndMDIClient As HWND, ByVal uMsg As DWord, ByVal wParam As WPARAM, ByVal lParam As LPARAM) As LRESULT
#ifdef UNICODE
Declare Function DefFrameProc Lib "user32" Alias "DefFrameProcW" (ByRef hWnd As HWND, ByRef hWndMDIClient As HWND, ByVal uMsg As DWord, ByVal wParam As WPARAM, ByVal lParam As LPARAM) As LRESULT
#else
Declare Function DefFrameProc Lib "user32" Alias "DefFrameProcA" (ByRef hWnd As HWND, ByRef hWndMDIClient As HWND, ByVal uMsg As DWord, ByVal wParam As WPARAM, ByVal lParam As LPARAM) As LRESULT
#endif ' !UNICODE

Declare Function DefMDIChildProcA Lib "user32" (ByVal hWnd As HWND, ByVal uMsg As DWord, ByVal wParam As WPARAM, ByVal lParam As LPARAM) As LRESULT
Declare Function DefMDIChildProcW Lib "user32" (ByVal hWnd As HWND, ByVal uMsg As DWord, ByVal wParam As WPARAM, ByVal lParam As LPARAM) As LRESULT
#ifdef UNICODE
Declare Function DefMDIChildProc Lib "user32" Alias "DefMDIChildProcW" (ByVal hWnd As HWND, ByVal uMsg As DWord, ByVal wParam As WPARAM, ByVal lParam As LPARAM) As LRESULT
#else
Declare Function DefMDIChildProc Lib "user32" Alias "DefMDIChildProcA" (ByVal hWnd As HWND, ByVal uMsg As DWord, ByVal wParam As WPARAM, ByVal lParam As LPARAM) As LRESULT
#endif ' !UNICODE

Declare Function DeleteMenu Lib "user32" (hMenu As HMENU, uPosition As DWord, uFlags As DWord) As BOOL
Declare Function DestroyAcceleratorTable Lib "user32" (hAccel As HACCEL) As BOOL

Declare Function TranslateMDISysAccel Lib "user32" (ByVal hWndClient As HWND, ByRef lpMsg As MSG) As BOOL
Declare Function ArrangeIconicWindows Lib "user32" (ByVal hWnd As HWND) As DWord
Declare Function TileWindows Lib "user32" (ByVal hwndParent As HWND, ByVal wHow As DWord, ByRef lpRect As RECT, ByVal cKids As DWord, ByVal lpKids As *HWND) As Word
Declare Function CascadeWindows Lib "user32" (ByVal hwndParent As HWND, ByVal wHow As DWord, ByRef lpRect As RECT, ByVal cKids As DWord, ByVal lpKids As *HWND) As Word

Declare Function DestroyCaret Lib "user32" () As BOOL
Declare Function DestroyCursor Lib "user32" (hCursor As HCURSOR) As BOOL
Declare Function DestroyIcon Lib "user32" (hIcon As HICON) As BOOL
Declare Function DestroyMenu Lib "user32" (hMenu As HMENU) As BOOL
Declare Function DestroyWindow Lib "user32" (hWnd As HWND) As BOOL
Type DLGITEMTEMPLATE
	style As DWord
	dwExtendedStyle As DWord
	x As Integer
	y As Integer
	cx As Integer
	cy As Integer
	id As Word
End Type
Type DLGTEMPLATE
	style As DWord
	dwExtendedStyle As DWord
	cdit As Word
	x As Integer
	y As Integer
	cx As Integer
	cy As Integer
End Type
Declare Function DialogBoxIndirectParam Lib "user32" Alias _FuncName_DialogBoxIndirectParam (hInstance As HINSTANCE, DialogTemplate As *DLGTEMPLATE, hwndParent As HWND, pDialogFunc As DLGPROC, InitParam As LPARAM) As LONG_PTR
Declare Function MapDialogRect Lib "user32" (ByVal hDlg As HWND, ByRef lpRect As RECT) As BOOL
Declare Function DispatchMessage Lib "user32" Alias _FuncName_DispatchMessage (ByRef Msg As MSG) As LRESULT
Declare Function DlgDirList Lib "user32" Alias _FuncName_DlgDirList (hDlg As HWND, lpPathSpec As LPTSTR, nIDListBox As Long, nIDStaticPath As Long, uFileType As DWord) As Long
Declare Function DlgDirListComboBox Lib "user32" Alias _FuncName_DlgDirListComboBox (hDlg As HWND, lpPathSpec As LPTSTR, nIDComboBox As Long, nIDStaticPath As Long,uFileType As DWord) As Long
Declare Function DlgDirSelectComboBoxEx Lib "user32" Alias _FuncName_DlgDirSelectComboBoxEx (hDlg As HWND, lpString As LPTSTR, nCount As Long, nIDComboBox As Long) As BOOL
Declare Function DlgDirSelectEx Lib "user32" Alias _FuncName_DlgDirSelectEx (hDlg As HWND, lpString As LPTSTR, nCount As Long, nIDListBox As Long) As BOOL
Const BDR_RAISEDOUTER = &H0001
Const BDR_SUNKENOUTER = &H0002
Const BDR_RAISEDINNER = &H0004
Const BDR_SUNKENINNER = &H0008
Const BDR_OUTER =       &H0003
Const BDR_INNER =       &H000c
Const EDGE_RAISED =     BDR_RAISEDOUTER or BDR_RAISEDINNER
Const EDGE_SUNKEN =     BDR_SUNKENOUTER or BDR_SUNKENINNER
Const EDGE_ETCHED =     BDR_SUNKENOUTER or BDR_RAISEDINNER
Const EDGE_BUMP =       BDR_RAISEDOUTER or BDR_SUNKENINNER
Const BF_LEFT =        &H0001
Const BF_TOP =         &H0002
Const BF_RIGHT =       &H0004
Const BF_BOTTOM =      &H0008
Const BF_TOPLEFT =     BF_TOP or BF_LEFT
Const BF_TOPRIGHT =    BF_TOP or BF_RIGHT
Const BF_BOTTOMLEFT =  BF_BOTTOM or BF_LEFT
Const BF_BOTTOMRIGHT = BF_BOTTOM or BF_RIGHT
Const BF_RECT =        BF_LEFT or BF_TOP or BF_RIGHT or BF_BOTTOM
Const BF_DIAGONAL =    &H0010
Const BF_DIAGONAL_ENDTOPRIGHT =    BF_DIAGONAL or BF_TOP or BF_RIGHT
Const BF_DIAGONAL_ENDTOPLEFT =     BF_DIAGONAL or BF_TOP or BF_LEFT
Const BF_DIAGONAL_ENDBOTTOMLEFT =  BF_DIAGONAL or BF_BOTTOM or BF_LEFT
Const BF_DIAGONAL_ENDBOTTOMRIGHT = BF_DIAGONAL or BF_BOTTOM or BF_RIGHT
Const BF_MIDDLE =     &H0800
Const BF_SOFT =       &H1000
Const BF_ADJUST =     &H2000
Const BF_FLAT =       &H4000
Const BF_MONO =       &H8000
Declare Function DrawEdge Lib "user32" (hdc As HDC, ByRef lpRect As RECT, edge As DWord, grfFlags As DWord) As BOOL

Const DFC_CAPTION =   1
Const DFC_MENU =      2
Const DFC_SCROLL =    3
Const DFC_BUTTON =    4
Const DFC_POPUPMENU = 5
Const DFCS_CAPTIONCLOSE =        &H0000
Const DFCS_CAPTIONMIN =          &H0001
Const DFCS_CAPTIONMAX =          &H0002
Const DFCS_CAPTIONRESTORE =      &H0003
Const DFCS_CAPTIONHELP =         &H0004
Const DFCS_MENUARROW =           &H0000
Const DFCS_MENUCHECK =           &H0001
Const DFCS_MENUBULLET =          &H0002
Const DFCS_MENUARROWRIGHT =      &H0004
Const DFCS_SCROLLUP =            &H0000
Const DFCS_SCROLLDOWN =          &H0001
Const DFCS_SCROLLLEFT =          &H0002
Const DFCS_SCROLLRIGHT =         &H0003
Const DFCS_SCROLLCOMBOBOX =      &H0005
Const DFCS_SCROLLSIZEGRIP =      &H0008
Const DFCS_SCROLLSIZEGRIPRIGHT = &H0010
Const DFCS_BUTTONCHECK =         &H0000
Const DFCS_BUTTONRADIOIMAGE =    &H0001
Const DFCS_BUTTONRADIOMASK =     &H0002
Const DFCS_BUTTONRADIO =         &H0004
Const DFCS_BUTTON3STATE =        &H0008
Const DFCS_BUTTONPUSH =          &H0010
Const DFCS_INACTIVE =            &H0100
Const DFCS_PUSHED =              &H0200
Const DFCS_CHECKED =             &H0400
Const DFCS_TRANSPARENT =         &H0800
Const DFCS_HOT =                 &H1000
Const DFCS_ADJUSTRECT =          &H2000
Const DFCS_FLAT =                &H4000
Const DFCS_MONO =                &H8000
Declare Function DrawFrameControl Lib "user32" (hdc As HDC, ByRef lpRect As RECT, uType As DWord, uState As DWord) As BOOL

Declare Function DrawIcon Lib "user32" (hdc As HDC, x As Long, y As Long, hIcon As HICON) As BOOL

Const DI_MASK =        &H0001
Const DI_IMAGE =       &H0002
Const DI_NORMAL =      &H0003
Const DI_COMPAT =      &H0004
Const DI_DEFAULTSIZE = &H0008
Declare Function DrawIconEx Lib "user32" (hdc As HDC, xLeft As Long, yTop As Long, hIcon As HICON, cxWidth As Long, cyWidth As Long, istepIfAniCur As DWord, hbrFlickerFreeDraw As HBRUSH, diFlags As DWord) As BOOL

Declare Function DrawMenuBar Lib "user32" (hwnd As HWND) As BOOL

Type DROPSTRUCT
	hwndSource As HWND
	hwndSink As HWND
	wFmt As DWord
	dwData As ULONG_PTR
	ptDrop As POINTAPI
	dwControlData As DWord
End Type
TypeDef PDROPSTRUCT= *DROPSTRUCT
TypeDef LPDROPSTRUCT= *DROPSTRUCT

Const DOF_EXECUTABLE = &H8001
Const DOF_DOCUMENT = &H8002
Const DOF_DIRECTORY = &H8003
Const DOF_MULTIPLE = &H8004
Const DOF_PROGMAN = &H0001
Const DOF_SHELLDATA = &H0002

Const DO_DROPFILE = &H454C4946
Const DO_PRINTFILE = &H544E5250

Declare Function DragObject Lib "user32" (ByVal hwndParent As HWND, ByVal hwndFrom As HWND, ByVal fmt As DWord, ByVal data As ULONG_PTR, ByVal hcur As HCURSOR) As DWord
Declare Function DragDetect Lib "user32" (ByVal hwnd As HWND, ByRef pt As POINTAPI) As BOOL


Const DT_TOP =            &H00000000
Const DT_LEFT =           &H00000000
Const DT_CENTER =         &H00000001
Const DT_RIGHT =          &H00000002
Const DT_VCENTER =        &H00000004
Const DT_BOTTOM =         &H00000008
Const DT_WORDBREAK =      &H00000010
Const DT_SINGLELINE =     &H00000020
Const DT_EXPANDTABS =     &H00000040
Const DT_TABSTOP =        &H00000080
Const DT_NOCLIP =         &H00000100
Const DT_EXTERNALLEADING =&H00000200
Const DT_CALCRECT =       &H00000400
Const DT_NOPREFIX =       &H00000800
Const DT_INTERNAL =       &H00001000
Const DT_EDITCONTROL =    &H00002000
Const DT_PATH_ELLIPSIS =  &H00004000
Const DT_END_ELLIPSIS =   &H00008000
Const DT_MODIFYSTRING =   &H00010000
Const DT_RTLREADING =     &H00020000
Const DT_WORD_ELLIPSIS =  &H00040000
Declare Function DrawText Lib "user32" Alias _FuncName_DrawText (hdc As HDC, lpStr As PCTSTR, nCount As Long, ByRef Rect As RECT, dwFormat As DWord) As BOOL

Type DRAWTEXTPARAMS
	cbSize As DWord
	iTabLength As Long
	iLeftMargin As Long
	iRightMargin As Long
	uiLengthDrawn As DWord
End Type
Declare Function DrawTextEx Lib "user32" Alias _FuncName_DrawTextEx (hdc As HDC, pchText As PCTSTR, cchText As Long, ByRef Rect As RECT, dwDTFormat As DWord, ByRef DTParams As DRAWTEXTPARAMS) As BOOL

TypeDef GRAYSTRINGPROC = *Function(hDC As HDC, lParam As LPARAM, l As Long) As BOOL

Declare Function GrayStringA Lib "user32" (ByVal hDC As HDC, ByVal hBrush As HBRUSH, ByVal lpOutputFunc As GRAYSTRINGPROC, ByVal lpData As LPARAM, ByVal nCount As Long, ByVal X As Long, ByVal Y As Long, ByVal nWidth As Long, ByVal nHeight As Long) As BOOL
Declare Function GrayStringW Lib "user32" (ByVal hDC As HDC, ByVal hBrush As HBRUSH, ByVal lpOutputFunc As GRAYSTRINGPROC, ByVal lpData As LPARAM, ByVal nCount As Long, ByVal X As Long, ByVal Y As Long, ByVal nWidth As Long, ByVal nHeight As Long) As BOOL
#ifdef UNICODE
Declare Function GrayString Lib "user32" Alias "GrayStringW" (ByVal hDC As HDC, ByVal hBrush As HBRUSH, ByVal lpOutputFunc As GRAYSTRINGPROC, ByVal lpData As LPARAM, ByVal nCount As Long, ByVal X As Long, ByVal Y As Long, ByVal nWidth As Long, ByVal nHeight As Long) As BOOL
#else
Declare Function GrayString Lib "user32" Alias "GrayStringA" (ByVal hDC As HDC, ByVal hBrush As HBRUSH, ByVal lpOutputFunc As GRAYSTRINGPROC, ByVal lpData As LPARAM, ByVal nCount As Long, ByVal X As Long, ByVal Y As Long, ByVal nWidth As Long, ByVal nHeight As Long) As BOOL
#endif ' !UNICODE

Const DST_COMPLEX = &H0000
Const DST_TEXT = &H0001
Const DST_PREFIXTEXT = &H0002
Const DST_ICON = &H0003
Const DST_BITMAP = &H0004

Const DSS_NORMAL = &H0000
Const DSS_UNION = &H0010
Const DSS_DISABLED = &H0020
Const DSS_MONO = &H0080
Const DSS_HIDEPREFIX = &H0200
Const DSS_PREFIXONLY = &H0400
Const DSS_RIGHT = &H8000

TypeDef DRAWSTATEPROC = *Function(hdc As HDC, lData As LPARAM, wData As WPARAM, cx As Long, cy As Long) As BOOL

Declare Function DrawStateA Lib "user32" (ByVal hdc As HDC, ByVal hbrFore As HBRUSH, ByVal qfnCallBack As DRAWSTATEPROC, ByVal lData As LPARAM, ByVal wData As WPARAM, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal uFlags As DWord) As BOOL
Declare Function DrawStateW Lib "user32" (ByVal hdc As HDC, ByVal hbrFore As HBRUSH, ByVal qfnCallBack As DRAWSTATEPROC, ByVal lData As LPARAM, ByVal wData As WPARAM, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal uFlags As DWord) As BOOL
#ifdef UNICODE
Declare Function DrawState Lib "user32" Alias "DrawStateW" (ByVal hdc As HDC, ByVal hbrFore As HBRUSH, ByVal qfnCallBack As DRAWSTATEPROC, ByVal lData As LPARAM, ByVal wData As WPARAM, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal uFlags As DWord) As BOOL
#else
Declare Function DrawState Lib "user32" Alias "DrawStateA" (ByVal hdc As HDC, ByVal hbrFore As HBRUSH, ByVal qfnCallBack As DRAWSTATEPROC, ByVal lData As LPARAM, ByVal wData As WPARAM, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal uFlags As DWord) As BOOL
#endif ' !UNICODE

Declare Function TabbedTextOutA Lib "user32" (ByVal hdc As HDC, ByVal x As Long, ByVal y As Long, ByVal lpString As LPCSTR, ByVal chCount As Long, ByVal nTabPositions As Long, ByVal lpnTabStopPositions As *Long, ByVal nTabOrigin As Long) As Long
Declare Function TabbedTextOutW Lib "user32" (ByVal hdc As HDC, ByVal x As Long, ByVal y As Long, ByVal lpString As LPCWSTR, ByVal chCount As Long, ByVal nTabPositions As Long, ByVal lpnTabStopPositions As *Long, ByVal nTabOrigin As Long) As Long
#ifdef UNICODE
Declare Function TabbedTextOut Lib "user32" Alias "TabbedTextOutW" (ByVal hdc As HDC, ByVal x As Long, ByVal y As Long, ByVal lpString As LPCWSTR, ByVal chCount As Long, ByVal nTabPositions As Long, ByVal lpnTabStopPositions As *Long, ByVal nTabOrigin As Long) As Long
#else
Declare Function TabbedTextOut Lib "user32" Alias "TabbedTextOutA" (ByVal hdc As HDC, ByVal x As Long, ByVal y As Long, ByVal lpString As LPCSTR, ByVal chCount As Long, ByVal nTabPositions As Long, ByVal lpnTabStopPositions As *Long, ByVal nTabOrigin As Long) As Long
#endif ' !UNICODE

Declare Function GetTabbedTextExtentA Lib "user32" (ByVal hdc As HDC, ByVal lpString As LPCSTR, ByVal chCount As Long, ByVal nTabPositions As Long, ByVal lpnTabStopPositions As *Long) As DWord
Declare Function GetTabbedTextExtentW Lib "user32" (ByVal hdc As HDC, ByVal lpString As LPCWSTR, ByVal chCount As Long, ByVal nTabPositions As Long, ByVal lpnTabStopPositions As *Long) As DWord
#ifdef UNICODE
Declare Function GetTabbedTextExtent Lib "user32" Alias "GetTabbedTextExtentW" (ByVal hdc As HDC, ByVal lpString As LPCWSTR, ByVal chCount As Long, ByVal nTabPositions As Long, ByVal lpnTabStopPositions As *Long) As DWord
#else
Declare Function GetTabbedTextExtent Lib "user32" Alias "GetTabbedTextExtentA" (ByVal hdc As HDC, ByVal lpString As LPCSTR, ByVal chCount As Long, ByVal nTabPositions As Long, ByVal lpnTabStopPositions As *Long) As DWord
#endif ' !UNICODE

Declare Function EmptyClipboard Lib "user32" () As BOOL
Declare Function EnableMenuItem Lib "user32" (hMenu As HMENU, uIDEnableItem As DWord, uEnable As DWord) As BOOL

Const ESB_ENABLE_BOTH =   &H0000
Const ESB_DISABLE_BOTH =  &H0003
Const ESB_DISABLE_LEFT =  &H0001
Const ESB_DISABLE_RIGHT = &H0002
Const ESB_DISABLE_UP =    &H0001
Const ESB_DISABLE_DOWN =  &H0002
Const ESB_DISABLE_LTUP =  ESB_DISABLE_LEFT
Const ESB_DISABLE_RTDN =  ESB_DISABLE_RIGHT
Declare Function EnableScrollBar Lib "user32" (hWnd As HWND, dwSBflags As DWord, dwArrows As DWord) As BOOL

Declare Function EnableWindow Lib "user32" (hWnd As HWND, bEnable As BOOL) As BOOL
Declare Function EndDialogAPI Lib "user32" Alias "EndDialog" (hwndDlg As HWND, nRet As Long) As BOOL
Declare Function EndPaint Lib "user32" (hWnd As HWND, ByRef lpPaint As PAINTSTRUCT) As BOOL
Declare Function EnumClipboardFormats Lib "user32" (uFormat As DWord) As DWord
Declare Function EnumChildWindows Lib "user32" (hwndParent As HWND, pEnumFunc As WNDENUMPROC, lParam As LPARAM) As BOOL
Declare Function EnumDisplayMonitors Lib "user32.dll" (ByVal hdc As HDC, lprcClip As *RECT, ByVal lpfnEnum As MONITORENUMPROC, dwData As LPARAM) As BOOL
Declare Function EnumThreadWindows Lib "user32" (dwThreadId As DWord, pEnumFunc As WNDENUMPROC, lParam As LPARAM) As BOOL
Declare Function EnumWindows Lib "user32" (pEnumFunc As WNDENUMPROC, lParam As LPARAM) As BOOL
Declare Function ExitWindowsEx Lib "user32" (uFlags As DWord, dwReserved As DWord) As BOOL
Declare Function FillRect Lib "user32" (hdc As HDC, ByRef lpRect As RECT, hBrush As HBRUSH) As BOOL

Declare Function DrawFocusRect Lib "user32" (ByVal hDC As HDC, ByRef lprc As RECT) As BOOL

Declare Function FindWindow Lib "user32" Alias _FuncName_FindWindow (pClassName As PCTSTR, lpWindowName As PCTSTR) As HWND
Declare Function FindWindowEx Lib "user32" Alias _FuncName_FindWindowEx (hwndParent As HWND, hwndChildAfter As HWND, pszClass As PCTSTR, pszWindow As PCTSTR) As HWND
Declare Function FlashWindow Lib "user32" (hWnd As HWND, bInvert As BOOL) As BOOL
Const FLASHW_STOP = 0
Const FLASHW_CAPTION = 1
Const FLASHW_TRAY = 2
Const FLASHW_ALL = (FLASHW_CAPTION Or FLASHW_TRAY)
Const FLASHW_TIMER = 4
Const FLASHW_TIMERNOFG = 12
Type FLASHWINFO
	cbSize As DWord
	hWnd As HWND
	dwFlags As DWord
	uCount As DWord
	dwTimeout As DWord
End Type
Declare Function FlashWindowEx Lib "user32" (ByRef fwi As FLASHWINFO) As Long
Declare Function FrameRect Lib "user32" (hdc As HDC, ByRef lpRect As RECT, hBrush As HBRUSH) As Long
Declare Function GetActiveWindow Lib "user32" () As HWND
Declare Function GetAsyncKeyState Lib "user32" (vKey As Long) As Integer
Declare Function GetCapture Lib "user32" () As HWND
Declare Function GetCaretPos Lib "user32" (ByRef lpPoint As POINTAPI) As BOOL
Declare Function GetClassInfoEx Lib "user32" Alias _FuncName_GetClassInfoEx (hInst As HINSTANCE, pszClass As PCTSTR, ByRef lpwcx As WNDCLASSEX) As BOOL

Const GCL_MENUNAME =      -8
Const GCL_HBRBACKGROUND = -10
Const GCL_HCURSOR =       -12
Const GCL_HICON =         -14
Const GCL_HMODULE =       -16
Const GCL_CBWNDEXTRA =    -18
Const GCL_CBCLSEXTRA =    -20
Const GCL_WNDPROC =       -24
Const GCL_STYLE =         -26
Const GCW_ATOM =          -32
Const GCL_HICONSM =       -34
#ifdef _WIN64
Declare Function GetClassLong Lib "user32" Alias _FuncName_GetClassLongPtr (hWnd As HWND, nIndex As Long) As LONG_PTR
Declare Function GetClassLongPtr Lib "user32" Alias _FuncName_GetClassLongPtr (hWnd As HWND, nIndex As Long) As LONG_PTR
#else
Declare Function GetClassLong Lib "user32" Alias _FuncName_GetClassLong (hWnd As HWND, nIndex As Long) As LONG_PTR
Declare Function GetClassLongPtr Lib "user32" Alias _FuncName_GetClassLong (hWnd As HWND, nIndex As Long) As LONG_PTR
#endif

Declare Function GetClassName Lib "user32" Alias _FuncName_GetClassName (hWnd As HWND, lpClassName As PTSTR, nMaxCount As Long) As Long
Declare Function GetClientRect Lib "user32" (hWnd As HWND, ByRef lpRect As RECT) As BOOL
Declare Function GetClipboardData Lib "user32" (uFormat As DWord) As HANDLE
Declare Function GetClipboardFormatName Lib "user32" Alias _FuncName_GetClipboardFormatName (uFormat As DWord, pszFormatName As PTSTR, cchMaxCount As Long) As BOOL
Declare Function GetClipboardOwner Lib "user32" () As HWND
Declare Function GetClipboardViewer Lib "user32" () As HWND
Declare Function GetClipCursor Lib "user32" (ByRef lpRect As RECT) As BOOL
Declare Function GetCursor Lib "user32" () As HCURSOR
Declare Function GetCursorPos Lib "user32" (ByRef lpPoint As POINTAPI) As BOOL
Declare Function GetDC Lib "user32" (hWnd As HWND) As HDC

Const DCX_WINDOW =           &H00000001
Const DCX_CACHE =            &H00000002
Const DCX_NORESETATTRS =     &H00000004
Const DCX_CLIPCHILDREN =     &H00000008
Const DCX_CLIPSIBLINGS =     &H00000010
Const DCX_PARENTCLIP =       &H00000020
Const DCX_EXCLUDERGN =       &H00000040
Const DCX_INTERSECTRGN =     &H00000080
Const DCX_EXCLUDEUPDATE =    &H00000100
Const DCX_INTERSECTUPDATE =  &H00000200
Const DCX_LOCKWINDOWUPDATE = &H00000400
Const DCX_VALIDATE =         &H00200000
Declare Function GetDCEx Lib "user32" (hWnd As HWND, hrgnClip As HRGN, dwFlags As DWord) As HDC

Declare Function GetDesktopWindow Lib "user32" () As HWND
Declare Function GetDialogBaseUnits Lib "user32" () As Long
Declare Function GetDlgCtrlID Lib "user32" (hWnd As HWND) As Long
Declare Function GetDlgItem Lib "user32" (hDlg As HWND, nIDDlgItem As Long) As HWND
Declare Function GetDlgItemInt Lib "user32" (hDlg As HWND, nIDDlgItem As Long, lpTranslated As *BOOL, bSigned As BOOL) As DWord
Declare Function GetDlgItemText Lib "user32" Alias _FuncName_GetDlgItemText (hDlg As HWND, nIDDlgItem As Long, pString As PTSTR, nMaxCount As Long) As Long
Declare Function GetDoubleClickTime Lib "user32" () As DWord
Declare Function GetFocus Lib "user32" () As HWND
Declare Function GetForegroundWindow Lib "user32" () As HWND
Declare Function GetIconInfo Lib "user32" (hIcon As HICON, ByRef pIconInfo As ICONINFO) As Long
Declare Function GetKeyboardState Lib "user32" (lpKeyState As *Byte) As BOOL
Declare Function GetKeyState Lib "user32" (nVirtKey As Long) As Integer
Declare Function GetListBoxInfo Lib "user32" (ByVal hwnd As HWND) As DWord
Declare Function GetMenu Lib "user32" (hWnd As HWND) As HMENU

Declare Function GetMenuContextHelpId Lib "user32" (hmenu As HMENU) As DWord
Const GMDI_USEDISABLED  = &H0001
Const GMDI_GOINTOPOPUPS = &H0002
Declare Function GetMenuDefaultItem Lib "user32" (hMenu As HMENU, fByPos As DWord, gmdiFlags As DWord) As DWord

Declare Function GetMenuItemID Lib "user32" (hMenu As HMENU, nPos As Long) As DWord
Declare Function GetMenuItemCount Lib "user32" (hMenu As HMENU) As Long
Declare Function GetMenuItemInfo Lib "user32" Alias _FuncName_GetMenuItemInfo (hMenu As HMENU, uItem As DWord, fByPosition As DWord, ByRef mii As MENUITEMINFO) As BOOL
Declare Function GetMessage Lib "user32" Alias _FuncName_GetMessage (ByRef Msg As MSG, hWnd As HWND, wMsgFilterMin As DWord, wMsgFilterMax As DWord) As Long
Const CCHDEVICENAME = 32
Type MONITORINFO
	cbSize As DWord
	rcMonitor As RECT
	rcWork As RECT
	dwFlags As DWord
End Type
Type MONITORINFOEXA
	cbSize As DWord
	rcMonitor As RECT
	rcWork As RECT
	dwFlags As DWord
	szDevice[ELM(CCHDEVICENAME)] As SByte
End Type
Type MONITORINFOEXW
	cbSize As DWord
	rcMonitor As RECT
	rcWork As RECT
	dwFlags As DWord
	szDevice[ELM(CCHDEVICENAME)] As WCHAR
End Type
Declare Function GetMonitorInfo Lib "user32.dll" Alias _FuncName_GetMonitorInfo (hMonitor As HMONITOR, ByRef mi As Any /*MONITORINFO*/) As BOOL
Declare Function GetNextDlgGroupItem Lib "user32" (hDlg As HWND, hCtl As HWND, bPrevious As BOOL) As HWND
Declare Function GetNextDlgTabItem Lib "user32" (hDlg As HWND, hCtl As HWND, bPrevious As BOOL) As HWND
Declare Function GetOpenClipboardWindow Lib "user32" () As HWND
Declare Function GetParent Lib "user32" (hWnd As HWND) As HWND
Declare Function GetPriorityClipboardFormat Lib "user32" (lpFormatList As *DWord, FormatNum As Long) As Long
Declare Function GetProp Lib "user32" Alias _FuncName_GetProp (hWnd As HWND, pString As PCTSTR) As HANDLE
Declare Function GetScrollInfo Lib "user32" (hWnd As HWND, fnBar As Long, ByRef lpsi As SCROLLINFO) As BOOL

Declare Function GetSubMenu Lib "user32" (hMenu As HMENU, nPos As Long) As HMENU

Const COLOR_SCROLLBAR =               0
Const COLOR_BACKGROUND =              1
Const COLOR_ACTIVECAPTION =           2
Const COLOR_INACTIVECAPTION =         3
Const COLOR_MENU =                    4
Const COLOR_WINDOW =                  5
Const COLOR_WINDOWFRAME =             6
Const COLOR_MENUTEXT =                7
Const COLOR_WINDOWTEXT =              8
Const COLOR_CAPTIONTEXT =             9
Const COLOR_ACTIVEBORDER =            10
Const COLOR_INACTIVEBORDER =          11
Const COLOR_APPWORKSPACE =            12
Const COLOR_HIGHLIGHT =               13
Const COLOR_HIGHLIGHTTEXT =           14
Const COLOR_BTNFACE =                 15
Const COLOR_BTNSHADOW =               16
Const COLOR_GRAYTEXT =                17
Const COLOR_BTNTEXT =                 18
Const COLOR_INACTIVECAPTIONTEXT =     19
Const COLOR_BTNHIGHLIGHT =            20
Const COLOR_3DDKSHADOW =              21
Const COLOR_3DLIGHT =                 22
Const COLOR_INFOTEXT =                23
Const COLOR_INFOBK =                  24
Const COLOR_HOTLIGHT =                26
Const COLOR_GRADIENTACTIVECAPTION =   27
Const COLOR_GRADIENTINACTIVECAPTION = 28
Const COLOR_DESKTOP =                 COLOR_BACKGROUND
Const COLOR_3DFACE =                  COLOR_BTNFACE
Const COLOR_3DSHADOW =                COLOR_BTNSHADOW
Const COLOR_3DHIGHLIGHT =             COLOR_BTNHIGHLIGHT
Const COLOR_3DHILIGHT =               COLOR_BTNHIGHLIGHT
Const COLOR_BTNHILIGHT =              COLOR_BTNHIGHLIGHT
Declare Function GetSysColor Lib "user32" (nIndex As Long) As DWord
Declare Function GetSysColorBrush Lib "user32" (nIndex As Long) As HBRUSH

Declare Function GetSystemMenu Lib "user32" (hWnd As HWND, bRevert As BOOL) As HMENU

Const SM_CXSCREEN =           0
Const SM_CYSCREEN =           1
Const SM_CXVSCROLL =          2
Const SM_CYHSCROLL =          3
Const SM_CYCAPTION =          4
Const SM_CXBORDER =           5
Const SM_CYBORDER =           6
Const SM_CXDLGFRAME =         7
Const SM_CYDLGFRAME =         8
Const SM_CYVTHUMB =           9
Const SM_CXHTHUMB =           10
Const SM_CXICON =             11
Const SM_CYICON =             12
Const SM_CXCURSOR =           13
Const SM_CYCURSOR =           14
Const SM_CYMENU =             15
Const SM_CXFULLSCREEN =       16
Const SM_CYFULLSCREEN =       17
Const SM_CYKANJIWINDOW =      18
Const SM_MOUSEPRESENT =       19
Const SM_CYVSCROLL =          20
Const SM_CXHSCROLL =          21
Const SM_DEBUG =              22
Const SM_SWAPBUTTON =         23
Const SM_RESERVED1 =          24
Const SM_RESERVED2 =          25
Const SM_RESERVED3 =          26
Const SM_RESERVED4 =          27
Const SM_CXMIN =              28
Const SM_CYMIN =              29
Const SM_CXSIZE =             30
Const SM_CYSIZE =             31
Const SM_CXFRAME =            32
Const SM_CYFRAME =            33
Const SM_CXMINTRACK =         34
Const SM_CYMINTRACK =         35
Const SM_CXDOUBLECLK =        36
Const SM_CYDOUBLECLK =        37
Const SM_CXICONSPACING =      38
Const SM_CYICONSPACING =      39
Const SM_MENUDROPALIGNMENT =  40
Const SM_PENWINDOWS =         41
Const SM_DBCSENABLED =        42
Const SM_CMOUSEBUTTONS =      43
Const SM_CXFIXEDFRAME =       SM_CXDLGFRAME
Const SM_CYFIXEDFRAME =       SM_CYDLGFRAME
Const SM_CXSIZEFRAME =        SM_CXFRAME
Const SM_CYSIZEFRAME =        SM_CYFRAME
Const SM_SECURE =             44
Const SM_CXEDGE =             45
Const SM_CYEDGE =             46
Const SM_CXMINSPACING =       47
Const SM_CYMINSPACING =       48
Const SM_CXSMICON =           49
Const SM_CYSMICON =           50
Const SM_CYSMCAPTION =        51
Const SM_CXSMSIZE =           52
Const SM_CYSMSIZE =           53
Const SM_CXMENUSIZE =         54
Const SM_CYMENUSIZE =         55
Const SM_ARRANGE =            56
Const SM_CXMINIMIZED =        57
Const SM_CYMINIMIZED =        58
Const SM_CXMAXTRACK =         59
Const SM_CYMAXTRACK =         60
Const SM_CXMAXIMIZED =        61
Const SM_CYMAXIMIZED =        62
Const SM_NETWORK =            63
Const SM_CLEANBOOT =          67
Const SM_CXDRAG =             68
Const SM_CYDRAG =             69
Const SM_SHOWSOUNDS =         70
Const SM_CXMENUCHECK =        71
Const SM_CYMENUCHECK =        72
Const SM_SLOWMACHINE =        73
Const SM_MIDEASTENABLED =     74
Const SM_MOUSEWHEELPRESENT =  75
Declare Function GetSystemMetrics Lib "user32" (nIndex As Long) As Long

Declare Function GetUpdateRect Lib "user32" (hWnd As HWND, ByRef lpRect As RECT, bErase As BOOL) As BOOL
Declare Function GetUpdateRgn Lib "user32" (hWnd As HWND, hRgn As HRGN, bErase As BOOL) As BOOL

Const GW_HWNDFIRST =      0
Const GW_HWNDLAST =       1
Const GW_HWNDNEXT =       2
Const GW_HWNDPREV =       3
Const GW_OWNER =          4
Const GW_CHILD =          5
Declare Function GetWindow Lib "user32" (hWnd As HWND, uCmd As DWord) As HWND

Declare Function GetTopWindow Lib "user32" (ByVal hWnd As HWND) As HWND

Function GetNextWindow(ByVal hWnd As HWND, ByVal wCmd As DWord) As HWND
	Return GetWindow(hWnd, wCmd) As HWND
End Function
Function GetSysModalWindow() As HWND
	Return (NULL) As HWND
End Function
Function SetSysModalWindow(ByVal hWnd As HWND) As HWND
	Return (NULL) As HWND
End Function

Function GetWindowTask(hWnd As HWND) As HANDLE
	Return GetWindowThreadProcessId(hWnd, NULL) As HANDLE
End Function

Declare Function GetLastActivePopup Lib "user32" (ByVal hWnd As HWND) As HWND


Declare Function GetWindowContextHelpId Lib "user32" (hwnd As HWND) As DWord

Declare Function GetWindowDC Lib "user32" (hWnd As HWND) As HDC

#ifndef _WIN64
Const GWL_WNDPROC =       -4
Const GWL_HINSTANCE =     -6
Const GWL_HWNDPARENT =    -8
Const GWL_USERDATA =      -21
Const GWL_ID =            -12
Const DWL_MSGRESULT = 0
Const DWL_DLGPROC = 4
Const DWL_USER = 8
#endif

Const GWL_STYLE =         -16
Const GWL_EXSTYLE =       -20

Const GWLP_WNDPROC =      -4
Const GWLP_HINSTANCE =    -6
Const GWLP_HWNDPARENT =   -8
Const GWLP_USERDATA =     -21
Const GWLP_ID =           -12


Const DWLP_MSGRESULT = 0
Const DWLP_DLGPROC = DWLP_MSGRESULT + SizeOf(LRESULT)
Const DWLP_USER = DWLP_DLGPROC + SizeOf(DLGPROC)

#ifdef _WIN64
Declare Function GetWindowLong Lib "user32" Alias _FuncName_GetWindowLongPtr (hWnd As HWND, nIndex As Long) As LONG_PTR
Declare Function GetWindowLongPtr Lib "user32" Alias _FuncName_GetWindowLongPtr (hWnd As HWND, nIndex As Long) As LONG_PTR
#else
Declare Function GetWindowLong Lib "user32" Alias _FuncName_GetWindowLong (hWnd As HWND, nIndex As Long) As LONG_PTR
Declare Function GetWindowLongPtr Lib "user32" Alias _FuncName_GetWindowLong (hWnd As HWND, nIndex As Long) As LONG_PTR
#endif
Declare Function GetWindowModuleFileName Lib "user32" Alias _FuncName_GetWindowModuleFileName (hwnd As HWND, pszFileName As LPTSTR, cchFileNameMax As DWord) As DWord

Const WPF_SETMINPOSITION =     &H0001
Const WPF_RESTORETOMAXIMIZED = &H0002
Type WINDOWPLACEMENT
	length As DWord
	flags As DWord
	showCmd As DWord
	ptMinPosition As POINTAPI
	ptMaxPosition As POINTAPI
	rcNormalPosition As RECT
End Type
Declare Function GetWindowPlacement Lib "user32" (hWnd As HWND, ByRef lpwndpl As WINDOWPLACEMENT) As BOOL

Declare Function GetWindowRect Lib "user32" (hWnd As HWND, ByRef lpRect As RECT) As BOOL

Declare Function GetWindowRgn Lib "user32" (hWnd As HWND, hRgn As HRGN) As Long
Declare Function ExcludeUpdateRgn Lib "user32" (ByVal hDC As HDC, ByVal hWnd As HWND) As Long

Declare Function GetWindowText Lib "user32" Alias _FuncName_GetWindowText (hWnd As HWND, lpString As PTSTR, nMaxCount As Long) As Long
Declare Function GetWindowTextLength Lib "user32" Alias _FuncName_GetWindowTextLength (hWnd As HWND) As Long
Declare Function GetWindowThreadProcessId Lib "user32" (hWnd As HWND, pdwProcessId As *DWord) As DWord
Declare Function HideCaret Lib "user32" (hWnd As HWND) As BOOL
Declare Function InsertMenuItem Lib "user32" Alias _FuncName_InsertMenuItem (hMenu As HMENU, uItem As DWord, fByPosition As BOOL, ByRef mii As MENUITEMINFO) As BOOL
Declare Function InvalidateRect Lib "user32" (hWnd As HWND, ByRef Rect As RECT, bErase As BOOL) As BOOL
Declare Function InvalidateRgn Lib "user32" (hWnd As HWND, hRgn As HRGN, bErase As BOOL) As BOOL
Declare Function InvertRect Lib "user32" (hdc As HDC, ByRef lpRect As RECT) As BOOL
Declare Function IsCharAlpha Lib "user32" Alias _FuncName_IsCharAlpha (ch As TCHAR) As BOOL
Declare Function IsCharAlphaNumeric Lib "user32" Alias _FuncName_IsCharAlphaNumeric (ch As TCHAR) As BOOL
Declare Function IsCharLower Lib "user32" Alias _FuncName_IsCharLower (ch As TCHAR) As BOOL
Declare Function IsCharUpper Lib "user32" Alias _FuncName_IsCharUpper (ch As TCHAR) As BOOL
Declare Function IsChild Lib "user32" (hWndParent As HWND, hWnd As HWND) As BOOL
Declare Function IsClipboardFormatAvailable Lib "user32" (ByVal wFormat As DWord) As BOOL
Declare Function IsDialogMessage Lib "user32" Alias _FuncName_IsDialogMessage (hDlg As HWND, ByRef msg As MSG) As BOOL
Declare Function IsDlgButtonChecked Lib "user32" (hDlg As HWND, nIDButton As Long) As DWord
Declare Function IsIconic Lib "user32" (hWnd As HWND) As BOOL
Declare Function IsWindow Lib "user32" (hWnd As HWND) As BOOL
Declare Function IsWindowEnabled Lib "user32" (hWnd As HWND) As BOOL
Declare Function IsWindowUnicode Lib "user32" (hWnd As HWND) As BOOL
Declare Function IsWindowVisible Lib "user32" (hWnd As HWND) As BOOL
Declare Function IsZoomed Lib "user32" (hWnd As HWND) As BOOL

Const KEYEVENTF_EXTENDEDKEY = &H0001
Const KEYEVENTF_KEYUP       = &H0002
Declare Sub keybd_event Lib "user32" (bVk As Byte, bScan As Byte, dwFlags As DWord, dwExtraInfo As DWord)

Declare Function KillTimer Lib "user32" (hWnd As HWND, nIDEvent As ULONG_PTR) As BOOL
Declare Function LoadBitmap Lib "user32" Alias _FuncName_LoadBitmap (hInst As HINSTANCE, pBitmapName As PCTSTR) As HBITMAP

Const IDC_ARROW =         32512
Const IDC_IBEAM =         32513
Const IDC_WAIT =          32514
Const IDC_CROSS =         32515
Const IDC_UPARROW =       32516
Const IDC_SIZE =          32640
Const IDC_ICON =          32641
Const IDC_SIZENWSE =      32642
Const IDC_SIZENESW =      32643
Const IDC_SIZEWE =        32644
Const IDC_SIZENS =        32645
Const IDC_SIZEALL =       32646
Const IDC_NO =            32648
Const IDC_HAND =          32649
Const IDC_APPSTARTING =   32650
Const IDC_HELP =          32651
Declare Function LoadCursor Lib "user32" Alias _FuncName_LoadCursor (hInst As HINSTANCE, pCursorName As PCTSTR) As HCURSOR

Declare Function LoadCursorFromFile Lib "user32" Alias _FuncName_LoadCursorFromFile (pFileName As PCTSTR) As HCURSOR

Const IDI_APPLICATION =   32512
Const IDI_HAND =          32513
Const IDI_QUESTION =      32514
Const IDI_EXCLAMATION =   32515
Const IDI_ASTERISK =      32516
Const IDI_WINLOGO =       32517
Declare Function LoadIcon Lib "user32" Alias _FuncName_LoadIcon (hInst As HINSTANCE, pIconName As PCTSTR) As HICON

Const IMAGE_BITMAP =      0
Const IMAGE_ICON =        1
Const IMAGE_CURSOR =      2
Const IMAGE_ENHMETAFILE = 3
Const LR_DEFAULTCOLOR =     &H0000
Const LR_MONOCHROME =       &H0001
Const LR_COLOR =            &H0002
Const LR_COPYRETURNORG =    &H0004
Const LR_COPYDELETEORG =    &H0008
Const LR_LOADFROMFILE =     &H0010
Const LR_LOADTRANSPARENT =  &H0020
Const LR_DEFAULTSIZE =      &H0040
Const LR_VGACOLOR =         &H0080
Const LR_LOADMAP3DCOLORS =  &H1000
Const LR_CREATEDIBSECTION = &H2000
Const LR_COPYFROMRESOURCE = &H4000
Const LR_SHARED =           &H8000
Declare Function LoadImage Lib "user32" Alias _FuncName_LoadImage (hinst As HINSTANCE, pszName As PCTSTR, dwImageType As DWord, cxDesired As Long, cyDesired As Long, dwFlags As DWord) As HANDLE
Declare Function LoadString Lib "user32" Alias _FuncName_LoadString (hInstance As HINSTANCE, uID As DWord, lpBuffer As LPTSTR, nBufferMax As Long) As Long
Declare Function LockWindowUpdate Lib "user32" (hWnd As HWND) As BOOL
Declare Function MapVirtualKey Lib "user32" Alias _FuncName_MapVirtualKey (wCode As DWord, wMapType As DWord) As DWord
Declare Function MapWindowPoints Lib "user32" (
	hWndFrom As HWND,
	hWndTo As HWND,
	pPoints As *POINTAPI,
	cPoints As DWord) As Long
Declare Function MessageBeep Lib "user32" (uType As DWord) As BOOL

Const MB_OK =                     &H00000000
Const MB_OKCANCEL =               &H00000001
Const MB_ABORTRETRYIGNORE =       &H00000002
Const MB_YESNOCANCEL =            &H00000003
Const MB_YESNO =                  &H00000004
Const MB_RETRYCANCEL =            &H00000005
Const MB_CANCELTRYCONTINUE =      &H00000006
Const MB_ICONHAND =               &H00000010
Const MB_ICONQUESTION =           &H00000020
Const MB_ICONEXCLAMATION =        &H00000030
Const MB_ICONASTERISK =           &H00000040
Const MB_USERICON =               &H00000080
Const MB_ICONWARNING =            MB_ICONEXCLAMATION
Const MB_ICONERROR =              MB_ICONHAND
Const MB_ICONINFORMATION =        MB_ICONASTERISK
Const MB_ICONSTOP =               MB_ICONHAND
Const MB_DEFBUTTON1 =             &H00000000
Const MB_DEFBUTTON2 =             &H00000100
Const MB_DEFBUTTON3 =             &H00000200
Const MB_DEFBUTTON4 =             &H00000300
Const MB_APPLMODAL =              &H00000000
Const MB_SYSTEMMODAL =            &H00001000
Const MB_TASKMODAL =              &H00002000
Const MB_HELP =                   &H00004000
Const MB_NOFOCUS =                &H00008000
Const MB_SETFOREGROUND =          &H00010000
Const MB_DEFAULT_DESKTOP_ONLY =   &H00020000
Const MB_TOPMOST =                &H00040000
Const MB_RIGHT =                  &H00080000
Const MB_RTLREADING =             &H00100000
Const MB_SERVICE_NOTIFICATION =   &H00200000

Const MB_TYPEMASK = &h0000000F
Const MB_ICONMASK = &h000000F0
Const MB_DEFMASK  = &h00000F00
Const MB_MODEMASK = &h00003000
Const MB_MISCMASK = &h0000C000
#ifdef UNICODE
Declare Function MessageBox Lib "user32" Alias "MessageBoxW" (hwnd As HWND, pText As PCWSTR, pCaption As PCWSTR, uType As DWord) As Long
#else
Declare Function MessageBox Lib "user32" Alias "MessageBoxA" (hwnd As HWND, pText As PCSTR, pCaption As PCSTR, uType As DWord) As Long
#endif
Declare Function MessageBoxW Lib "user32" (hWnd As HWND, pText As PCWSTR, pCaption As PCWSTR, uType As DWord) As Long
Declare Function MessageBoxA Lib "user32" (hWnd As HWND, pText As PCSTR, pCaption As PCSTR, uType As DWord) As Long
Const MOUSEEVENTF_MOVE =       &H0001
Const MOUSEEVENTF_LEFTDOWN =   &H0002
Const MOUSEEVENTF_LEFTUP =     &H0004
Const MOUSEEVENTF_RIGHTDOWN =  &H0008
Const MOUSEEVENTF_RIGHTUP =    &H0010
Const MOUSEEVENTF_MIDDLEDOWN = &H0020
Const MOUSEEVENTF_MIDDLEUP =   &H0040
Const MOUSEEVENTF_WHEEL =      &H0800
Const MOUSEEVENTF_ABSOLUTE =   &H8000
Declare Sub mouse_event Lib "user32" (dwFlags As DWord, dx As DWord, dy As DWord, dwData As DWord, dwExtraInfo As DWord)

Declare Function MoveWindow Lib "user32" (hWnd As HWND, x As Long, y As Long, nWidth As Long, nHight As Long, bRepaint As BOOL) As BOOL
Declare Function OpenClipboard Lib "user32" (hWndNewOwner As HWND) As BOOL
Declare Function OpenIcon Lib "user32" (hWnd As HWND) As BOOL

Const PM_NOREMOVE = &H0000
Const PM_REMOVE =   &H0001
Declare Function PeekMessage Lib "user32" Alias _FuncName_PeekMessage (ByRef Msg As MSG, hWnd As HWND, wMsgFilterMin As DWord, wMsgFilterMax As DWord, wRemoveMsg As DWord) As BOOL

Const HWND_BROADCAST = &HFFFF
Declare Function PostMessage Lib "user32" Alias _FuncName_PostMessage (hWnd As HWND, wMsg As DWord, wParam As WPARAM, lParam As LPARAM) As BOOL

Declare Sub PostQuitMessage Lib "user32" (nExitCode As Long)
Declare Function PostThreadMessage Lib "user32" Alias _FuncName_PostThreadMessage (idThread As DWord, Msg As DWord, wParam As WPARAM, lParam As LPARAM) As BOOL
Declare Function RealChildWindowFromPoint Lib "user32" (hwndParent As HWND, xPoint As Long, yPoint As Long) As HWND

Const RDW_INVALIDATE =        &H0001
Const RDW_INTERNALPAINT =     &H0002
Const RDW_ERASE =             &H0004
Const RDW_VALIDATE =          &H0008
Const RDW_NOINTERNALPAINT =   &H0010
Const RDW_NOERASE =           &H0020
Const RDW_NOCHILDREN =        &H0040
Const RDW_ALLCHILDREN =       &H0080
Const RDW_UPDATENOW =         &H0100
Const RDW_ERASENOW =          &H0200
Const RDW_FRAME =             &H0400
Const RDW_NOFRAME =           &H0800
Declare Function RedrawWindow Lib "user32" (hWnd As HWND, ByRef lprcUpdate As RECT, hrgnUpdate As HRGN, flags As DWord) As BOOL

Declare Function RegisterClassEx Lib "user32" Alias _FuncName_RegisterClassEx (ByRef wcx As WNDCLASSEX) As ATOM
Declare Function RegisterClipboardFormat Lib "user32" Alias _FuncName_RegisterClipboardFormat (pszFormat As PCTSTR) As DWord
Declare Function RegisterHotKey lib "user32.dll" (hwnd As HWND, id As Long, dwModufuers As DWord, vk As DWord) As BOOL
Declare Function RegisterWindowMessage Lib "user32" Alias _FuncName_RegisterWindowMessage (pString As PCTSTR) As DWord
Declare Function ReleaseCapture Lib "user32" () As BOOL
Declare Function ReleaseDC Lib "user32" (hWnd As HWND, hdc As HDC) As BOOL
Declare Function RemoveMenu Lib "user32" (hMenu As HMENU, uPosition As DWord, uFlags As DWord) As BOOL
Declare Function RemoveProp Lib "user32" Alias _FuncName_RemoveProp (hWnd As HWND, pString As PCTSTR) As HANDLE
Declare Function TranslateAccelerator Lib "user32" Alias _FuncName_TranslateAccelerator (hwnd As HWND, hAccTable As HACCEL, ByRef msg As MSG) As Long
Declare Function TranslateMessage Lib "user32" (ByRef msg As MSG) As Long
Declare Function ScreenToClient Lib "user32" (hWnd As HWND, ByRef Point As POINTAPI) As BOOL
Declare Function ScrollDC Lib "user32" (hdc As HDC, dx As Long, dy As Long, ByRef rcScroll As RECT, ByRef rcClip As RECT, hrgnUpdate As HRGN, ByRef rcUpdate As RECT) As BOOL

Declare Function SetScrollPos Lib "user32" (ByVal hWnd As HWND, ByVal nBar As Long, ByVal nPos As Long, ByVal bRedraw As BOOL) As Long
Declare Function GetScrollPos Lib "user32" (ByVal hWnd As HWND, ByVal nBar As Long) As Long
Declare Function SetScrollRange Lib "user32" (ByVal hWnd As HWND, ByVal nBar As Long, ByVal nMinPos As Long, ByVal nMaxPos As Long, ByVal bRedraw As BOOL) As BOOL
Declare Function GetScrollRange Lib "user32" (ByVal hWnd As HWND, ByVal nBar As Long, ByRef lpMinPos As Long, ByRef lpMaxPos As Long) As BOOL

Const SW_SCROLLCHILDREN = &H0001
Const SW_INVALIDATE =     &H0002
Const SW_ERASE =          &H0004
Declare Function ScrollWindowEx Lib "user32" (hWnd As HWND, dx As Long, dy As Long, ByRef rcScroll As RECT, ByRef rcClip As RECT, hrgnUpdate As HRGN, ByRef rcUpdate As RECT, flags As DWord) As BOOL

Declare Function SendDlgItemMessage Lib "user32" Alias _FuncName_SendDlgItemMessage (hDlg As HWND, nIDDlgItem As Long, Msg As DWord, wParam As WPARAM, lParam As LPARAM) As LRESULT
Declare Function SendMessage Lib "user32" Alias _FuncName_SendMessage (hWnd As HWND, wMsg As DWord, wParam As WPARAM, lParam As LPARAM) As LRESULT

TypeDef SENDASYNCPROC = *Sub(hwnd As HWND, uMsg As DWord, dwData As ULONG_PTR, lResult As LRESULT)
Declare Function SendMessageCallback Lib "user32" Alias _FuncName_SendMessageCallback (hWnd As HWND, Msg As DWord, wParam As WPARAM, lParam As LPARAM, lpResultCallBack As SENDASYNCPROC, dwData As ULONG_PTR) As BOOL
Const SMTO_NORMAL = &h0000
Const SMTO_BLOCK = &h0001
Const SMTO_ABORTIFHUNG = &h0002
'#if WINVER >= &h0500
'Const SMTO_NOTIMEOUTIFNOTHUNG = &h0008
'#endif
'#if WINVER >= &h0600
'Const SMTO_ERRORONEXIT = &h0020
'#endif
Declare Function SendMessageTimeout Lib "user32" Alias _FuncName_SendMessageTimeout (hWnd As HWND, Msg As DWord, wParam As WPARAM, lParam As LPARAM, fuFlags As DWord, uTimeout As DWord, ByRef dwResult As ULONG_PTR) As LRESULT
Declare Function SendNotifyMessage Lib "user32" Alias _FuncName_SendNotifyMessage (hWnd As HWND, wMsg As DWord, wParam As WPARAM, lParam As LPARAM) As LRESULT
Declare Function SetActiveWindow Lib "user32" (hWnd As HWND) As HWND
Declare Function SetDlgItemInt Lib "user32" (hDlg As HWND, nIDDlgItem As Long, uValue As DWord, bSigned As BOOL) As BOOL
Declare Function SetDlgItemText Lib "user32" Alias _FuncName_SetDlgItemText (hDlg As HWND, nIDDlgItem As Long, lpString As PCTSTR) As BOOL
Declare Function SetCapture Lib "user32" (hWnd As HWND) As HWND
Declare Function SetCaretPos Lib "user32" (x As Long, y As Long) As BOOL

#ifdef _WIN64
Declare Function SetClassLong Lib "user32" Alias _FuncName_SetClassLongPtr (hWnd As HWND, nIndex As Long, NewLong As LONG_PTR) As LONG_PTR
Declare Function SetClassLongPtr Lib "user32" Alias _FuncName_SetClassLongPtr (hWnd As HWND, nIndex As Long, NewLong As LONG_PTR) As LONG_PTR
#else
Declare Function SetClassLong Lib "user32" Alias _FuncName_SetClassLong (hWnd As HWND, nIndex As Long, NewLong As LONG_PTR) As LONG_PTR
Declare Function SetClassLongPtr Lib "user32" Alias _FuncName_SetClassLong (hWnd As HWND, nIndex As Long, NewLong As LONG_PTR) As LONG_PTR
#endif

Declare Function SetClipboardData Lib "user32" (uFormat As DWord, hMem As HANDLE) As HANDLE
Declare Function SetClipboardViewer Lib "user32" (ByVal hWndNewViewer As HWND) As HWND
Declare Function SetCursor Lib "user32" (hCursor As HCURSOR) As HCURSOR
Declare Function SetCursorPos Lib "user32" (x As Long, y As Long) As BOOL
Declare Function SetDoubleClickTime Lib "user32" (uInterval As DWord) As BOOL
Declare Function SetFocus Lib "user32" (hWnd As HWND) As HWND
Declare Function SetForegroundWindow Lib "user32" (hWnd As HWND) As BOOL
Declare Function SetKeyboardState Lib "user32" (lpKeyState As *Byte) As BOOL

Declare Function GetKeyNameTextA Lib "user32" (ByVal lParam As Long, ByVal lpString As LPSTR, ByVal cchSize As Long) As Long
Declare Function GetKeyNameTextW Lib "user32" (ByVal lParam As Long, ByVal lpString As LPWSTR, ByVal cchSize As Long) As Long
#ifdef UNICODE
Declare Function GetKeyNameText Lib "user32" Alias "GetKeyNameTextW" (ByVal lParam As Long, ByVal lpString As LPWSTR, ByVal cchSize As Long) As Long
#else
Declare Function GetKeyNameText Lib "user32" Alias "GetKeyNameTextA" (ByVal lParam As Long, ByVal lpString As LPSTR, ByVal cchSize As Long) As Long
#endif ' !UNICODE
Declare Function GetKeyboardType Lib "user32" (ByVal nTypeFlag As Long) As Long

Declare Function ToAscii Lib "user32" (ByVal uVirtKey As DWord, ByVal uScanCode As DWord, ByVal lpKeyState As *Byte, ByVal lpChar As *WORD, ByVal uFlags As DWord) As Long
Declare Function ToAsciiEx Lib "user32" (ByVal uVirtKey As DWord, ByVal uScanCode As DWord, ByVal lpKeyState As *Byte, ByVal lpChar As *WORD, ByVal uFlags As DWord, ByVal dwhkl As HKL) As Long

Declare Function ToUnicode Lib "user32" (ByVal uVirtKey As DWord, ByVal uScanCode As DWord, ByVal lpKeyState As *Byte, ByVal pwszBuff As LPWSTR, ByVal cchBuff As Long, ByVal wFlags As DWord) As Long

Declare Function OemKeyScan Lib "user32" (ByVal wOemChar As Word) As DWord

Declare Function VkKeyScanA Lib "user32" (ByVal ch As SByte) As Integer
Declare Function VkKeyScanW Lib "user32" (ByVal ch As Word) As Integer
#ifdef UNICODE
Declare Function VkKeyScan Lib "user32" Alias "VkKeyScanW" (ByVal ch As Word) As Integer
#else
Declare Function VkKeyScan Lib "user32" Alias "VkKeyScanA" (ByVal ch As SByte) As Integer
#endif ' !UNICODE

Declare Function VkKeyScanExA Lib "user32" (ByVal ch As SByte, ByVal dwhkl As HKL) As Integer
Declare Function VkKeyScanExW Lib "user32" (ByVal ch As Word, ByVal dwhkl As HKL) As Integer
#ifdef UNICODE
Declare Function VkKeyScanEx Lib "user32" Alias "VkKeyScanW" (ByVal ch As Word, ByVal dwhkl As HKL) As Integer
#else
Declare Function VkKeyScanEx Lib "user32" Alias "VkKeyScanA" (ByVal ch As SByte, ByVal dwhkl As HKL) As Integer
#endif ' !UNICODE

Type MOUSEINPUT
	dx As Long
	dy As Long
	mouseData As DWord
	dwFlags As DWord
	time As DWord
	dwExtraInfo As ULONG_PTR
End Type
TypeDef PMOUSEINPUT = *MOUSEINPUT
TypeDef LPMOUSEINPUT = *MOUSEINPUT

Type KEYBDINPUT
	wVk As Word
	wScan As Word
	dwFlags As DWord
	time As DWord
	dwExtraInfo As ULONG_PTR
End Type
TypeDef PKEYBDINPUT = *KEYBDINPUT
TypeDef LPKEYBDINPUT = *KEYBDINPUT

Type HARDWAREINPUT
	uMsg As DWord
	wParamL As Word
	wParamH As Word
End Type
TypeDef PHARDWAREINPUT = *HARDWAREINPUT
TypeDef LPHARDWAREINPUT = *HARDWAREINPUT

Const INPUT_MOUSE = 0
Const INPUT_KEYBOARD = 1
Const INPUT_HARDWARE = 2

Type INPUT
	types As DWord
#ifdef _WIN64
	union[6] As DWord
#else
	union[5] As DWord
#endif
/*	Union
		mi As MOUSEINPUT
		ki As KEYBDINPUT
		hi As HARDWAREINPUT
	End Union*/
End Type
TypeDef PINPUT = *INPUT
TypeDef LPINPUT = *INPUT

Declare Function SendInput Lib "user32" (ByVal cInputs As DWord, ByVal pInputs As *INPUT, ByVal cbSize As Long) As DWord

Declare Function MapVirtualKeyA Lib "user32" (ByVal uCode As DWord, ByVal uMapType As DWord) As DWord
Declare Function MapVirtualKeyW Lib "user32" (ByVal uCode As DWord, ByVal uMapType As DWord) As DWord
#ifdef UNICODE
Declare Function MapVirtualKey Lib "user32" Alias "MapVirtualKeyW" (ByVal uCode As DWord, ByVal uMapType As DWord) As DWord
#else
Declare Function MapVirtualKey Lib "user32" Alias "MapVirtualKeyA" (ByVal uCode As DWord, ByVal uMapType As DWord) As DWord
#endif ' !UNICODE

Declare Function MapVirtualKeyExA Lib "user32" (ByVal uCode As DWord, ByVal uMapType As DWord, ByVal dwhkl As HKL) As DWord
Declare Function MapVirtualKeyExW Lib "user32" (ByVal uCode As DWord, ByVal uMapType As DWord, ByVal dwhkl As HKL) As DWord
#ifdef UNICODE
Declare Function MapVirtualKeyEx Lib "user32" Alias "MapVirtualKeyExW" (ByVal uCode As DWord, ByVal uMapType As DWord, ByVal dwhkl As HKL) As DWord
#else
Declare Function MapVirtualKeyEx Lib "user32" Alias "MapVirtualKeyExA" (ByVal uCode As DWord, ByVal uMapType As DWord, ByVal dwhkl As HKL) As DWord
#endif ' !UNICODE

Declare Function GetInputState Lib "user32" () As BOOL
Declare Function GetQueueStatus Lib "user32" (ByVal flags As DWord) As DWord

Const QS_KEY = &H0001
Const QS_MOUSEMOVE = &H0002
Const QS_MOUSEBUTTON = &H0004
Const QS_POSTMESSAGE = &H0008
Const QS_TIMER = &H0010
Const QS_PAINT = &H0020
Const QS_SENDMESSAGE = &H0040
Const QS_HOTKEY = &H0080
Const QS_ALLPOSTMESSAGE = &H0100
'Const QS_RAWINPUT = &H0400

Const QS_MOUSE = (QS_MOUSEMOVE or QS_MOUSEBUTTON)
Const QS_INPUT = (QS_MOUSE or QS_KEY /* or QS_RAWINPUT*/)
Const QS_ALLEVENTS = (QS_INPUT or QS_POSTMESSAGE or QS_TIMER or QS_PAINT or QS_HOTKEY)
Const QS_ALLINPUT = (QS_INPUT or QS_POSTMESSAGE or QS_TIMER or QS_PAINT or QS_HOTKEY or QS_SENDMESSAGE)

Declare Function MsgWaitForMultipleObjects Lib "user32" (ByVal nCount As DWord, ByVal pHandles As *HANDLE, ByVal fWaitAll As BOOL, ByVal dwMilliseconds As DWord, ByVal dwWakeMask As DWord) As DWord
Declare Function MsgWaitForMultipleObjectsEx Lib "user32" (ByVal nCount As DWord, ByVal pHandles As *HANDLE, ByVal dwMilliseconds As DWord, ByVal dwWakeMask As DWord, ByVal dwFlags As DWord) As DWord

Const MWMO_WAITALL = &H0001
Const MWMO_ALERTABLE = &H0002
Const MWMO_INPUTAVAILABLE = &H0004


Declare Function SetMenu Lib "user32" (hWnd As HWND, hMenu As HMENU) As BOOL

Declare Function ChangeMenuA Lib "user32" (ByVal hMenu As HMENU, ByVal cmd As DWord, ByVal lpszNewItem As LPCSTR, ByVal cmdInsert As DWord, ByVal flags As DWord) As BOOL
Declare Function ChangeMenuW Lib "user32" (ByVal hMenu As HMENU, ByVal cmd As DWord, ByVal lpszNewItem As LPCWSTR, ByVal cmdInsert As DWord, ByVal flags As DWord) As BOOL
#ifdef UNICODE
Declare Function ChangeMenu Lib "user32" Alias "ChangeMenuW" (ByVal hMenu As HMENU, ByVal cmd As DWord, ByVal lpszNewItem As LPCWSTR, ByVal cmdInsert As DWord, ByVal flags As DWord) As BOOL
#else
Declare Function ChangeMenu Lib "user32" Alias "ChangeMenuA" (ByVal hMenu As HMENU, ByVal cmd As DWord, ByVal lpszNewItem As LPCSTR, ByVal cmdInsert As DWord, ByVal flags As DWord) As BOOL
#endif ' !UNICODE

Declare Function HiliteMenuItem Lib "user32" (ByVal hWnd As HWND, ByVal hMenu As HMENU, ByVal uIDHiliteItem As DWord, ByVal uHilite As DWord) As BOOL

Declare Function GetMenuStringA Lib "user32" (ByVal hMenu As HMENU, ByVal uIDItem As DWord, ByVal lpString As LPSTR, ByVal cchMax As Long, ByVal flags As DWord) As Long
Declare Function GetMenuStringW Lib "user32" (ByVal hMenu As HMENU, ByVal uIDItem As DWord, ByVal lpString As LPWSTR, ByVal cchMax As Long, ByVal flags As DWord) As Long
#ifdef UNICODE
Declare Function GetMenuString Lib "user32" Alias "GetMenuStringW" (ByVal hMenu As HMENU, ByVal uIDItem As DWord, ByVal lpString As LPWSTR, ByVal cchMax As Long, ByVal flags As DWord) As Long
#else
Declare Function GetMenuString Lib "user32" Alias "GetMenuStringA" (ByVal hMenu As HMENU, ByVal uIDItem As DWord, ByVal lpString As LPSTR, ByVal cchMax As Long, ByVal flags As DWord) As Long
#endif ' !UNICODE

Declare Function GetMenuState Lib "user32" (ByVal hMenu As HMENU, ByVal uId As DWord, ByVal uFlags As DWord) As DWord

Declare Function AppendMenuA Lib "user32" (ByVal hMenu As HMENU, ByVal uFlags As DWord, ByVal uIDNewItem As ULONG_PTR, ByVal lpNewItem As LPCSTR) As BOOL
Declare Function AppendMenuW Lib "user32" (ByVal hMenu As HMENU, ByVal uFlags As DWord, ByVal uIDNewItem As ULONG_PTR, ByVal lpNewItem As LPCWSTR) As BOOL
#ifdef UNICODE
Declare Function AppendMenu Lib "user32" Alias "AppendMenuW" (ByVal hMenu As HMENU, ByVal uFlags As DWord, ByVal uIDNewItem As ULONG_PTR, ByVal lpNewItem As LPCWSTR) As BOOL
#else
Declare Function AppendMenu Lib "user32" Alias "AppendMenuA" (ByVal hMenu As HMENU, ByVal uFlags As DWord, ByVal uIDNewItem As ULONG_PTR, ByVal lpNewItem As LPCSTR) As BOOL
#endif ' !UNICODE

Declare Function ModifyMenuA Lib "user32" (ByVal hMnu As HMENU, ByVal uPosition As DWord, ByVal uFlags As DWord, ByVal uIDNewItem As ULONG_PTR, ByVal lpNewItem As LPCSTR) As BOOL
Declare Function ModifyMenuW Lib "user32" (ByVal hMnu As HMENU, ByVal uPosition As DWord, ByVal uFlags As DWord, ByVal uIDNewItem As ULONG_PTR, ByVal lpNewItem As LPCWSTR) As BOOL
#ifdef UNICODE
Declare Function ModifyMenu Lib "user32" Alias "ModifyMenuW" (ByVal hMnu As HMENU, ByVal uPosition As DWord, ByVal uFlags As DWord, ByVal uIDNewItem As ULONG_PTR, ByVal lpNewItem As LPCWSTR) As BOOL
#else
Declare Function ModifyMenu Lib "user32" Alias "ModifyMenuA" (ByVal hMnu As HMENU, ByVal uPosition As DWord, ByVal uFlags As DWord, ByVal uIDNewItem As ULONG_PTR, ByVal lpNewItem As LPCSTR) As BOOL
#endif ' !UNICODE

Declare Function SetMenuItemBitmaps Lib "user32" (ByVal hMenu As HMENU, ByVal uPosition As DWord, ByVal uFlags As DWord, ByVal hBitmapUnchecked As HBITMAP, ByVal hBitmapChecked As HBITMAP) As BOOL

Declare Function GetMenuCheckMarkDimensions Lib "user32" () As Long

Type TPMPARAMS
	cbSize As DWord
	rcExclude As RECT
End Type
TypeDef LPTPMPARAMS = *TPMPARAMS

Declare Function TrackPopupMenuEx Lib "user32" (ByVal hMenu As HMENU, ByVal fuFlags As DWord, ByVal x As Long, ByVal y As Long, ByVal hwnd As HWND, ByVal lptpm As *TPMPARAMS) As BOOL
Declare Function GetMenuItemRect Lib "user32" (ByVal hWnd As HWND, ByVal hMenu As HMENU, ByVal uItem As DWord, ByRef lprcItem As RECT) As BOOL
Declare Function MenuItemFromPoint Lib "user32" (ByVal hWnd As HWND, ByVal hMenu As HMENU, ByRef ptScreen As POINTAPI) As Long

Declare Function SetMenuContextHelpId Lib "user32" (hmenu As HMENU, dwContextHelpId As DWord) As BOOL
Declare Function SetMenuDefaultItem Lib "user32" (hMenu As HMENU, uItem As DWord, fByPos As DWord) As BOOL
Declare Function SetMenuItemInfo Lib "user32" Alias _FuncName_SetMenuItemInfo (hMenu As HMENU, uItem As DWord, fByPosition As BOOL, ByRef mii As MENUITEMINFO) As BOOL
Declare Function SetParent Lib "user32" (hWndChild As HWND, hWndNewParent As HWND) As HWND
Declare Function SetProp Lib "user32" Alias _FuncName_SetProp (hWnd As HWND, pString As PCTSTR, hData As HANDLE) As BOOL

TypeDef PROPENUMPROCEXA = *Function(ByVal hwnd As HWND, ByVal lpszString As LPSTR, ByVal hData As HANDLE, ByVal dwData As ULONG_PTR) As BOOL
TypeDef PROPENUMPROCEXW = *Function(ByVal hwnd As HWND, ByVal lpszString As LPWSTR, ByVal hData As HANDLE, ByVal dwData As ULONG_PTR) As BOOL
#ifdef UNICODE
TypeDef PROPENUMPROCEX = PROPENUMPROCEXW
#else
TypeDef PROPENUMPROCEX = PROPENUMPROCEXA
#endif ' !UNICODE

Declare Function EnumPropsExA Lib "user32" (ByVal hWnd As HWND, ByVal lpEnumFunc As PROPENUMPROCEXA, ByVal lParam As LPARAM) As Long
Declare Function EnumPropsExW Lib "user32" (ByVal hWnd As HWND, ByVal lpEnumFunc As PROPENUMPROCEXW, ByVal lParam As LPARAM) As Long
#ifdef UNICODE
Declare Function EnumPropsEx Lib "user32" Alias "EnumPropsExW" (ByVal hWnd As HWND, ByVal lpEnumFunc As PROPENUMPROCEXW, ByVal lParam As LPARAM) As Long
#else
Declare Function EnumPropsEx Lib "user32" Alias "EnumPropsExA" (ByVal hWnd As HWND, ByVal lpEnumFunc As PROPENUMPROCEXA, ByVal lParam As LPARAM) As Long
#endif ' !UNICODE


TypeDef PROPENUMPROCA = *Function(ByVal hwnd As HWND, ByVal lpszString As LPCSTR, ByVal hData As HANDLE) As BOOL
TypeDef PROPENUMPROCW = *Function(ByVal hwnd As HWND, ByVal lpszString As LPCWSTR, ByVal hData As HANDLE) As BOOL
#ifdef UNICODE
TypeDef PROPENUMPROC = PROPENUMPROCW
#else
TypeDef PROPENUMPROC = PROPENUMPROCA
#endif ' !UNICODE

Declare Function EnumPropsA Lib "user32" (ByVal hWnd As HWND, ByVal lpEnumFunc As PROPENUMPROCA) As Long
Declare Function EnumPropsW Lib "user32" (ByVal hWnd As HWND, ByVal lpEnumFunc As PROPENUMPROCW) As Long
#ifdef UNICODE
Declare Function EnumProps Lib "user32" Alias "EnumPropsW" (ByVal hWnd As HWND, ByVal lpEnumFunc As PROPENUMPROCW) As Long
#else
Declare Function EnumProps Lib "user32" Alias "EnumPropsA" (ByVal hWnd As HWND, ByVal lpEnumFunc As PROPENUMPROCA) As Long
#endif ' !UNICODE

Declare Function SetRect Lib "User32" (ByRef rc As RECT, xLeft As Long, yTop As Long, xRight As Long, yBottom As Long) As Long
Declare Function SetRectEmpty Lib "user32" (ByRef lprc As RECT) As BOOL
Declare Function CopyRect Lib "user32" (ByRef lprcDst As RECT, ByRef lprcSrc As RECT) As BOOL
Declare Function InflateRect Lib "user32" (ByRef lprc As RECT, ByVal dx As Long, ByVal dy As Long) As BOOL
Declare Function IntersectRect Lib "user32" (ByRef lprcDst As RECT, ByRef lprcSrc1 As RECT, ByRef lprcSrc2 As RECT) As BOOL
Declare Function UnionRect Lib "user32" (ByRef lprcDst As RECT, ByRef lprcSrc1 As RECT, ByRef lprcSrc2 As RECT) As BOOL
Declare Function SubtractRect Lib "user32" (ByRef lprcDst As RECT, ByRef lprcSrc1 As RECT, ByRef lprcSrc2 As RECT) As BOOL
Declare Function OffsetRect Lib "user32" (ByRef lprc As RECT, ByVal dx As Long, ByVal dy As Long) As BOOL
Declare Function IsRectEmpty Lib "user32" (ByRef lprc As RECT) As BOOL
Declare Function EqualRect Lib "user32" (ByRef lprc1 As RECT, ByRef lprc2 As RECT) As BOOL
Declare Function PtInRect Lib "user32" (ByRef lprc As RECT, ByRef pt As POINTAPI) As BOOL
Declare Function SetScrollInfo Lib "user32" (hWnd As HWND, fnBar As Long, ByRef lpsi As SCROLLINFO, bRedraw As Long) As BOOL
Declare Function SetSysColors Lib "user32" (cElements As Long, lpaElements As *DWord, lpaRgbValues As *DWord) As BOOL
Declare Function SetSystemCursor Lib "user32" (ByVal hcur As HCURSOR, ByVal id As DWord) As BOOL

Const USER_TIMER_MAXIMUM = &H7FFFFFFF
Const USER_TIMER_MINIMUM = &H0000000A

TypeDef TIMERPROC = *Sub(hwnd As HWND, msg As DWord, idEvent As ULONG_PTR, dwTime As DWord)
Declare Function SetTimer Lib "user32" (hWnd As HWND, nIDEvent As ULONG_PTR, nElapse As DWord, lpTimerFunc As TIMERPROC) As ULONG_PTR

Declare Function SetWindowContextHelpId Lib "user32" (hwnd As HWND, dwContextHelpId As DWord) As BOOL
#ifdef _WIN64
Declare Function SetWindowLong Lib "user32" Alias _FuncName_SetWindowLongPtr (hWnd As HWND, nIndex As Long, NewLong As LONG_PTR) As LONG_PTR
Declare Function SetWindowLongPtr Lib "user32" Alias _FuncName_SetWindowLongPtr (hWnd As HWND, nIndex As Long, NewLong As LONG_PTR) As LONG_PTR
#else
Declare Function SetWindowLong Lib "user32" Alias _FuncName_SetWindowLong (hWnd As HWND, nIndex As Long, NewLong As LONG_PTR) As LONG_PTR
Declare Function SetWindowLongPtr Lib "user32" Alias _FuncName_SetWindowLong (hWnd As HWND, nIndex As Long, NewLong As LONG_PTR) As LONG_PTR
#endif

Declare Function SetWindowPlacement Lib "user32" (hWnd As HWND, ByRef lpwndpl As WINDOWPLACEMENT) As BOOL

Const HWND_TOP =       0  As HWND
Const HWND_BOTTOM =    1  As HWND
Const HWND_TOPMOST =   -1 As HWND
Const HWND_NOTOPMOST = -2 As HWND
Const SWP_NOSIZE =         &H0001
Const SWP_NOMOVE =         &H0002
Const SWP_NOZORDER =       &H0004
Const SWP_NOREDRAW =       &H0008
Const SWP_NOACTIVATE =     &H0010
Const SWP_FRAMECHANGED =   &H0020
Const SWP_SHOWWINDOW =     &H0040
Const SWP_HIDEWINDOW =     &H0080
Const SWP_NOCOPYBITS =     &H0100
Const SWP_NOOWNERZORDER =  &H0200
Const SWP_NOSENDCHANGING = &H0400
Const SWP_DRAWFRAME =      SWP_FRAMECHANGED
Const SWP_NOREPOSITION =   SWP_NOOWNERZORDER
Const SWP_DEFERERASE =     &H2000
Const SWP_ASYNCWINDOWPOS = &H4000
Declare Function SetWindowPos Lib "user32" (hWnd As HWND, hWndInsertAfter As HWND, X As Long, Y As Long, cx As Long, cy As Long, uFlags As DWord) As BOOL

Declare Function SetWindowRgn Lib "user32" (hWnd As HWND, hRgn As HRGN, bRedraw As BOOL) As BOOL
Declare Function SetWindowsHookEx Lib "user32" Alias _FuncName_SetWindowsHookEx (idHook As Long, lpfn As HOOKPROC, hMod As HINSTANCE, dwThreadId As DWord) As HHOOK
Declare Function SetWindowText Lib "user32" Alias _FuncName_SetWindowText (hWnd As HWND, pString As PCTSTR) As BOOL
Declare Function ShowCaret Lib "user32" (hWnd As HWND) As BOOL
Declare Function ShowCursor Lib "user32" (bShow As Long) As BOOL
Declare Function ShowScrollBar Lib "user32" (hWnd As HWND, wBar As DWord, bShow As BOOL) As BOOL

Const SW_HIDE =            0
Const SW_SHOWNORMAL =      1
Const SW_NORMAL =          1
Const SW_SHOWMINIMIZED =   2
Const SW_SHOWMAXIMIZED =   3
Const SW_MAXIMIZE =        3
Const SW_SHOWNOACTIVATE =  4
Const SW_SHOW =            5
Const SW_MINIMIZE =        6
Const SW_SHOWMINNOACTIVE = 7
Const SW_SHOWNA =          8
Const SW_RESTORE =         9
Const SW_SHOWDEFAULT =     10
Const SW_FORCEMINIMIZE =   11
Const SW_MAX =             11
Declare Function ShowWindow Lib "user32" (hWnd As HWND, nCmdShow As Long) As BOOL
Declare Function ShowWindowAsync Lib "user32" (hWnd As HWND, nCmdShow As Long) As BOOL

Type NONCLIENTMETRICSW
	cbSize As DWord
	iBorderWidth As Long
	iScrollWidth As Long
	iScrollHeight As Long
	iCaptionWidth As Long
	iCaptionHeight As Long
	lfCaptionFont As LOGFONTW
	iSmCaptionWidth As Long
	iSmCaptionHeight As Long
	lfSmCaptionFont As LOGFONTW
	iMenuWidth As Long
	iMenuHeight As Long
	lfMenuFont As LOGFONTW
	lfStatusFont As LOGFONTW
	lfMessageFont As LOGFONTW
End Type
Type NONCLIENTMETRICSA
	cbSize As DWord
	iBorderWidth As Long
	iScrollWidth As Long
	iScrollHeight As Long
	iCaptionWidth As Long
	iCaptionHeight As Long
	lfCaptionFont As LOGFONTA
	iSmCaptionWidth As Long
	iSmCaptionHeight As Long
	lfSmCaptionFont As LOGFONTA
	iMenuWidth As Long
	iMenuHeight As Long
	lfMenuFont As LOGFONTA
	lfStatusFont As LOGFONTA
	lfMessageFont As LOGFONTA
End Type
#ifdef UNICODE
TypeDef NONCLIENTMETRICS = NONCLIENTMETRICSW
#else
TypeDef NONCLIENTMETRICS = NONCLIENTMETRICSA
#endif
Const SPI_GETBEEP =               1
Const SPI_SETBEEP =               2
Const SPI_GETMOUSE =              3
Const SPI_SETMOUSE =              4
Const SPI_GETBORDER =             5
Const SPI_SETBORDER =             6
Const SPI_GETKEYBOARDSPEED =      10
Const SPI_SETKEYBOARDSPEED =      11
Const SPI_LANGDRIVER =            12
Const SPI_ICONHORIZONTALSPACING = 13
Const SPI_GETSCREENSAVETIMEOUT =  14
Const SPI_SETSCREENSAVETIMEOUT =  15
Const SPI_GETSCREENSAVEACTIVE =   16
Const SPI_SETSCREENSAVEACTIVE =   17
Const SPI_GETGRIDGRANULARITY =    18
Const SPI_SETGRIDGRANULARITY =    19
Const SPI_SETDESKWALLPAPER =      20
Const SPI_SETDESKPATTERN =        21
Const SPI_GETKEYBOARDDELAY =      22
Const SPI_SETKEYBOARDDELAY =      23
Const SPI_ICONVERTICALSPACING =   24
Const SPI_GETICONTITLEWRAP =      25
Const SPI_SETICONTITLEWRAP =      26
Const SPI_GETMENUDROPALIGNMENT =  27
Const SPI_SETMENUDROPALIGNMENT =  28
Const SPI_SETDOUBLECLKWIDTH =     29
Const SPI_SETDOUBLECLKHEIGHT =    30
Const SPI_GETICONTITLELOGFONT =   31
Const SPI_SETDOUBLECLICKTIME =    32
Const SPI_SETMOUSEBUTTONSWAP =    33
Const SPI_SETICONTITLELOGFONT =   34
Const SPI_GETFASTTASKSWITCH =     35
Const SPI_SETFASTTASKSWITCH =     36
Const SPI_SETDRAGFULLWINDOWS =    37
Const SPI_GETDRAGFULLWINDOWS =    38
Const SPI_GETNONCLIENTMETRICS =   41
Const SPI_SETNONCLIENTMETRICS =   42
Const SPI_GETMINIMIZEDMETRICS =   43
Const SPI_SETMINIMIZEDMETRICS =   44
Const SPI_GETICONMETRICS =        45
Const SPI_SETICONMETRICS =        46
Const SPI_SETWORKAREA =           47
Const SPI_GETWORKAREA =           48
Const SPI_SETPENWINDOWS =         49
Const SPI_GETHIGHCONTRAST =       66
Const SPI_SETHIGHCONTRAST =       67
Const SPI_GETKEYBOARDPREF =       68
Const SPI_SETKEYBOARDPREF =       69
Const SPI_GETSCREENREADER =       70
Const SPI_SETSCREENREADER =       71
Const SPI_GETANIMATION =          72
Const SPI_SETANIMATION =          73
Const SPI_GETFONTSMOOTHING =      74
Const SPI_SETFONTSMOOTHING =      75
Const SPI_SETDRAGWIDTH =          76
Const SPI_SETDRAGHEIGHT =         77
Const SPI_SETHANDHELD =           78
Const SPI_GETLOWPOWERTIMEOUT =    79
Const SPI_GETPOWEROFFTIMEOUT =    80
Const SPI_SETLOWPOWERTIMEOUT =    81
Const SPI_SETPOWEROFFTIMEOUT =    82
Const SPI_GETLOWPOWERACTIVE =     83
Const SPI_GETPOWEROFFACTIVE =     84
Const SPI_SETLOWPOWERACTIVE =     85
Const SPI_SETPOWEROFFACTIVE =     86
Const SPI_SETCURSORS =            87
Const SPI_SETICONS =              88
Const SPI_GETDEFAULTINPUTLANG =   89
Const SPI_SETDEFAULTINPUTLANG =   90
Const SPI_SETLANGTOGGLE =         91
Const SPI_GETWINDOWSEXTENSION =   92
Const SPI_SETMOUSETRAILS =        93
Const SPI_GETMOUSETRAILS =        94
Const SPI_SETSCREENSAVERRUNNING = 97
Const SPI_SCREENSAVERRUNNING =    SPI_SETSCREENSAVERRUNNING
Const SPI_GETFILTERKEYS =         50
Const SPI_SETFILTERKEYS =         51
Const SPI_GETTOGGLEKEYS =         52
Const SPI_SETTOGGLEKEYS =         53
Const SPI_GETMOUSEKEYS =          54
Const SPI_SETMOUSEKEYS =          55
Const SPI_GETSHOWSOUNDS =         56
Const SPI_SETSHOWSOUNDS =         57
Const SPI_GETSTICKYKEYS =         58
Const SPI_SETSTICKYKEYS =         59
Const SPI_GETACCESSTIMEOUT =      60
Const SPI_SETACCESSTIMEOUT =      61
Const SPI_GETSERIALKEYS =         62
Const SPI_SETSERIALKEYS =         63
Const SPI_GETSOUNDSENTRY =        64
Const SPI_SETSOUNDSENTRY =        65
Const SPI_GETMOUSEHOVERWIDTH =    98
Const SPI_SETMOUSEHOVERWIDTH =    99
Const SPI_GETMOUSEHOVERHEIGHT =   100
Const SPI_SETMOUSEHOVERHEIGHT =   101
Const SPI_GETMOUSEHOVERTIME =     102
Const SPI_SETMOUSEHOVERTIME =     103
Const SPI_GETWHEELSCROLLLINES =   104
Const SPI_SETWHEELSCROLLLINES =   105
Const SPI_GETSHOWIMEUI =          110
Const SPI_SETSHOWIMEUI =          111
Const SPI_GETMOUSESPEED =         112
Const SPI_SETMOUSESPEED =         113
Const SPI_GETSCREENSAVERRUNNING = 114
Const SPI_GETACTIVEWINDOWTRACKING =       &H1000	'Windows 2000 or later
Const SPI_SETACTIVEWINDOWTRACKING =       &H1001
Const SPI_GETMENUANIMATION =              &H1002
Const SPI_SETMENUANIMATION =              &H1003
Const SPI_GETCOMBOBOXANIMATION =          &H1004
Const SPI_SETCOMBOBOXANIMATION =          &H1005
Const SPI_GETLISTBOXSMOOTHSCROLLING =     &H1006
Const SPI_SETLISTBOXSMOOTHSCROLLING =     &H1007
Const SPI_GETGRADIENTCAPTIONS =           &H1008
Const SPI_SETGRADIENTCAPTIONS =           &H1009
Const SPI_GETMENUUNDERLINES =             &H100A
Const SPI_SETMENUUNDERLINES =             &H100B
Const SPI_GETACTIVEWNDTRKZORDER =         &H100C
Const SPI_SETACTIVEWNDTRKZORDER =         &H100D
Const SPI_GETHOTTRACKING =                &H100E
Const SPI_SETHOTTRACKING =                &H100F
Const SPI_GETFOREGROUNDLOCKTIMEOUT =      &H2000
Const SPI_SETFOREGROUNDLOCKTIMEOUT =      &H2001
Const SPI_GETACTIVEWNDTRKTIMEOUT =        &H2002
Const SPI_SETACTIVEWNDTRKTIMEOUT =        &H2003
Const SPI_GETFOREGROUNDFLASHCOUNT =       &H2004
Const SPI_SETFOREGROUNDFLASHCOUNT =       &H2005
Const SPIF_UPDATEINIFILE =    &H0001
Const SPIF_SENDWININICHANGE = &H0002
Const SPIF_SENDCHANGE =       SPIF_SENDWININICHANGE
Declare Function SystemParametersInfo Lib "user32" Alias _FuncName_SystemParametersInfo (uiAction As DWord, uiParam As DWord, pvParam As VoidPtr, fWinIni As DWord) As BOOL

Const CDS_UPDATEREGISTRY = &H00000001
Const CDS_TEST            = &H00000002
Const CDS_FULLSCREEN      = &H00000004
Const CDS_GLOBAL          = &H00000008
Const CDS_SET_PRIMARY     = &H00000010
Const CDS_VIDEOPARAMETERS = &H00000020
Const CDS_RESET           = &H40000000
Const CDS_NORESET         = &H10000000

Const DISP_CHANGE_SUCCESSFUL    =   0
Const DISP_CHANGE_RESTART       =   1
Const DISP_CHANGE_FAILED        =  -1
Const DISP_CHANGE_BADMODE       =  -2
Const DISP_CHANGE_NOTUPDATED    =  -3
Const DISP_CHANGE_BADFLAGS      =  -4
Const DISP_CHANGE_BADPARAM      =  -5
Const DISP_CHANGE_BADDUALVIEW   =  -6

#ifdef _INC_GDI
Declare Function ChangeDisplaySettingsA Lib "user32" (ByVal lpDevMode As *DEVMODEA, ByVal dwFlags As DWord) As Long
Declare Function ChangeDisplaySettingsW Lib "user32" (ByVal lpDevMode As *DEVMODEW, ByVal dwFlags As DWord) As Long
#ifdef UNICODE
Declare Function ChangeDisplaySettings Lib "user32" Alias _FuncName_ChangeDisplaySettings (ByVal lpDevMode As *DEVMODEW, ByVal dwFlags As DWord) As Long
#else
Declare Function ChangeDisplaySettings Lib "user32" Alias _FuncName_ChangeDisplaySettings (ByVal lpDevMode As *DEVMODEA, ByVal dwFlags As DWord) As Long
#endif

Declare Function ChangeDisplaySettingsExA Lib "user32" (ByVal lpszDeviceName As LPCSTR, ByVal lpDevMode As *DEVMODEA, ByVal hwnd As HWND, ByVal dwFlags As DWord, ByVal lParam As VoidPtr) As Long
Declare Function ChangeDisplaySettingsExW Lib "user32" (ByVal lpszDeviceName As LPCWSTR, ByVal lpDevMode As *DEVMODEW, ByVal hwnd As HWND, ByVal dwFlags As DWord, ByVal lParam As VoidPtr) As Long
#ifdef UNICODE
Declare Function ChangeDisplaySettingsEx Lib "user32" Alias _FuncName_ChangeDisplaySettingsEx (ByVal lpszDeviceName As LPCWSTR, ByVal lpDevMode As *DEVMODEW, ByVal hwnd As HWND, ByVal dwFlags As DWord, ByVal lParam As VoidPtr) As Long
#else
Declare Function ChangeDisplaySettingsEx Lib "user32" Alias _FuncName_ChangeDisplaySettingsEx (ByVal lpszDeviceName As LPCSTR, ByVal lpDevMode As *DEVMODEA, ByVal hwnd As HWND, ByVal dwFlags As DWord, ByVal lParam As VoidPtr) As Long
#endif

Const ENUM_CURRENT_SETTINGS       = ((-1) As DWord)
Const ENUM_REGISTRY_SETTINGS      = ((-2) As DWord)

Declare Function EnumDisplaySettingsA Lib "user32" (ByVal lpszDeviceName As LPCSTR, ByVal iModeNum As DWord, ByVal lpDevMode As *DEVMODEA) As BOOL
Declare Function EnumDisplaySettingsW Lib "user32" (ByVal lpszDeviceName As LPCWSTR, ByVal iModeNum As DWord, ByVal lpDevMode As *DEVMODEW) As BOOL
#ifdef UNICODE
Declare Function EnumDisplaySettings Lib "user32" Alias _FuncName_EnumDisplaySettings (ByVal lpszDeviceName As LPCWSTR, ByVal iModeNum As DWord, ByVal lpDevMode As *DEVMODEW) As BOOL
#else
Declare Function EnumDisplaySettings Lib "user32" Alias _FuncName_EnumDisplaySettings (ByVal lpszDeviceName As LPCSTR, ByVal iModeNum As DWord, ByVal lpDevMode As *DEVMODEA) As BOOL
#endif

/*#ifdef(WINVER >= &h0500)
Declare Function EnumDisplaySettingsExA Lib "user32" (ByVal lpszDeviceName As LPCSTR, ByVal iModeNum As DWord, ByVal lpDevMode As *DEVMODEA, ByVal dwFlags As DWord) As BOOL
Declare Function EnumDisplaySettingsExW Lib "user32" (ByVal lpszDeviceName As LPCWSTR, ByVal iModeNum As DWord, ByVal lpDevMode As *DEVMODEW, ByVal dwFlags As DWord) As BOOL
#ifdef UNICODE
Declare Function EnumDisplaySettingsEx Lib "user32" Alias _FuncName_EnumDisplaySettingsEx (ByVal lpszDeviceName As LPCWSTR, ByVal iModeNum As DWord, ByVal lpDevMode As *DEVMODEW, ByVal dwFlags As DWord) As BOOL
#else
Declare Function EnumDisplaySettingsEx Lib "user32" Alias _FuncName_EnumDisplaySettingsEx (ByVal lpszDeviceName As LPCSTR, ByVal iModeNum As DWord, ByVal lpDevMode As *DEVMODEA, ByVal dwFlags As DWord) As BOOL
#endif

Const EDS_RAWMODE  = &H00000002

Declare Function EnumDisplayDevicesA Lib "user32" (ByVal lpDevice As LPCSTR, ByVal iDevNum As DWord, ByVal lpDisplayDevice As *DISPLAY_DEVICEA, ByVal dwFlags As DWord) As BOOL
Declare Function EnumDisplayDevicesW Lib "user32" (ByVal lpDevice As LPCWSTR, ByVal iDevNum As DWord, ByVal lpDisplayDevice As *DISPLAY_DEVICEW, ByVal dwFlags As DWord)As BOOL
#ifdef UNICODE
Declare Function EnumDisplayDevices Lib "user32" Alias _FuncName_EnumDisplayDevices (ByVal lpDevice As LPCWSTR, ByVal iDevNum As DWord, ByVal lpDisplayDevice As *DISPLAY_DEVICEW, ByVal dwFlags As DWord)As BOOL
#else
Declare Function EnumDisplayDevices Lib "user32" Alias _FuncName_EnumDisplayDevices (ByVal lpDevice As LPCSTR, ByVal iDevNum As DWord, ByVal lpDisplayDevice As *DISPLAY_DEVICEA, ByVal dwFlags As DWord) As BOOL
#endif
#endif */ /* WINVER >= &h0500 */
#endif ' _INC_GDI

Const TME_HOVER       = &H00000001
Const TME_LEAVE       = &H00000002
Const TME_NONCLIENT   = &H00000010
Const TME_QUERY       = &H40000000
Const TME_CANCEL      = &H80000000
Const HOVER_DEFAULT   = &HFFFFFFFF
Type TRACKMOUSEEVENT
	cbSize As DWord
	dwFlags As DWord
	hwndTrack As HWND
	dwHoverTime As DWord
End Type
Declare Function TrackMouseEvent Lib "user32" (ByRef EventTrack As TRACKMOUSEEVENT) As BOOL

Const TPM_LEFTBUTTON =   &H0000
Const TPM_RIGHTBUTTON =  &H0002
Const TPM_LEFTALIGN =    &H0000
Const TPM_CENTERALIGN =  &H0004
Const TPM_RIGHTALIGN =   &H0008
Const TPM_TOPALIGN =     &H0000
Const TPM_VCENTERALIGN = &H0010
Const TPM_BOTTOMALIGN =  &H0020
Const TPM_HORIZONTAL =   &H0000
Const TPM_VERTICAL =     &H0040
Const TPM_NONOTIFY =     &H0080
Const TPM_RETURNCMD =    &H0100
Const TPM_RECURSE =      &H0001
Declare Function TrackPopupMenu Lib "user32" (hMenu As HMENU, uFlags As DWord, x As Long, y As Long, nReserved As Long, ByVal hWnd As HWND, ByRef prcRect As RECT) As BOOL

declare function UnhookWindowsHookEx lib "user32" (ByVal hhk As HHOOK) As BOOL
Declare Function UnregisterClass Lib "user32" Alias _FuncName_UnregisterClass (pClassName As PCTSTR, hinst As HINSTANCE) As BOOL
Declare Function UnregisterHotKey Lib "user32" (hwnd As HWND, id As Long) As BOOL
Declare Function UpdateWindow Lib "user32" (hWnd As HWND) As BOOL
Declare Function ValidateRect Lib "user32" (hWnd As HWND, ByRef lpRect As RECT) As BOOL
Declare Function ValidateRgn Lib "user32" (hWnd As HWND, hRgn As HRGN) As BOOL
Declare Function WaitForInputIdle Lib "user32" (hProcess As HANDLE, dwMilliseconds As DWord) As DWord

Declare Function WaitMessage Lib "user32" () As BOOL
Declare Function WindowFromDC Lib "user32" (hDC As HDC) As HWND
Declare Function WindowFromPoint Lib "user32" (ptX As Long, ptY As Long) As HWND

TypeDef HELPPOLY = DWord

Type MULTIKEYHELPA
	mkSize As DWord
	mkKeylist As SByte
	szKeyphrase[ELM(1)] As SByte
End Type
TypeDef PMULTIKEYHELPA=*MULTIKEYHELPA
TypeDef LPMULTIKEYHELPA=*MULTIKEYHELPA
Type MULTIKEYHELPW
	mkSize As DWord
	mkKeylist As Word
	szKeyphrase[ELM(1)] As Word
End Type
TypeDef PMULTIKEYHELPW=*MULTIKEYHELPW
TypeDef LPMULTIKEYHELPW=*MULTIKEYHELPW

#ifdef UNICODE
TypeDef MULTIKEYHELP = MULTIKEYHELPW
TypeDef PMULTIKEYHELP = PMULTIKEYHELPW
TypeDef LPMULTIKEYHELP = LPMULTIKEYHELPW
#else
TypeDef MULTIKEYHELP = MULTIKEYHELPA
TypeDef PMULTIKEYHELP = PMULTIKEYHELPA
TypeDef LPMULTIKEYHELP = LPMULTIKEYHELPA
#endif ' UNICODE

Type HELPWININFOA
	wStructSize As Long
	x As Long
	y As Long
	dx As Long
	dy As Long
	wMax As Long
	rgchMember[ELM(2)] As SByte
End Type
TypeDef PHELPWININFOA=*HELPWININFOA
TypeDef LPHELPWININFOA=*HELPWININFOA
Type HELPWININFOW
	wStructSize As Long
	x As Long
	y As Long
	dx As Long
	dy As Long
	wMax As Long
	rgchMember[ELM(2)] As Word
End Type
TypeDef PHELPWININFOW=*HELPWININFOW
TypeDef LPHELPWININFOW=*HELPWININFOW

#ifdef UNICODE
TypeDef HELPWININFO = HELPWININFOW
TypeDef PHELPWININFO = PHELPWININFOW
TypeDef LPHELPWININFO = LPHELPWININFOW
#else
TypeDef HELPWININFO = HELPWININFOA
TypeDef PHELPWININFO = PHELPWININFOA
TypeDef LPHELPWININFO = LPHELPWININFOA
#endif ' UNICODE

Const HELP_CONTEXT = &H0001
Const HELP_QUIT = &H0002
Const HELP_INDEX = &H0003
Const HELP_CONTENTS = &H0003
Const HELP_HELPONHELP = &H0004
Const HELP_SETINDEX = &H0005
Const HELP_SETCONTENTS = &H0005
Const HELP_CONTEXTPOPUP = &H0008
Const HELP_FORCEFILE = &H0009
Const HELP_KEY = &H0101
Const HELP_COMMAND = &H0102
Const HELP_PARTIALKEY = &H0105
Const HELP_MULTIKEY = &H0201
Const HELP_SETWINPOS = &H0203
Const HELP_CONTEXTMENU = &H000a
Const HELP_FINDER = &H000b
Const HELP_WM_HELP = &H000c
Const HELP_SETPOPUP_POS = &H000d
Const HELP_TCARD = &H8000
Const HELP_TCARD_DATA = &H0010
Const HELP_TCARD_OTHER_CALLER = &H0011

Const IDH_NO_HELP = 28440
Const IDH_MISSING_CONTEXT = 28441
Const IDH_GENERIC_HELP_BUTTON = 28442
Const IDH_OK = 28443
Const IDH_CANCEL = 28444
Const IDH_HELP = 28445

Declare Function WinHelpA Lib "user32" (ByVal hWndMain As HWND, ByVal lpszHelp As LPCSTR, ByVal uCommand As DWord, ByVal dwData As ULONG_PTR) As BOOL
Declare Function WinHelpW Lib "user32" (ByVal hWndMain As HWND, ByVal lpszHelp As LPCWSTR, ByVal uCommand As DWord, ByVal dwData As ULONG_PTR) As BOOL
#ifdef UNICODE
Declare Function WinHelp Lib "user32" Alias "WinHelpW" (ByVal hWndMain As HWND, ByVal lpszHelp As LPCWSTR, ByVal uCommand As DWord, ByVal dwData As ULONG_PTR) As BOOL
#else
Declare Function WinHelp Lib "user32" Alias "WinHelpA" (ByVal hWndMain As HWND, ByVal lpszHelp As LPCSTR, ByVal uCommand As DWord, ByVal dwData As ULONG_PTR) As BOOL
#endif ' !UNICODE

Declare Function wsprintf cdecl Lib "user32" Alias _FuncName_wsprintf (pText As PTSTR, pFormat As PCTSTR, ...) As Long
Declare Function wvsprintf Lib "user32" Alias _FuncName_wvsprintf (pOutput As PTSTR, pFormat As PCTSTR, arglist As DWordPtr) As Long

Type GUITHREADINFO
	cbSize As DWord
	flags As DWord
	hwndActive As HWND
	hwndFocus As HWND
	hwndCapture As HWND
	hwndMenuOwner As HWND
	hwndMoveSize As HWND
	hwndCaret As HWND
	rcCaret As RECT
End Type
TypeDef PGUITHREADINFO = *GUITHREADINFO
TypeDef LPGUITHREADINFO = *GUITHREADINFO

Const GUI_CARETBLINKING = &H00000001
Const GUI_INMOVESIZE = &H00000002
Const GUI_INMENUMODE = &H00000004
Const GUI_SYSTEMMENUMODE = &H00000008
Const GUI_POPUPMENUMODE = &H00000010
Const GUI_16BITTASK = &H00000020

Declare Function GetGUIThreadInfo Lib "user32" (ByVal idThread As DWord, ByRef pgui As GUITHREADINFO) As BOOL

Const STATE_SYSTEM_UNAVAILABLE = &H00000001
Const STATE_SYSTEM_SELECTED = &H00000002
Const STATE_SYSTEM_FOCUSED = &H00000004
Const STATE_SYSTEM_PRESSED = &H00000008
Const STATE_SYSTEM_CHECKED = &H00000010
Const STATE_SYSTEM_MIXED = &H00000020
Const STATE_SYSTEM_INDETERMINATE = STATE_SYSTEM_MIXED
Const STATE_SYSTEM_READONLY = &H00000040
Const STATE_SYSTEM_HOTTRACKED = &H00000080
Const STATE_SYSTEM_DEFAULT = &H00000100
Const STATE_SYSTEM_EXPANDED = &H00000200
Const STATE_SYSTEM_COLLAPSED = &H00000400
Const STATE_SYSTEM_BUSY = &H00000800
Const STATE_SYSTEM_FLOATING = &H00001000
Const STATE_SYSTEM_MARQUEED = &H00002000
Const STATE_SYSTEM_ANIMATED = &H00004000
Const STATE_SYSTEM_INVISIBLE = &H00008000
Const STATE_SYSTEM_OFFSCREEN = &H00010000
Const STATE_SYSTEM_SIZEABLE = &H00020000
Const STATE_SYSTEM_MOVEABLE = &H00040000
Const STATE_SYSTEM_SELFVOICING = &H00080000
Const STATE_SYSTEM_FOCUSABLE = &H00100000
Const STATE_SYSTEM_SELECTABLE = &H00200000
Const STATE_SYSTEM_LINKED = &H00400000
Const STATE_SYSTEM_TRAVERSED = &H00800000
Const STATE_SYSTEM_MULTISELECTABLE = &H01000000
Const STATE_SYSTEM_EXTSELECTABLE = &H02000000
Const STATE_SYSTEM_ALERT_LOW = &H04000000
Const STATE_SYSTEM_ALERT_MEDIUM = &H08000000
Const STATE_SYSTEM_ALERT_HIGH = &H10000000
Const STATE_SYSTEM_PROTECTED = &H20000000
Const STATE_SYSTEM_VALID = &H3FFFFFFF

Const CCHILDREN_TITLEBAR = 5
Const CCHILDREN_SCROLLBAR = 5


Type CURSORINFO
	cbSize As DWord
	flags As DWord
	hCursor As HCURSOR
	ptScreenPos As POINTAPI
End Type
TypeDef PCURSORINFO=*CURSORINFO
TypeDef LPCURSORINFO=*CURSORINFO

Const CURSOR_SHOWING = &H00000001

Declare Function GetCursorInfo Lib "user32" (ByRef pci As CURSORINFO) As BOOL


Type MENUBARINFO
	cbSize As DWord
	rcBar As RECT
	hMenu As HMENU
	hwndMenu As HWND
	fields As BOOL
/*	fBarFocused As BOOL
	fFocused As BOOL*/
End Type
TypeDef PMENUBARINFO=*MENUBARINFO
TypeDef LPMENUBARINFO=*MENUBARINFO

Declare Function GetMenuBarInfo Lib "user32" (ByVal hwnd As HWND, ByVal idObject As Long, ByVal idItem As Long, ByRef pmbi As MENUBARINFO) As BOOL

Type COMBOBOXINFO
	cbSize As DWord
	rcItem As RECT
	rcButton As RECT
	stateButton As DWord
	hwndCombo As HWND
	hwndItem As HWND
	hwndList As HWND
End Type
TypeDef PCOMBOBOXINFO=*COMBOBOXINFO
TypeDef LPCOMBOBOXINFO=*COMBOBOXINFO

Declare Function GetComboBoxInfo Lib "user32" (ByVal hwndCombo As HWND, ByRef pcbi As COMBOBOXINFO) As BOOL


Const GA_PARENT = 1
Const GA_ROOT = 2
Const GA_ROOTOWNER = 3

Declare Function GetAncestor Lib "user32" (ByVal hwnd As HWND, ByVal gaFlags As DWord) As HWND


Declare Function RealGetWindowClassA Lib "user32" (ByVal hwnd As HWND, ByVal ptszClassName As LPSTR, ByVal cchClassNameMax As DWord) As DWord
Declare Function RealGetWindowClassW Lib "user32" (ByVal hwnd As HWND, ByVal ptszClassName As LPWSTR, ByVal cchClassNameMax As DWord) As DWord
#ifdef UNICODE
Declare Function RealGetWindowClass Lib "user32" Alias "RealGetWindowClassW" (ByVal hwnd As HWND, ByVal ptszClassName As LPWSTR, ByVal cchClassNameMax As DWord) As DWord
#else
Declare Function RealGetWindowClass Lib "user32" Alias "RealGetWindowClassA" (ByVal hwnd As HWND, ByVal ptszClassName As LPSTR, ByVal cchClassNameMax As DWord) As DWord
#endif ' !UNICODE


Type ALTTABINFO
	cbSize As DWord
	cItems As Long
	cColumns As Long
	cRows As Long
	iColFocus As Long
	iRowFocus As Long
	cxItem As Long
	cyItem As Long
	ptStart As POINTAPI
End Type
TypeDef PALTTABINFO=*ALTTABINFO
TypeDef LPALTTABINFO=*ALTTABINFO

Declare Function GetAltTabInfoA Lib "user32" (ByVal hwnd As HWND, ByVal iItem As Long, ByRef pati As ALTTABINFO, ByVal pszItemText As LPSTR, ByVal cchItemText As DWord) As BOOL
Declare Function GetAltTabInfoW Lib "user32" (ByVal hwnd As HWND, ByVal iItem As Long, ByRef pati As ALTTABINFO, ByVal pszItemText As LPWSTR, ByVal cchItemText As DWord) As BOOL
#ifdef UNICODE
Declare Function GetAltTabInfo Lib "user32" Alias "GetAltTabInfoW" (ByVal hwnd As HWND, ByVal iItem As Long, ByRef pati As ALTTABINFO, ByVal pszItemText As LPWSTR, ByVal cchItemText As DWord) As BOOL
#else
Declare Function GetAltTabInfo Lib "user32" Alias "GetAltTabInfoA" (ByVal hwnd As HWND, ByVal iItem As Long, ByRef pati As ALTTABINFO, ByVal pszItemText As LPSTR, ByVal cchItemText As DWord) As BOOL
#endif ' !UNICODE
