home *** CD-ROM | disk | FTP | other *** search
- /*
- USEROBJ.H -- USER-related structures
-
- Local object types:
- CLASS
- WND
- MENU
- ITEM
- PROPERTY
- DCE
-
- from Chapter 6 of "Undocumented Windows" (Addison-Wesley, 1992)
- by Andrew Schulman, Dave Maxey and Matt Pietrek.
-
- Copyright (c) Dave Maxey 1992
- */
-
- #ifdef __cplusplus
- extern "C" {
- #endif
-
- #define CLASS_MAGIC 0x4B4E // NK
- #define MENU_MAGIC 0x554D // MU
-
-
- /* === UNDOCUMENTED STRUCTURES === */
-
- // Window class structure held in USER's near heap
-
- typedef struct {
- HANDLE hcNext; // 00h Next entry in the class linked list
- WORD wSig; // 02h Should contain 0x4b4e ("NK")
- ATOM atomCls; // 04h Atom for class name string (USER heap)
- HANDLE hDCE; // 06h Handle to DCE when CS_CLASSDC, or NULL
- WORD cClsWnds; // 08h Count of windows with this class
- WNDCLASS wc; // 0Ah Incomplete copy from RegisterClass
- WORD eExtra[1]; // 24h Class extra user data from here
- } CLASS, NEAR * HCLASS;
-
- // Window structure for 3.0 held in USER's local heap
-
- typedef struct {
- HWND hwndNext; // 00h Next in top level window linked list
- HWND hwndChild; // 02h first child window
- HCLASS hClass; // 04h Class info for this window
- HANDLE hProp; // 06h Handle of property list
- HWND hwndLastActive; // 08h hwnd of last active popup
- HANDLE hScroll; // 0Ah USER local handle - used for scrolling?
- HANDLE hmemTaskQ; // 0Ch Window task/application message queue
- HRGN hrgnUpdate; // 0Eh Current invalid region for window
- HANDLE hDCE; // 10h handle to DCE when CS_OWNDC, or NULL
- HMENU hmenuSystem; // 12h System menu handle
- HWND hwndOwner; // 14h Owning application window
- RECT rectWindow; // 16h Non-client window coordinates
- RECT rectClient; // 1Eh Client window coordinates
- HPALETTE hPalette; // 26h Logical palette to be used during paint
- WORD wFlags; // 28h bits 9/10 used in WM_USER+260 drag/drop
- DWORD rgfExStyle; // 2Ah
- DWORD rgfStyle; // 2Eh
- WORD wID_Menu; // 32h ID if control otherwise menu handle
- HANDLE hText; // 34h handle of window text in text heap
- HWND hwndParent; // 36h for child windows
- HANDLE hInstance; // 38h application instance handle
- FARPROC lpfnWndProc; // 3Ah ProcInstance of WndProc for window
- // 3Eh user data area (array size >= 0 )
- } WND_3_0 /* , NEAR * HWND */ ;
-
-
- // Window structure for 3.1 held in USER's local heap
- // Note that, for no apparent reason, all fields in the structure
- // apart from the first two, which provide navigation through the
- // window hierarchy, have changed position, including those accessible
- // by GetWindowWord/GetWindowLong.
-
- typedef struct {
- HWND hwndNext; // 00h Next in top level window linked list
- HWND hwndChild; // 02h first child window
- HWND hwndParent; // 04h
- HWND hwndOwner; // 06h for child windows
- RECT rectWindow; // 08h Non-client window coordinates
- RECT rectClient; // 10h Client window coordinates
- HANDLE hmemTaskQ; // 18h Window task/application message queue
- HRGN hrgnUpdate; // 1Ah
- HCLASS hClass; // 1Ch Class info for this window
- HANDLE hInstance; // 1Eh application instance handle
- FARPROC lpfnWndProc; // 20h ProcInstance of WndProc for window
- DWORD dwFlags; // 24h
- DWORD rgfStyle; // 28h
- DWORD rgfExStyle; // 2Ch
- WORD wID_Menu; // 30h ID if control otherwise menu handle
- HWND hText; // 32h handle of window text in text heap
- HANDLE hScroll; // 34h USER local handle used for scrolling
- HANDLE hProp; // 36h handle of property list
- HWND hwndLastActive; // 38h hwnd of last active popup
- HMENU hmenuSystem; // 3Ah System menu handle
- // 3Ch user data area
- } WND_3_1 /* , NEAR * HWND */ ;
-
-
- // Menu item substructure valid for 3.0 and 3.1
- typedef struct {
- WORD wFlags; // 00h Flags
- WORD hIDorPopup; // 02h Item ID or popup menu handle
- RECT rectCapture; // 04h Item area in screen coords.
- WORD xTab; // 0Ch tab position in string
- HANDLE hCheckedBmp; // 0Eh Bitmap to use for checked
- HANDLE hUncheckedBmp; // 10h Bitmap to use for unchecked
- HANDLE hStrOrBmp; // 12h Handle to string or bitmap
- WORD xULStart; // 14h Start of underline
- WORD cxULLen; // 16h Length of underline (== width of char)
- WORD cbItemLen; // 18h Length of item if string or NULL
- } ITEM, FAR *LPITEM; // 1Ah Total
-
-
- // Menu structure
- typedef struct {
- WORD wFlags; // 00h flags
- WORD iCurrSel; // 02h Currently selected item or -1
- WORD iCurrPopup; // 04h Current popup or -1 if curr not popup
- WORD cbMenu; // 06h Size of this structure + items
- WORD cxWidth; // 08h Menu width in pixels
- WORD cyHeight; // 0Ah Menu height in pixels
- WORD cItems; // 0Ch Count of items following
- HWND hwndOwner; // 0Eh Owning window
- // 10h start of array of ITEMs
- } MENU_3_0 /* , *HMENU */ ;
-
-
- typedef struct {
- HMENU hmenuNext; // 00h Next in linked list of menus
- WORD wFlags; // 02h flags
- WORD wMagic; // 04h Signature/magic (0x554D == 'MU')
- HANDLE hTaskQ; // 06h Owning task queue handle ???
- WORD cxWidth; // 08h Width (0 if Sys Menu box)
- WORD cyHeight; // 0Ah Height (0 if Sys Menu box)
- WORD cItems; // 0Ch Count of items
- HWND hwndOwner; // 0Eh Owning window
- HANDLE hItems; // 10h hItems
- WORD w12; // 12h ??? (Usually 0)
- // 14h Total
- } MENU_3_1 /* , *HMENU */ ;
-
- typedef void FAR *LPMENU;
-
-
-
- // Window Properties structures
- typedef struct {
- ATOM atomID; // 00h Atom containing property identifier
- HANDLE hData; // 02h User supplied data handle
- WORD wFlags; // 04h Flags:
- } PROPERTY; // 0x000B = Always set...
- // 0x0010 = Internal property
- // 0x0100 = Identifier was string
- // not atom
-
-
- typedef struct {
- WORD cProps; // 00h Count of properties in array at 02h
- // 02h Start of array of PROPERTY structures
- } PROPLIST;
-
-
-
-
- // USER DC Entry structure
- typedef struct {
- HANDLE hdceNext; // 00h Next in linked list of DCEs
- HWND hwnd; // 02h Currently owning window
- HDC hDC; // 04h HDC that this entry refers to
- BYTE byFlags; // 06h Flags:
- // 0x01 - For client area use
- // 0x02 - For window area use
- // Others ???
- BYTE byInUse; // 07h 0 = free, 1 = in use
- BYTE byDirty; // 08h 1 = window needs update, 0 = does not
- BYTE by0A; // 09h ???
- WORD xOrigin; // 0Ah DC Origin X
- WORD yOrigin; // 0Ch DC Origin Y
- HWND hwndTop; // 0Eh Parent window (also using this entry?)
- HRGN hVisRgn; // 10h Visible region
- } DCE, *HDCE; // 12h TOTAL
-
-
- #ifdef __cplusplus
- }
- #endif
-