// Window.h #define _WINDOW_LIB 1 #define WM_USER 0x0400 #define WS_OVERLAPPED 0x00000000 #define WS_POPUP 0x80000000 #define WS_CHILD 0x40000000 #define WS_MINIMIZE 0x20000000 #define WS_VISIBLE 0x10000000 #define WS_DISABLED 0x08000000 #define WS_CLIPSIBLINGS 0x04000000 #define WS_CLIPCHILDREN 0x02000000 #define WS_MAXIMIZE 0x01000000 #define WS_CAPTION 0x00C00000 /* WS_BORDER | WS_DLGFRAME */ #define WS_BORDER 0x00800000 #define WS_DLGFRAME 0x00400000 #define WS_VSCROLL 0x00200000 #define WS_HSCROLL 0x00100000 #define WS_SYSMENU 0x00080000 #define WS_THICKFRAME 0x00040000 #define WS_GROUP 0x00020000 #define WS_TABSTOP 0x00010000 #define WS_MINIMIZEBOX 0x00020000 #define WS_MAXIMIZEBOX 0x00010000 #define WS_TILED WS_OVERLAPPED #define WS_ICONIC WS_MINIMIZE #define WS_SIZEBOX WS_THICKFRAME /* Common Window Styles */ #define WS_OVERLAPPEDWINDOW (WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX) #define WS_POPUPWINDOW (WS_POPUP | WS_BORDER | WS_SYSMENU) #define WS_CHILDWINDOW (WS_CHILD) #define WS_TILEDWINDOW (WS_OVERLAPPEDWINDOW) /* Extended Window Styles */ #define WS_EX_DLGMODALFRAME 0x1 #define WS_EX_NOPARENTNOTIFY 0x4 #define CW_USEDEFAULT 0x8000 /* Button Control Styles */ #define BS_PUSHBUTTON 0x00 #define BS_DEFPUSHBUTTON 0x01 #define BS_CHECKBOX 0x02 #define BS_AUTOCHECKBOX 0x03 #define BS_RADIOBUTTON 0x04 #define BS_3STATE 0x05 #define BS_AUTO3STATE 0x06 #define BS_GROUPBOX 0x07 #define BS_USERBUTTON 0x08 #define BS_AUTORADIOBUTTON 0x09 #define BS_PUSHBOX 0x0A #define BS_OWNERDRAW 0x0B #define BS_LEFTTEXT 0x20 /* Dialog Styles */ #define DS_ABSALIGN 0x01 #define DS_SYSMODAL 0x02 #define DS_LOCALEDIT 0x20 // Edit items get Local storage. #define DS_SETFONT 0x40 // User specified font for Dlg controls #define DS_MODALFRAME 0x80 // Can be combined with WS_CAPTION #define DS_NOIDLEMSG 0x100 // WM_ENTERIDLE message will not be sent /* Static Control Constants */ #define SS_LEFT 0x00 #define SS_CENTER 0x01 #define SS_RIGHT 0x02 #define SS_ICON 0x03 #define SS_BLACKRECT 0x04 #define SS_GRAYRECT 0x05 #define SS_WHITERECT 0x06 #define SS_BLACKFRAME 0x07 #define SS_GRAYFRAME 0x08 #define SS_WHITEFRAME 0x09 #define SS_USERITEM 0x0A #define SS_SIMPLE 0x0B #define SS_LEFTNOWORDWRAP 0x0C #define SS_NOPREFIX 0x80 /* Don't do "&" character translation */ /* Edit Control Styles */ #define ES_LEFT 0x0000 #define ES_CENTER 0x0001 #define ES_RIGHT 0x0002 #define ES_MULTILINE 0x0004 #define ES_UPPERCASE 0x0008 #define ES_LOWERCASE 0x0010 #define ES_PASSWORD 0x0020 #define ES_AUTOVSCROLL 0x0040 #define ES_AUTOHSCROLL 0x0080 #define ES_NOHIDESEL 0x0100 #define ES_OEMCONVERT 0x0400 /* Edit Control Notification Codes */ #define EN_SETFOCUS 0x0100 #define EN_KILLFOCUS 0x0200 #define EN_CHANGE 0x0300 #define EN_UPDATE 0x0400 #define EN_ERRSPACE 0x0500 #define EN_MAXTEXT 0x0501 #define EN_HSCROLL 0x0601 #define EN_VSCROLL 0x0602 /* GetWindow() Constants */ #define GW_HWNDFIRST 0 #define GW_HWNDLAST 1 #define GW_HWNDNEXT 2 #define GW_HWNDPREV 3 #define GW_OWNER 4 #define GW_CHILD 5 /* User Button Notification Codes */ #define BN_CLICKED 0 #define BN_PAINT 1 #define BN_HILITE 2 #define BN_UNHILITE 3 #define BN_DISABLE 4 #define BN_DOUBLECLICKED 5 /* Button Control Messages */ #define BM_GETCHECK (WM_USER+0) #define BM_SETCHECK (WM_USER+1) #define BM_GETSTATE (WM_USER+2) #define BM_SETSTATE (WM_USER+3) #define BM_SETSTYLE (WM_USER+4) GetDC(hwnd) { return DynamicLink("USER","GETDC",SWORD16,PASCAL,hwnd); } ReleaseDC(hwnd,hdc) { return DynamicLink("USER","RELEASEDC",SWORD16,PASCAL,hwnd,hdc); } GetStockObject(Index) { #define WHITE_BRUSH 0 #define LTGRAY_BRUSH 1 #define GRAY_BRUSH 2 #define DKGRAY_BRUSH 3 #define BLACK_BRUSH 4 #define NULL_BRUSH 5 #define HOLLOW_BRUSH NULL_BRUSH #define WHITE_PEN 6 #define BLACK_PEN 7 #define NULL_PEN 8 #define OEM_FIXED_FONT 10 #define ANSI_FIXED_FONT 11 #define ANSI_VAR_FONT 12 #define SYSTEM_FONT 13 #define DEVICE_DEFAULT_FONT 14 #define DEFAULT_PALETTE 15 #define SYSTEM_FIXED_FONT 16 return DynamicLink("GDI","GETSTOCKOBJECT",SWORD16,PASCAL,Index); } SelectObject(hDc,hObject) { return DynamicLink("GDI","SELECTOBJECT",SWORD16,PASCAL,hDc,hObject); } GetTextMetrics(hdc,Metrics) { // Return structure with the following member fields // Height Total character height (ascent _ descent) // Ascent units above baseline // Descent units below baseline // InternalLeading space in character for accents // ExternalLeading space between rows // AveCharWidth average character width // MaxCharWidth width of widest character // Weight // Italic italic font if non-zero // Underlined underlined font if non-zero // StruckOut struckout font if non-zero // FirstChar value of first character in this font // LastChar value of last characte in this font // DefaultChar character to substitute for chars not in font // BreakChar character for word breaks and text justification // PitchAndFamily lowest bit set for variable pitch; 0xF0 bits are family // CharSet character set of the font // Overhang per-string extra width // DigitizedAspectX horizontal aspect // DigitizedAspectY vertical aspect; aspect ratio is X/Y BLObSize(_gtm,31); if ( _ret = DynamicLink("GDI","GETTEXTMETRICS",SWORD16,PASCAL,hdc,_gtm) ) { Metrics.Height = BLObGet(_gtm,0,SWORD16); Metrics.Ascent = BLObGet(_gtm,2,SWORD16); Metrics.Descent = BLObGet(_gtm,4,SWORD16); Metrics.InternalLeading = BLObGet(_gtm,6,SWORD16); Metrics.ExternalLeading = BLObGet(_gtm,8,SWORD16); Metrics.AveCharWidth = BLObGet(_gtm,10,SWORD16); Metrics.MaxCharWidth = BLObGet(_gtm,12,SWORD16); Metrics.Weight = BLObGet(_gtm,14,SWORD16); Metrics.Italic = BLObGet(_gtm,16,UWORD8); Metrics.Underlined = BLObGet(_gtm,17,UWORD8); Metrics.StruckOut = BLObGet(_gtm,18,UWORD8); Metrics.FirstChar = BLObGet(_gtm,19,UWORD8); Metrics.LastChar = BLObGet(_gtm,20,UWORD8); Metrics.DefaultChar = BLObGet(_gtm,21,UWORD8); Metrics.BreakChar = BLObGet(_gtm,22,UWORD8); Metrics.PitchAndFamily = BLObGet(_gtm,23,UWORD8); Metrics.CharSet = BLObGet(_gtm,24,UWORD8); Metrics.Overhang = BLObGet(_gtm,25,SWORD16); Metrics.DigitizedAspectX= BLObGet(_gtm,27,SWORD16); Metrics.DigitizedAspectY= BLObGet(_gtm,29,SWORD16); } return(_ret); } GetWindow(hwnd,Cmd) { return DynamicLink("USER","GETWINDOW",SWORD16,PASCAL,hwnd,Cmd); }