home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1994 #1 / monster.zip / monster / PROG_C / CENVIW9.ZIP / WINDOW.LIB < prev    next >
Text File  |  1994-03-08  |  13KB  |  378 lines

  1. // Window.lib - Common defines for creating and defining windows
  2. // ver.1        using the MakeWindow, BreakWindow, and DoWindows
  3. //              functions of CEnvi.
  4.  
  5. #define WM_USER            0x0400
  6.  
  7. #define WS_OVERLAPPED      0x00000000
  8. #define WS_POPUP           0x80000000
  9. #define WS_CHILD           0x40000000
  10. #define WS_MINIMIZE        0x20000000
  11. #define WS_VISIBLE         0x10000000
  12. #define WS_DISABLED        0x08000000
  13. #define WS_CLIPSIBLINGS    0x04000000
  14. #define WS_CLIPCHILDREN    0x02000000
  15. #define WS_MAXIMIZE        0x01000000
  16. #define WS_CAPTION         0x00C00000     /* WS_BORDER | WS_DLGFRAME  */
  17. #define WS_BORDER          0x00800000
  18. #define WS_DLGFRAME        0x00400000
  19. #define WS_VSCROLL         0x00200000
  20. #define WS_HSCROLL         0x00100000
  21. #define WS_SYSMENU         0x00080000
  22. #define WS_THICKFRAME      0x00040000
  23. #define WS_GROUP           0x00020000
  24. #define WS_TABSTOP         0x00010000
  25.  
  26. #define WS_MINIMIZEBOX     0x00020000
  27. #define WS_MAXIMIZEBOX     0x00010000
  28.  
  29. #define WS_TILED           WS_OVERLAPPED
  30. #define WS_ICONIC          WS_MINIMIZE
  31. #define WS_SIZEBOX         WS_THICKFRAME
  32.  
  33. /* Common Window Styles */
  34. #define WS_OVERLAPPEDWINDOW (WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX)
  35. #define WS_POPUPWINDOW     (WS_POPUP | WS_BORDER | WS_SYSMENU)
  36. #define WS_CHILDWINDOW     (WS_CHILD)
  37.  
  38. #define WS_TILEDWINDOW     (WS_OVERLAPPEDWINDOW)
  39.  
  40. /* Extended Window Styles */
  41. #define WS_EX_DLGMODALFRAME   0x1
  42. #define WS_EX_NOPARENTNOTIFY  0x4
  43.  
  44.  
  45. #define CW_USEDEFAULT   0x8000
  46.  
  47.  
  48. /* Button Control Styles */
  49. #define BS_PUSHBUTTON      0x00
  50. #define BS_DEFPUSHBUTTON   0x01
  51. #define BS_CHECKBOX        0x02
  52. #define BS_AUTOCHECKBOX    0x03
  53. #define BS_RADIOBUTTON     0x04
  54. #define BS_3STATE          0x05
  55. #define BS_AUTO3STATE      0x06
  56. #define BS_GROUPBOX        0x07
  57. #define BS_USERBUTTON      0x08
  58. #define BS_AUTORADIOBUTTON 0x09
  59. #define BS_PUSHBOX         0x0A
  60. #define BS_OWNERDRAW       0x0B
  61. #define BS_LEFTTEXT        0x20
  62.  
  63. /* Dialog Styles */
  64. #define DS_ABSALIGN     0x01
  65. #define DS_SYSMODAL     0x02
  66. #define DS_LOCALEDIT    0x20  // Edit items get Local storage.
  67. #define DS_SETFONT      0x40  // User specified font for Dlg controls
  68. #define DS_MODALFRAME   0x80  // Can be combined with WS_CAPTION
  69. #define DS_NOIDLEMSG    0x100 // WM_ENTERIDLE message will not be sent
  70.  
  71. /* Static Control Constants */
  72. #define SS_LEFT            0x00
  73. #define SS_CENTER          0x01
  74. #define SS_RIGHT           0x02
  75. #define SS_ICON            0x03
  76. #define SS_BLACKRECT       0x04
  77. #define SS_GRAYRECT        0x05
  78. #define SS_WHITERECT       0x06
  79. #define SS_BLACKFRAME      0x07
  80. #define SS_GRAYFRAME       0x08
  81. #define SS_WHITEFRAME      0x09
  82. #define SS_USERITEM        0x0A
  83. #define SS_SIMPLE          0x0B
  84. #define SS_LEFTNOWORDWRAP  0x0C
  85. #define SS_NOPREFIX        0x80    /* Don't do "&" character translation */
  86.  
  87. /* Edit Control Styles */
  88. #define ES_LEFT             0x0000
  89. #define ES_CENTER           0x0001
  90. #define ES_RIGHT            0x0002
  91. #define ES_MULTILINE        0x0004
  92. #define ES_UPPERCASE        0x0008
  93. #define ES_LOWERCASE        0x0010
  94. #define ES_PASSWORD         0x0020
  95. #define ES_AUTOVSCROLL      0x0040
  96. #define ES_AUTOHSCROLL      0x0080
  97. #define ES_NOHIDESEL        0x0100
  98. #define ES_OEMCONVERT       0x0400
  99.  
  100. /* Edit Control Notification Codes */
  101. #define EN_SETFOCUS         0x0100
  102. #define EN_KILLFOCUS        0x0200
  103. #define EN_CHANGE           0x0300
  104. #define EN_UPDATE           0x0400
  105. #define EN_ERRSPACE         0x0500
  106. #define EN_MAXTEXT          0x0501
  107. #define EN_HSCROLL          0x0601
  108. #define EN_VSCROLL          0x0602
  109.  
  110. /* GetWindow() Constants */
  111. #define GW_HWNDFIRST 0
  112. #define GW_HWNDLAST  1
  113. #define GW_HWNDNEXT  2
  114. #define GW_HWNDPREV  3
  115. #define GW_OWNER     4
  116. #define GW_CHILD     5
  117.  
  118. /* User Button Notification Codes */
  119. #define BN_CLICKED         0
  120. #define BN_PAINT           1
  121. #define BN_HILITE          2
  122. #define BN_UNHILITE        3
  123. #define BN_DISABLE         4
  124. #define BN_DOUBLECLICKED   5
  125.  
  126. /* Button Control Messages */
  127. #define BM_GETCHECK        (WM_USER+0)
  128. #define BM_SETCHECK        (WM_USER+1)
  129. #define BM_GETSTATE        (WM_USER+2)
  130. #define BM_SETSTATE        (WM_USER+3)
  131. #define BM_SETSTYLE        (WM_USER+4)
  132.  
  133. /* Listbox Styles */
  134. #define LBS_NOTIFY            0x0001
  135. #define LBS_SORT              0x0002
  136. #define LBS_NOREDRAW          0x0004
  137. #define LBS_MULTIPLESEL       0x0008
  138. #define LBS_OWNERDRAWFIXED    0x0010
  139. #define LBS_OWNERDRAWVARIABLE 0x0020
  140. #define LBS_HASSTRINGS        0x0040
  141. #define LBS_USETABSTOPS       0x0080
  142. #define LBS_NOINTEGRALHEIGHT  0x0100
  143. #define LBS_MULTICOLUMN       0x0200
  144. #define LBS_WANTKEYBOARDINPUT 0x0400
  145. #define LBS_EXTENDEDSEL       0x0800
  146. #define LBS_STANDARD          (LBS_NOTIFY | LBS_SORT | WS_VSCROLL | WS_BORDER)
  147.  
  148. /* Listbox messages */
  149. #define LB_ADDSTRING           (WM_USER+1)
  150. #define LB_INSERTSTRING        (WM_USER+2)
  151. #define LB_DELETESTRING        (WM_USER+3)
  152. #define LB_RESETCONTENT        (WM_USER+5)
  153. #define LB_SETSEL              (WM_USER+6)
  154. #define LB_SETCURSEL           (WM_USER+7)
  155. #define LB_GETSEL              (WM_USER+8)
  156. #define LB_GETCURSEL           (WM_USER+9)
  157. #define LB_GETTEXT             (WM_USER+10)
  158. #define LB_GETTEXTLEN          (WM_USER+11)
  159. #define LB_GETCOUNT            (WM_USER+12)
  160. #define LB_SELECTSTRING        (WM_USER+13)
  161. #define LB_DIR                 (WM_USER+14)
  162. #define LB_GETTOPINDEX         (WM_USER+15)
  163. #define LB_FINDSTRING          (WM_USER+16)
  164. #define LB_GETSELCOUNT         (WM_USER+17)
  165. #define LB_GETSELITEMS         (WM_USER+18)
  166. #define LB_SETTABSTOPS         (WM_USER+19)
  167. #define LB_GETHORIZONTALEXTENT (WM_USER+20)
  168. #define LB_SETHORIZONTALEXTENT (WM_USER+21)
  169. #define LB_SETCOLUMNWIDTH      (WM_USER+22)
  170. #define LB_SETTOPINDEX         (WM_USER+24)
  171. #define LB_GETITEMRECT         (WM_USER+25)
  172. #define LB_GETITEMDATA         (WM_USER+26)
  173. #define LB_SETITEMDATA         (WM_USER+27)
  174. #define LB_SELITEMRANGE        (WM_USER+28)
  175. #define LB_MSGMAX              (WM_USER+33)
  176.  
  177. /* Listbox Return Values */
  178. #define LB_OKAY      0
  179. #define LB_ERR       (-1)
  180. #define LB_ERRSPACE  (-2)
  181.  
  182. /* Combo Box styles */
  183. #define CBS_SIMPLE            0x0001
  184. #define CBS_DROPDOWN          0x0002
  185. #define CBS_DROPDOWNLIST      0x0003
  186. #define CBS_OWNERDRAWFIXED    0x0010
  187. #define CBS_OWNERDRAWVARIABLE 0x0020
  188. #define CBS_AUTOHSCROLL       0x0040
  189. #define CBS_OEMCONVERT        0x0080
  190. #define CBS_SORT              0x0100
  191. #define CBS_HASSTRINGS        0x0200
  192. #define CBS_NOINTEGRALHEIGHT  0x0400
  193.  
  194. /* Combo Box return Values */
  195. #define CB_OKAY             0
  196. #define CB_ERR              (-1)
  197. #define CB_ERRSPACE         (-2)
  198.  
  199. /* Combo Box Notification Codes */
  200. #define CBN_ERRSPACE        (-1)
  201. #define CBN_SELCHANGE       1
  202. #define CBN_DBLCLK          2
  203. #define CBN_SETFOCUS        3
  204. #define CBN_KILLFOCUS       4
  205. #define CBN_EDITCHANGE      5
  206. #define CBN_EDITUPDATE      6
  207. #define CBN_DROPDOWN        7
  208.  
  209. /* Combo Box messages */
  210. #define CB_GETEDITSEL            (WM_USER+0)
  211. #define CB_LIMITTEXT             (WM_USER+1)
  212. #define CB_SETEDITSEL            (WM_USER+2)
  213. #define CB_ADDSTRING             (WM_USER+3)
  214. #define CB_DELETESTRING          (WM_USER+4)
  215. #define CB_DIR                   (WM_USER+5)
  216. #define CB_GETCOUNT              (WM_USER+6)
  217. #define CB_GETCURSEL             (WM_USER+7)
  218. #define CB_GETLBTEXT             (WM_USER+8)
  219. #define CB_GETLBTEXTLEN          (WM_USER+9)
  220. #define CB_INSERTSTRING          (WM_USER+10)
  221. #define CB_RESETCONTENT          (WM_USER+11)
  222. #define CB_FINDSTRING            (WM_USER+12)
  223. #define CB_SELECTSTRING          (WM_USER+13)
  224. #define CB_SETCURSEL             (WM_USER+14)
  225. #define CB_SHOWDROPDOWN          (WM_USER+15)
  226. #define CB_GETITEMDATA           (WM_USER+16)
  227. #define CB_SETITEMDATA           (WM_USER+17)
  228. #define CB_GETDROPPEDCONTROLRECT (WM_USER+18)
  229.  
  230. /* Edit Control Messages */
  231. #define EM_GETSEL          (WM_USER+0)
  232. #define EM_SETSEL          (WM_USER+1)
  233. #define EM_GETRECT         (WM_USER+2)
  234. #define EM_SETRECT         (WM_USER+3)
  235. #define EM_SETRECTNP       (WM_USER+4)
  236. #define EM_SCROLL          (WM_USER+5)
  237. #define EM_LINESCROLL      (WM_USER+6)
  238. #define EM_GETMODIFY       (WM_USER+8)
  239. #define EM_SETMODIFY       (WM_USER+9)
  240. #define EM_GETLINECOUNT    (WM_USER+10)
  241. #define EM_LINEINDEX       (WM_USER+11)
  242. #define EM_SETHANDLE       (WM_USER+12)
  243. #define EM_GETHANDLE       (WM_USER+13)
  244. #define EM_GETTHUMB        (WM_USER+14)
  245. #define EM_LINELENGTH      (WM_USER+17)
  246. #define EM_REPLACESEL      (WM_USER+18)
  247. #define EM_SETFONT         (WM_USER+19)
  248. #define EM_GETLINE         (WM_USER+20)
  249. #define EM_LIMITTEXT       (WM_USER+21)
  250. #define EM_CANUNDO         (WM_USER+22)
  251. #define EM_UNDO            (WM_USER+23)
  252. #define EM_FMTLINES        (WM_USER+24)
  253. #define EM_LINEFROMCHAR    (WM_USER+25)
  254. #define EM_SETWORDBREAK    (WM_USER+26)
  255. #define EM_SETTABSTOPS     (WM_USER+27)
  256. #define EM_SETPASSWORDCHAR (WM_USER+28)
  257. #define EM_EMPTYUNDOBUFFER (WM_USER+29)
  258.  
  259. GetDC(hwnd)
  260. {
  261.    return DynamicLink("USER","GETDC",SWORD16,PASCAL,hwnd);
  262. }
  263.  
  264. ReleaseDC(hwnd,hdc)
  265. {
  266.    return DynamicLink("USER","RELEASEDC",SWORD16,PASCAL,hwnd,hdc);
  267. }
  268.  
  269. GetStockObject(Index)
  270. {
  271.    #define WHITE_BRUSH           0
  272.    #define LTGRAY_BRUSH          1
  273.    #define GRAY_BRUSH            2
  274.    #define DKGRAY_BRUSH          3
  275.    #define BLACK_BRUSH           4
  276.    #define NULL_BRUSH            5
  277.    #define HOLLOW_BRUSH          NULL_BRUSH
  278.    #define WHITE_PEN             6
  279.    #define BLACK_PEN             7
  280.    #define NULL_PEN              8
  281.    #define OEM_FIXED_FONT        10
  282.    #define ANSI_FIXED_FONT       11
  283.    #define ANSI_VAR_FONT         12
  284.    #define SYSTEM_FONT           13
  285.    #define DEVICE_DEFAULT_FONT   14
  286.    #define DEFAULT_PALETTE       15
  287.    #define SYSTEM_FIXED_FONT     16
  288.    return DynamicLink("GDI","GETSTOCKOBJECT",SWORD16,PASCAL,Index);
  289. }
  290.  
  291. SelectObject(hDc,hObject)
  292. {
  293.    return DynamicLink("GDI","SELECTOBJECT",SWORD16,PASCAL,hDc,hObject);
  294. }
  295.  
  296. GetTextMetrics(hdc,Metrics)
  297. {
  298.    // Return structure with the following member fields
  299.    //    Height            Total character height (ascent _ descent)
  300.    //    Ascent            units above baseline
  301.    //    Descent           units below baseline
  302.    //    InternalLeading   space in character for accents
  303.    //    ExternalLeading   space between rows
  304.    //    AveCharWidth      average character width
  305.    //    MaxCharWidth      width of widest character
  306.    //    Weight
  307.    //    Italic            italic font if non-zero
  308.    //    Underlined        underlined font if non-zero
  309.    //    StruckOut         struckout font if non-zero
  310.    //    FirstChar         value of first character in this font
  311.    //    LastChar          value of last characte in this font
  312.    //    DefaultChar       character to substitute for chars not in font
  313.    //    BreakChar         character for word breaks and text justification
  314.    //    PitchAndFamily    lowest bit set for variable pitch; 0xF0 bits are family
  315.    //    CharSet           character set of the font
  316.    //    Overhang          per-string extra width
  317.    //    DigitizedAspectX  horizontal aspect
  318.    //    DigitizedAspectY  vertical aspect; aspect ratio is X/Y
  319.    BLObSize(_gtm,31);
  320.    if ( _ret = DynamicLink("GDI","GETTEXTMETRICS",SWORD16,PASCAL,hdc,_gtm) ) {
  321.       Metrics.Height          = BLObGet(_gtm,0,SWORD16);
  322.       Metrics.Ascent          = BLObGet(_gtm,2,SWORD16);
  323.       Metrics.Descent         = BLObGet(_gtm,4,SWORD16);
  324.       Metrics.InternalLeading = BLObGet(_gtm,6,SWORD16);
  325.       Metrics.ExternalLeading = BLObGet(_gtm,8,SWORD16);
  326.       Metrics.AveCharWidth    = BLObGet(_gtm,10,SWORD16);
  327.       Metrics.MaxCharWidth    = BLObGet(_gtm,12,SWORD16);
  328.       Metrics.Weight          = BLObGet(_gtm,14,SWORD16);
  329.       Metrics.Italic          = BLObGet(_gtm,16,UWORD8);
  330.       Metrics.Underlined      = BLObGet(_gtm,17,UWORD8);
  331.       Metrics.StruckOut       = BLObGet(_gtm,18,UWORD8);
  332.       Metrics.FirstChar       = BLObGet(_gtm,19,UWORD8);
  333.       Metrics.LastChar        = BLObGet(_gtm,20,UWORD8);
  334.       Metrics.DefaultChar     = BLObGet(_gtm,21,UWORD8);
  335.       Metrics.BreakChar       = BLObGet(_gtm,22,UWORD8);
  336.       Metrics.PitchAndFamily  = BLObGet(_gtm,23,UWORD8);
  337.       Metrics.CharSet         = BLObGet(_gtm,24,UWORD8);
  338.       Metrics.Overhang        = BLObGet(_gtm,25,SWORD16);
  339.       Metrics.DigitizedAspectX= BLObGet(_gtm,27,SWORD16);
  340.       Metrics.DigitizedAspectY= BLObGet(_gtm,29,SWORD16);
  341.    }
  342.    return(_ret);
  343. }
  344.  
  345. GetWindow(pHwnd,pCmd)
  346. {
  347.    return DynamicLink("USER","GETWINDOW",SWORD16,PASCAL,pHwnd,pCmd);
  348. }
  349.  
  350. #define GWL_WNDPROC         (-4)
  351. #define GWW_HINSTANCE       (-6)
  352. #define GWW_HWNDPARENT      (-8)
  353. #define GWW_ID              (-12)
  354. #define GWL_STYLE           (-16)
  355. #define GWL_EXSTYLE         (-20)
  356.  
  357. GetWindowWord(pHwnd,pIndex)
  358. {
  359.    return DynamicLink("USER","GETWINDOWWORD",UWORD16,PASCAL,pHwnd,pIndex);
  360. }
  361.  
  362. SetWindowWord(pHwnd,pIndex,pWord)
  363. {
  364.    return DynamicLink("USER","SETWINDOWWORD",UWORD16,PASCAL,pHwnd,pIndex,pWord);
  365. }
  366.  
  367. GetWindowLong(pHwnd,pIndex)
  368. {
  369.    return DynamicLink("USER","GETWINDOWLONG",SWORD32,PASCAL,pHwnd,pIndex);
  370. }
  371.  
  372. SetWindowLong(pHwnd,pIndex,pLong)
  373. {
  374.    return DynamicLink("USER","SETWINDOWLONG",UWORD16,PASCAL,
  375.                       pHwnd,pIndex,pLong >> 16, pLong & 0xFFFF);
  376. }
  377.  
  378.