REFERENCE GUIDE BORLAND Windows API Guide Reference Volume 2 Version 3.0 for the MS-DOS and PC-DOS Operating Systems BORLAND INTERNATIONAL INC. 1800 GREEN HILLS ROAD P.O. BOX 660001, SCOTTS VALLEY, CA 95067-0001 Copyright © 1991 by Borland International. All rights reserved. All Borland products are trademarks or registered trademarks of Borland International, Inc. Other brand and product names are trademarks or registered trademarks of their respective holders. PRINTED IN THE USA. Rl 109876543 c o s N T E N T Introduction 1 DCB ............................... 25 Document conventions ................ 2 Communications device control block . 25 DELETEITEMSTRUCT ............... 28 Part 3 General reference Deleted owner-draw list-box item .... 28 Chapter 7 Data types and structures 7 DEVMODE ......................... 29 Printer driver initialization Data types ........................... 7 information ....................... 29 Data structures ....................... 9 DLGTEMPLATE ..................... 32 BITMAP ............................ 10 Dialog template. . . . . . . . . . . . . . . . . . .. 32 Bitmap data structure .............. 10 Header data structure .............. 32 BITMAPCOREHEADER . . . . . . . . . . . . .. 11 Font-information data structure . . . . .. 34 Device-independent bitmap format DRAW ITEMSTRUCT ................ 36 information ....................... 11 Owner-draw control drawing BITMAPCOREINFO ................. 12 information ....................... 36 Device-independent bitmap HANDLETABLE .................... 38 informa tion ....................... 12 Window-handle table .............. 38 BITMAPFILEHEADER ............... 14 LOGBRUSH . . . . . . . . . . . . . . . . . . . . . . . .. 38 Bitmap file information ............. 14 Logical-brush attribute information .. 38 BITMAPINFO . . . . . . . . . . . . . . . . . . . . . .. 14 LOGFONT .......................... 40 ~evice-i~dependent bitmap Logical-font descriptor ............. 40 InformatIOn ....................... 14 LOGPA LETTE ...................... 43 BITMAPINFOHEADER .............. 16 Logical color palette information ..... 43 Device-independent bitmap format LOGPEN ........................... 44 information ....................... 16 Logical-pen attribute information .... 44 CLIENTCREATESTRUCT . . . . . . . . . . . .. 20 MDICREATESTRUCT ................ 45 MDI client window creation structure . 20 Mdi child window creation structure . 45 COLORREF .. . . . . . . . . . . . . . . . . . . . . . .. 20 MEASUREITEMSTRUCT ............. 46 Color specification ................. 20 Owner-draw control dimensions . . . .. 46 Palette-relative rgb ................. 21 MENUITEMTEMPLATE .............. 47 COMPA REITEMSTRUCT . . . . . . . . . . . .. 22 Menu-itemtemplate ................ 47 Owner-draw item-sorting information. 22 METAFILEPICT ..................... 49 COMSTAT .......................... 23 Metafile picture structure ........... 49 Communication device status ....... 23 MSG ............................... 50 CREATESTRUCT .................... 24 Message data structure ............. 50 Window-creation structure . . . . . . . . .. 24 MULTIKEYHELP . . . . . . . . . . . . . . . . . . .. 50 Windows help key word table CTEXT ........................... 82 structure . . . . . . . . . . . . . . . . . . . . . . . . .. 50 CHECKBOX ...................... 83 OFSTRUCT ......................... 51 PUSHBUTTON . . . . . . . . . . . . . . . . . . .. 84 Open-file structure .. . . . . . . . . . . . . . .. 51 LISTBOX ......................... 85 P AINTSTRUCT . . . . . . . . . . . . . . . . . . . . .. 52 GROUPBOX ...................... 86 WINDOWS paint information ....... 52 DEFPUSHBUTTON ................ 87 P ALETTEENTRY .................... 52 RADIOBUTTON . . . . . . . . . . . . . . . . . .. 88 Logical palette color entry ........... 52 EDITTEXT . . . . . . . . . . . . . . . . . . . . . . .. 89 POINT ............................. 54 COMBO BOX . . . . . . . . . . . . . . . . . . . . .. 91 Point data structure ................ 54 ICON ............................ 92 RECT .............................. 54 SCROLL BAR . . . . . . . . . . . . . . . . . . . . .. 93 Rectangle data structure ............ 54 CONTROL ........................ 94 RGBQUAD ......................... 55 Directives. . . . . . . . . . . . . . . . . . . . . . . . .. 103 Rgb color structure . . . . . . . . . . . . . . . .. 55 #include statement ................ 103 RGBTRIPLE . . . . . . . . . . . . . . . . . . . . . . . .. 55 #define statement ................. 103 Rgb color structure . . . . . . . . . . . . . . . .. 55 #Undef statement ................. 104 TEXTMETRIC ....................... 56 #ifdef statement .................. 104 Basic font metrics .................. 56 #ifndef statement ................. 105 WNDCLASS ........................ 58 #if statement ..................... 105 Window class data structure . . . . . . . .. 58 #elif statement ................... 106 #else statement ................... 106 Chapter 8 Resource script #endif statement .................. 107 statements 61 Single-line statements ................ 61 Chapter 9 File formats 109 User-defined resources ............... 63 Bitmap file formats . . . . . . . . . . . . . . . . .. 109 Rcdata statement .................... 64 Icon resource file format ............. 110 Stringtable statement ... . . . . . . . . . . . . .. 65 Cursor resource file format . . . . . . . . . .. 111 Accelerators statement ................ 67 Clipboard file format ................ 113 Menu statement ..................... 68 Metafile format ..................... 113 Item-definition statements .......... 70 Metafile header . . . . . . . . . . . . . . . . . .. 114 MENUITEM ...................... 70 Metafile records .................. 115 POPUP ........................... 71 Typical metafile record .......... 116 MENUITEMSEPARATOR .......... 73 Function-specific records. . . . . . . .. 116 DIALOG statement. . . . . . . . . . . . . . . . . .. 73 AnimatePalette record 3.0 ........ 117 Dialog option statements . . . . . . . . . . .. 75 BitBlt record (prior to 3.0) ........ 117 STYLE ............................ 75 BitBlt record 3.0 . . . . . . . . . . . . . . . .. 118 CAPTION ........................ 77 CreateBrushIndirect record. . . . . .. 118 MENU ........................... 78 CreateFontIndirect record . . . . . . .. 119 CLASS ........................... 78 CreatePalette record 3.0 . . . . . . . . .. 119 FONT ............................ 79 CreatePatternBrush record (prior to Dialog control statements ........... 79 3.0) ........................... 119 LTEXT ........................... 80 CreatePatternBrush record 3.0 .... 120 RTEXT ........................... 81 CreatePenIndirect record ........ 121 ii Create region record ............. 121 CLIP_ TO_PATH .................... 157 DeleteObject 3.0 ................ 122 DEVICE DATA ..................... 158 DrawText record ................ 122 DRAFTMODE .. .. . .. . .. . . . . . . . . . ... 158 Escape record .................. 122 DRAWPATTERNRECT .............. 158 ExtTextOut record .............. 123 ENABLEDUPLEX . . . . . . . . . . . . . . . . . .. 160 Polygon record ................. 124 ENABLEP AIRKERNING ............ 160 PolyP olygon record ............. 124 ENABLERELATIVEWIDTHS ......... 161 Polyline record ................. 125 ENDDOC .......................... 162 SelectClipRegion ................ 125 END_PATH ........................ 162 SelectObject .................... 125 ENUMPAPERBINS ................. 164 SelectPalette record 3.0 .......... 126 ENUMPAPERMETRICS ............. 165 SetDIBitsToDevice record 3.0 ..... 126 EPSPRINTING ..................... 166 SetPaletteEntries record 3.0 . . . . . .. 127 EXT_DEVICE_CAPS ................ 166 StretchBlt record (prior to 3.0) .... 127 EXTTEXTOUT ...................... 168 StretchBlt record 3.0 ............. 128 FLUSHOUTPUT .. . .. .. . . .. .. .. . . . .. 169 StretchDIBits record 3.0 .. . . . . . . .. 129 GETCOLORTABLE ................. 169 TextOut record ................. 130 GETEXTENDEDTEXTMETRICS ...... 170 Sample metafile program output .... 130 GETEXTENTTA BLE ................ 173 Summary .......................... 132 GETFACENAME ................... 174 GETPAIRKERNTABLE .............. 174 Chapter 10 Module-definition GETPHYSPAGESIZE ................ 176 statements 133 GETPRINTINGOFFSET . . . . . . . . . . . . .. 176 CODE ............................. 134 GETSCALINGFACTOR ............. 176 DATA ............................. 134 GETSETP APERBINS ................ 177 DESCRIPTION ..................... 135 GETSETPAPERMETRICS ............ 178 EXETYPE .......................... 136 GETSETP APERORIENT ........ . . . .. 179 EXPORTS .......................... 136 GETSETSCREENPARAMS ........... 180 HEAPSIZE . . . . . . . . . . . . . . . . . . . . . . . .. 137 GETTECHNOLOGY ................ 181 IMPORTS .. .. . .. . .. . .. .. .. .. .. .. ... 138 GETTRACKKERNTABLE . . . . . . . . . . .. 181 LIBRARY .......................... 139 GETVECTORBRUSHSIZE ........... 182 NAME ............................ 139 GETVECTORPENSIZE .............. 183 SEGMENTS .. . .. . .. . .. .. .. .. .. .. ... 140 MFCOMMENT . . . . . . . . . . . . . . . . . . . .. 183 STACKSIZE ........................ 141 NEWFRAME .. .. . .. . .. . .. . .. . . . . ... 184 STUB .............................. 141 NEXTBAND ....................... 184 Chapter 11 Binary and ternary raster- PASSTHROUGH ................... 185 QUERYESCSUPPORT . . . . . . . . . . . . . .. 186 operation codes 143 RESTORE_CTM .................... 186 Binary raster operations ............. 143 SAVE_CTM ........................ 187 Ternary raster operations ............ 146 SELECTP APERSOURCE . . . . . . . . . . . .. 188 Chapter 12 Printer escapes 153 SETABORTPROC ................... 188 ABORTDOC ....................... 153 SETALLJUSTV ALUES . . . . . . . . . . . . . .. 189 BANDINFO .. .. .. . . .. . .. . . .. . .. .... 154 SET_ARC_DIRECTION . . . . . . . . . . . . .. 190 BEGIN_PATH ...................... 156 SET_BACKGROUND_COLOR ....... 191 iii SET_BOUNDS. . . . . . . . . . . . . . . . . . . . .. 191 Using shared memory objects ......... 208 SET_CLIP_BOX ..................... 192 Using clipboard formats ............. 208 SETCOLORTABLE .. .. . . .. .. . .. .. . .. 193 U sing the System topic .............. 208 SETCOPYCOUNT .................. 194 DDE message directory . . . . . . . . . . . . .. 209 SETKERNTRACK ................... 195 WM_DDE_ACK .................... 209 SETLINECAP ...................... 196 WM_DDE_ADVISE ................. 211 SETLINE]OIN ...................... 196 WM_DDE_DATA ................... 213 SET_MIRROR_MODE .. . . . . . . . . . . . .. 197 WM_DDE_EXECUTE ............... 214 SETMITERLIMIT ................... 198 WM_DDE_INITIATE . . . . . . . . . . . . . . .. 216 SET_POLY_MODE .................. 199 WM_DDE_POKE ................... 217 SET_SCREEN_ANGLE .............. 201 WM_DDE_REQUEST ............... 218 SET_SPREAD ...................... 201 WM_DDE_TERMINATE ............. 219 STARTDOC . . . . . . . . . . . . . . . . . . . . . . .. 202 WM_DDE_UNADVISE .............. 219 TRANSFORM_CTM ................ 203 Appendix A Virtual-key codes 221 Chapter 13 Windows DDE protocol Appendix B RC diagnostic definition 205 messages 225 Using the DDE message set ........... 206 Synchronizing the DDE conversation .. 206 Index 235 Using atoms ........................ 207 iv s T A B L E 8.1: Window styles .................... 75 11.2: Operation Indexes for PSo and 8.2: Control classes .................... 94 DPSoo ......................... 146 8.3: Control styles ..................... 96 11.3: Raster-operation codes ........... 147 9.1: Bit mask results .................. 112 12.1: Meaning of BANDINFOSTRUCT 9.2: GDI functions and values .......... 115 fields ........................... 155 11.1: Operation indexes for DPo and 13.1: DOE messages .................. 206 DPan .......................... 144 v vi o u c o N T R D T N This manual gives the Windows-application developer general as well as detailed information about Windows functions, messages, data types, Resource Compiler statements, assembly language macros, and file formats. This manual provides detailed descriptions of each component of the Windows application program interface (API) for readers who already have a basic understanding of Windows programming. This manual is divided into two volumes. Volume 1 contains reference information describing the Windows functions and messages. Volume 2 contains reference material for other components of the Windows API. It contains the following nine chapters and five appendixes: Chapter 7, "Data types and structures," contains a table of data types and an alphabetical list of structures found in Windows. Chapter 8, "Resource script statements," describes the statements that define resources which the Resource Compiler adds to an application's executable file. The statements are arranged according to functional groups. Chapter 9, File formats, describes the formats of five types of files: II II bitmap files, icon resource files, cursor resource files, clipboard files, and metafiles. Each description gives the general file structure and information about specific parts of the file. Chapter 10, "Module-definition statements, describes the statements II contained in the module-definition file that defines the application's contents and system requirements for the LINK program. Chapter 11, Binary and ternary raster-operation codes, describes the II II raster operations used for line output and those used for bitmap output. Chapter 12, "Printer escapes," lists the printer escapes that are available in Windows. Introduction