Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2697 lines
85 KiB

  1. /***************************************************************************/
  2. /* */
  3. /* USER.H - */
  4. /* */
  5. /* User's main include file. */
  6. /* */
  7. /***************************************************************************/
  8. #ifdef WOW
  9. #define NO_LOCALOBJ_TAGS
  10. #endif
  11. // If #defined, only 16 bits of the window extended style will be stored
  12. // in the window instance.
  13. //
  14. //#define WORDEXSTYLE
  15. // This magic definition ensures that HWND is declared as a near
  16. // pointer to our internal window data structure. See
  17. // the DECLARE_HANDLE macro in windows.h.
  18. //
  19. #define tagWND HWND__
  20. // substitute API names with the "I" internal names
  21. //
  22. #ifndef DEBUG
  23. #include "iuser.h"
  24. #endif
  25. #ifdef DEBUG
  26. #ifndef NO_REDEF_SENDMESSAGE
  27. #define SendMessage RevalSendMessage
  28. #endif
  29. #endif
  30. //***** Include standard headers...
  31. #define NOSOUND
  32. #define NOFONT
  33. #define NOKANJI
  34. #define LSTRING
  35. #define LFILEIO
  36. #define WIN31
  37. #define STRICT
  38. #include <windows.h>
  39. /* Structure types that occupy the USER Data Segment */
  40. #define ST_CLASS 1
  41. #define ST_WND 2
  42. #define ST_STRING 3
  43. #define ST_MENU 4
  44. #define ST_CLIP 5
  45. #define ST_CBOX 6
  46. #define ST_PALETTE 7
  47. #define ST_ED 8
  48. #define ST_BWL 9
  49. #define ST_OWNERDRAWMENU 10
  50. #define ST_SPB 11
  51. #define ST_CHECKPOINT 12
  52. #define ST_DCE 13
  53. #define ST_MWP 14
  54. #define ST_PROP 15
  55. #define ST_LBIV 16
  56. #define ST_MISC 17
  57. #define ST_ATOMS 18
  58. #define ST_LOCKINPUTSTATE 19
  59. #define ST_HOOKNODE 20
  60. #define ST_USERSEEUSERDOALLOC 21
  61. #define ST_HOTKEYLIST 22
  62. #define ST_POPUPMENU 23
  63. #define ST_HANDLETABLE 32 /* Defined by Kernel; We have no control */
  64. #define ST_FREE 0xFF
  65. #define CODESEG _based(_segname("_CODE"))
  66. #define INTDSSEG _based(_segname("_INTDS"))
  67. // Returns TRUE if currently executing app is 3.10 compatible
  68. //
  69. #define Is310Compat(hInstance) (LOWORD(GetExpWinVer(hInstance)) >= 0x30a)
  70. #define Is300Compat(hInstance) (LOWORD(GetExpWinVer(hInstance)) >= 0x300)
  71. #define VER 0x0300
  72. #define VER31 0x0310
  73. #define VER30 0x0300
  74. #define VER20 0x0201
  75. #define CR_CHAR 13
  76. #define ESC_CHAR 27
  77. #define SPACE_CHAR 32
  78. typedef HANDLE HQ;
  79. struct tagDCE;
  80. /* Window class structure */
  81. typedef struct tagCLS
  82. {
  83. /* NOTE: The order of the following fields is assumed. */
  84. struct tagCLS* pclsNext;
  85. WORD clsMagic;
  86. ATOM atomClassName;
  87. struct tagDCE* pdce; /* DCE * to DC associated with class */
  88. int cWndReferenceCount; /* The number of windows registered
  89. with this class */
  90. WORD style;
  91. WNDPROC lpfnWndProc;
  92. int cbclsExtra;
  93. int cbwndExtra;
  94. HMODULE hModule;
  95. HICON hIcon;
  96. HCURSOR hCursor;
  97. HBRUSH hbrBackground;
  98. LPSTR lpszMenuName;
  99. LPSTR lpszClassName;
  100. } CLS;
  101. typedef CLS *PCLS;
  102. typedef CLS far *LPCLS;
  103. typedef PCLS *PPCLS;
  104. #define CLS_MAGIC ('N' | ('K' << 8))
  105. struct tagPROPTABLE;
  106. /* Window instance structure */
  107. typedef struct tagWND
  108. {
  109. struct tagWND* hwndNext; /* 0x0000 Handle to the next window */
  110. struct tagWND* hwndChild; /* 0x0002 Handle to child */
  111. struct tagWND* hwndParent; /* 0x0004 Backpointer to the parent window. */
  112. struct tagWND* hwndOwner; /* 0x0006 Popup window owner field */
  113. RECT rcWindow; /* 0x0008 Window outer rectangle */
  114. RECT rcClient; /* 0x0010 Client rectangle */
  115. HQ hq; /* 0x0018 Queue handle */
  116. HRGN hrgnUpdate; /* 0x001a Accumulated paint region */
  117. struct tagCLS* pcls; /* 0x001c Pointer to window class */
  118. HINSTANCE hInstance; /* 0x001e Handle to module instance data. */
  119. WNDPROC lpfnWndProc; /* 0x0020 Far pointer to window proc. */
  120. DWORD state; /* 0x0024 Internal state flags */
  121. DWORD style; /* 0x0028 Style flags */
  122. #ifdef WORDEXSTYLE
  123. WORD dwExStyle; /* 0x002c Extended Style (ONLY LOW 16 BITS STORED) */
  124. #else
  125. DWORD dwExStyle; /* 0x002c Extended Style */
  126. #endif
  127. HMENU hMenu; /* 0x0030 Menu handle or ID */
  128. HLOCAL hName; /* 0x0032 Alt DS handle of the window text */
  129. int* rgwScroll; /* 0x0034 Words used for scroll bar state */
  130. struct tagPROPTABLE* pproptab; /* 0x0036 Handle to the start of the property list */
  131. struct tagWND* hwndLastActive; /* 0x0038 Last active in owner/ownee list */
  132. HMENU hSysMenu; /* 0x003a Handle to system menu */
  133. } WND;
  134. #undef API
  135. #define API _loadds _far _pascal
  136. #undef CALLBACK
  137. #define CALLBACK _loadds _far _pascal
  138. #ifndef MSDWP
  139. #include <winexp.h>
  140. #include "strtable.h"
  141. #include "wmsyserr.h"
  142. #endif /* MSDWP */
  143. /*** AWESOME HACK ALERT!
  144. *
  145. * Window Style and State Masks -
  146. *
  147. * High byte of word is byte index from the start of the state field
  148. * in the WND structure, low byte is the mask to use on the byte.
  149. * These masks assume the order of the state and style fields of a
  150. * window instance structure.
  151. */
  152. // hwnd->state flags (offset 0, 1, 2, 3)
  153. #define WFMPRESENT 0x0001
  154. #define WFVPRESENT 0x0002
  155. #define WFHPRESENT 0x0004
  156. #define WFCPRESENT 0x0008
  157. #define WFSENDSIZEMOVE 0x0010
  158. #define WFNOPAINT 0x0020
  159. #define WFFRAMEON 0x0040
  160. #define WFHASSPB 0x0080
  161. #define WFNONCPAINT 0x0101
  162. #define WFSENDERASEBKGND 0x0102
  163. #define WFERASEBKGND 0x0104
  164. #define WFSENDNCPAINT 0x0108
  165. #define WFINTERNALPAINT 0x0110 // Internal paint required flag
  166. #define WFUPDATEDIRTY 0x0120
  167. #define WFHIDDENPOPUP 0x0140
  168. #define WFMENUDRAW 0x0180
  169. #define WFHASPALETTE 0x0201
  170. #define WFPAINTNOTPROCESSED 0x0202 // WM_PAINT message not processed
  171. #define WFWIN31COMPAT 0x0204 // Win 3.1 compatible window
  172. #define WFALWAYSSENDNCPAINT 0x0208 // Always send WM_NCPAINT to children
  173. #define WFPIXIEHACK 0x0210 // Send (HRGN)1 to WM_NCPAINT (see PixieHack)
  174. #define WFTOGGLETOPMOST 0x0220 // Toggle the WS_EX_TOPMOST bit ChangeStates
  175. // hwnd->style style bits (offsets 4, 5, 6, 7)
  176. #define WFTYPEMASK 0x07C0
  177. #define WFTILED 0x0700
  178. #define WFICONICPOPUP 0x07C0
  179. #define WFPOPUP 0x0780
  180. #define WFCHILD 0x0740
  181. #define WFMINIMIZED 0x0720
  182. #define WFVISIBLE 0x0710
  183. #define WFDISABLED 0x0708
  184. #define WFDISABLE WFDISABLED
  185. #define WFCLIPSIBLINGS 0x0704
  186. #define WFCLIPCHILDREN 0x0702
  187. #define WFMAXIMIZED 0x0701
  188. #define WFICONIC WFMINIMIZED
  189. #define WFMINBOX 0x0602
  190. #define WFMAXBOX 0x0601
  191. #define WFBORDERMASK 0x06C0
  192. #define WFBORDER 0x0680
  193. #define WFCAPTION 0x06C0
  194. #define WFDLGFRAME 0x0640
  195. #define WFTOPLEVEL 0x0640
  196. #define WFVSCROLL 0x0620
  197. #define WFHSCROLL 0x0610
  198. #define WFSYSMENU 0x0608
  199. #define WFSIZEBOX 0x0604
  200. #define WFGROUP 0x0602
  201. #define WFTABSTOP 0x0601
  202. // If this dlg bit is set, WM_ENTERIDLE message will not be sent
  203. #define WFNOIDLEMSG 0x0501
  204. // hwnd->dwExStyle extended style bits (offsets 8, 9)
  205. #define WEFDLGMODALFRAME 0x0801
  206. #define WEFDRAGOBJECT 0x0802
  207. #define WEFNOPARENTNOTIFY 0x0804
  208. #define WEFTOPMOST 0x0808
  209. #define WEFACCEPTFILES 0x0810
  210. #define WEFTRANSPARENT 0x0820 // "Transparent" child window
  211. // Class styles
  212. #define CFVREDRAW 0x0001
  213. #define CFHREDRAW 0x0002
  214. #define CFKANJIWINDOW 0x0004
  215. #define CFDBLCLKS 0x0008
  216. #define CFOEMCHARS 0x0010
  217. #define CFOWNDC 0x0020
  218. #define CFCLASSDC 0x0040
  219. #define CFPARENTDC 0x0080
  220. #define CFNOKEYCVT 0x0101
  221. #define CFNOCLOSE 0x0102
  222. #define CFLVB 0x0104
  223. #define CFCLSDC CFCLASSDC
  224. #define CFSAVEBITS 0x0108
  225. #define CFSAVEPOPUPBITS CFSAVEBITS
  226. #define CFBYTEALIGNCLIENT 0x0110
  227. #define CFBYTEALIGNWINDOW 0x0120
  228. /*** AWESOME HACK ALERT!!!
  229. *
  230. * The low byte of the WF?PRESENT state flags must NOT be the
  231. * same as the low byte of the WFBORDER and WFCAPTION flags,
  232. * since these are used as paint hint masks. The masks are calculated
  233. * with the MaskWF macro below.
  234. *
  235. * The magnitute of this hack compares favorably with that of the national debt.
  236. */
  237. #define TestWF(hwnd, flag) ((BYTE)*((BYTE *)(&(hwnd)->state) + HIBYTE(flag)) & (BYTE)LOBYTE(flag))
  238. #define SetWF(hwnd, flag) ((BYTE)*((BYTE *)(&(hwnd)->state) + HIBYTE(flag)) |= (BYTE)LOBYTE(flag))
  239. #define ClrWF(hwnd, flag) ((BYTE)*((BYTE *)(&(hwnd)->state) + HIBYTE(flag)) &= ~(BYTE)LOBYTE(flag))
  240. #define MaskWF(flag) ((WORD)( (HIBYTE(flag) & 1) ? LOBYTE(flag) << 8 : LOBYTE(flag)) )
  241. #define TestCF(hwnd, flag) (*((BYTE *)(&(hwnd)->pcls->style) + HIBYTE(flag)) & LOBYTE(flag))
  242. #define SetCF(hwnd, flag) (*((BYTE *)(&(hwnd)->pcls->style) + HIBYTE(flag)) |= LOBYTE(flag))
  243. #define ClrCF(hwnd, flag) (*((BYTE *)(&(hwnd)->pcls->style) + HIBYTE(flag)) &= ~LOBYTE(flag))
  244. #define TestCF2(pcls, flag) (*((BYTE *)(&pcls->style) + HIBYTE(flag)) & LOBYTE(flag))
  245. #define SetCF2(pcls, flag) (*((BYTE *)(&pcls->style) + HIBYTE(flag)) |= LOBYTE(flag))
  246. #define ClrCF2(pcls, flag) (*((BYTE *)(&pcls->style) + HIBYTE(flag)) &= ~LOBYTE(flag))
  247. #define TestwndChild(hwnd) (TestWF(hwnd, WFTYPEMASK) == (BYTE)LOBYTE(WFCHILD))
  248. #define TestwndTiled(hwnd) (TestWF(hwnd, WFTYPEMASK) == (BYTE)LOBYTE(WFTILED))
  249. #define TestwndIPopup(hwnd) (TestWF(hwnd, WFTYPEMASK) == (BYTE)LOBYTE(WFICONICPOPUP))
  250. #define TestwndNIPopup(hwnd) (TestWF(hwnd, WFTYPEMASK) == (BYTE)LOBYTE(WFPOPUP))
  251. #define TestwndPopup(hwnd) (TestwndNIPopup(hwnd) || TestwndIPopup(hwnd))
  252. #define TestwndHI(hwnd) (TestwndTiled(hwnd) || TestwndIPopup(hwnd))
  253. /* Special macro to test if WM_PAINT is needed */
  254. #define NEEDSPAINT(hwnd) (hwnd->hrgnUpdate != NULL || TestWF(hwnd, WFINTERNALPAINT))
  255. /* Areas to be painted during activation and inactivation */
  256. #define NC_DRAWNONE 0x00
  257. #define NC_DRAWCAPTION 0x01
  258. #define NC_DRAWFRAME 0x02
  259. #define NC_DRAWBOTH (NC_DRAWCAPTION | NC_DRAWFRAME)
  260. void FAR DrawCaption(HWND hwnd, HDC hdc, WORD flags, BOOL fActive);
  261. /* ActivateWindow() commands */
  262. #define AW_USE 1
  263. #define AW_TRY 2
  264. #define AW_SKIP 3
  265. #define AW_TRY2 4
  266. #define AW_SKIP2 5 /* used internally in ActivateWindow() */
  267. #define AW_USE2 6 /* nc mouse activation added by craigc */
  268. /* These numbers serve as indices into the atomSysClass[] array
  269. * so that we can get the atoms for the various classes.
  270. * The order of the control classes is assumed to be
  271. * the same as the class XXXCODE constants defined in dlgmgr.h.
  272. */
  273. #define ICLS_BUTTON 0
  274. #define ICLS_EDIT 1
  275. #define ICLS_STATIC 2
  276. #define ICLS_LISTBOX 3
  277. #define ICLS_SCROLLBAR 4
  278. #define ICLS_COMBOBOX 5 // End of special dlgmgr indices
  279. #define ICLS_CTL_MAX 6 // Number of public control classes
  280. #define ICLS_DESKTOP 6
  281. #define ICLS_DIALOG 7
  282. #define ICLS_MENU 8
  283. #define ICLS_SWITCH 9
  284. #define ICLS_ICONTITLE 10
  285. #define ICLS_MDICLIENT 11
  286. #define ICLS_COMBOLISTBOX 12
  287. #define ICLS_MAX 13 // Number of system classes
  288. // The following are the atom values for the atom-named public classes
  289. // NOTE: DIALOGCLASS at least should be in windows.h
  290. //
  291. #define MENUCLASS 0x8000 /* Public Knowledge */
  292. #define DESKTOPCLASS 0x8001
  293. #define DIALOGCLASS 0x8002
  294. #define SWITCHWNDCLASS 0x8003
  295. #define ICONTITLECLASS 0x8004
  296. /* Z Ordering() return values */
  297. #define ZO_ERROR (-1)
  298. #define ZO_EQUAL 0
  299. #define ZO_DISJOINT 1
  300. #define ZO_ABOVE 2
  301. #define ZO_BELOW 3
  302. #ifdef DEBUG
  303. #ifndef NO_LOCALOBJ_TAGS
  304. HANDLE FAR UserLocalAlloc(WORD, WORD, WORD);
  305. HANDLE FAR UserLocalFree(HANDLE);
  306. char* FAR UserLocalLock(HANDLE);
  307. BOOL FAR UserLocalUnlock(HANDLE);
  308. HANDLE FAR UserLocalReAlloc(HANDLE, WORD, WORD);
  309. WORD FAR UserLocalSize(HANDLE);
  310. #define LocalAlloc(A,B) UserLocalAlloc(ST_MISC,A,B)
  311. #define LocalFree UserLocalFree
  312. #define LocalLock UserLocalLock
  313. #define LocalUnlock UserLocalUnlock
  314. #define LocalReAlloc UserLocalReAlloc
  315. #define LocalSize UserLocalSize
  316. #endif
  317. #endif
  318. #ifndef DEBUG
  319. #define UserLocalAlloc(TagType,MemType,Size) LocalAlloc(MemType,Size)
  320. #else
  321. #ifdef NO_LOCALOBJ_TAGS
  322. #define UserLocalAlloc(TagType,MemType,Size) LocalAlloc(MemType,Size)
  323. #endif
  324. #endif
  325. #define XCOORD(l) ((int)LOWORD(l))
  326. #define YCOORD(l) ((int)HIWORD(l))
  327. #define abs(A) ((A < 0)? -A : A)
  328. /* CheckPoint structure */
  329. typedef struct tagCHECKPOINT
  330. {
  331. RECT rcNormal;
  332. POINT ptMin;
  333. POINT ptMax;
  334. HWND hwndTitle;
  335. WORD fDragged:1;
  336. WORD fWasMaximizedBeforeMinimized:1;
  337. WORD fWasMinimizedBeforeMaximized:1;
  338. WORD fParkAtTop:1;
  339. } CHECKPOINT;
  340. // Internal property name definitions
  341. #define CHECKPOINT_PROP_NAME "SysCP"
  342. extern ATOM atomCheckpointProp;
  343. #define WINDOWLIST_PROP_NAME "SysBW"
  344. extern ATOM atomBwlProp;
  345. #define InternalSetProp(hwnd, key, value, fInternal) SetProp(hwnd, key, value)
  346. #define InternalGetProp(hwnd, key, fInternal) GetProp(hwnd, key)
  347. #define InternalRemoveProp(hwnd, key, fInternal) RemoveProp(hwnd, key)
  348. #define InternalEnumProps(hwnd, pfn, fInternal) EnumProps(hwnd, pfn)
  349. /* Window List Structure */
  350. typedef struct tagBWL
  351. {
  352. struct tagBWL *pbwlNext;
  353. HWND *phwndMax;
  354. HWND rghwnd[1];
  355. } BWL;
  356. typedef BWL *PBWL;
  357. #define CHWND_BWLCREATE 32 // Initial BWL size
  358. #define CHWND_BWLGROW 16 // Amt to grow BWL by when it needs to grow.
  359. // BuildHwndList() commands
  360. #define BWL_ENUMCHILDREN 1
  361. #define BWL_ENUMLIST 2
  362. /* DOS Semaphore Structure */
  363. typedef struct tagSEMAPHORE
  364. {
  365. DWORD semaphore;
  366. HQ hqOwner;
  367. BYTE cBusy;
  368. BYTE bOrder;
  369. } SEMAPHORE;
  370. typedef SEMAPHORE FAR *LPSEM;
  371. #define CheckHwnd(hwnd) TRUE
  372. #define CheckHwndNull(hwnd) TRUE
  373. #define ValidateWindow(hwnd) TRUE
  374. #define ValidateWindowNull(hwnd) TRUE
  375. #define AllocP(wType,cb) UserLocalAlloc(wType,LPTR, cb)
  376. #define FreeP(h) LocalFree(h)
  377. #ifndef DEBUG
  378. #define LMHtoP(handle) (*((char**)(handle)))
  379. #else
  380. #ifdef NO_LOCALOBJ_TAGS
  381. #define LMHtoP(handle) (*((char**)(handle)))
  382. #else
  383. #define LMHtoP(handle) (*((char**)(handle))+sizeof(long))
  384. #endif
  385. #endif
  386. /* Evil nasty macros to work with movable local objects */
  387. #define LLock(handle) ((*(((BYTE *)(handle))+3))++)
  388. #define LUnlock(handle) ((*(((BYTE *)(handle))+3))--)
  389. #define dpHorzRes HORZRES
  390. #define dpVertRes VERTRES
  391. HWND WindowHitTest(HWND hwnd, POINT pt, int FAR* ppart);
  392. /*
  393. * If the handle for CF_TEXT/CF_OEMTEXT is a dummy handle then this implies
  394. * that data is available in the other format (as CF_OEMTEXT/CF_TEXT)
  395. */
  396. #define DUMMY_TEXT_HANDLE ((HANDLE)0xFFFF)
  397. #define DATA_NOT_BANKED ((HANDLE)0xFFFF)
  398. typedef struct tagCLIP
  399. {
  400. WORD fmt;
  401. HANDLE hData;
  402. } CLIP;
  403. typedef CLIP *PCLIP;
  404. extern CLIP* pClipboard;
  405. typedef struct tagSYSMSG
  406. {
  407. WORD message;
  408. WORD paramL;
  409. WORD paramH;
  410. DWORD time;
  411. } SYSMSG;
  412. typedef struct tagINTERNALSYSMSG
  413. {
  414. DWORD ismExtraInfo; /* Additional Info */
  415. SYSMSG ismOldMsg; /* External System Msg structure */
  416. } INTERNALSYSMSG;
  417. typedef struct tagINTERNALMSG
  418. {
  419. DWORD imExtraInfo; /* Additional Info */
  420. MSG imOldMsg; /* External App Msg structure */
  421. } INTERNALMSG;
  422. typedef struct tagTIMERINFO
  423. {
  424. LONG resolution;
  425. } TIMERINFO;
  426. typedef struct tagKBINFO
  427. {
  428. BYTE Begin_First_range; /* Values used for Far East systems */
  429. BYTE End_First_range;
  430. BYTE Begin_Second_range;
  431. BYTE End_Second_range;
  432. int stateSize; /* size of ToAscii()'s state block */
  433. } KBINFO;
  434. typedef struct tagMOUSEINFO
  435. {
  436. char fExist;
  437. char fRelative;
  438. int cButton;
  439. int cmsRate;
  440. int xThreshold;
  441. int yThreshold;
  442. int cxResolution; /* resolution needed for absolute mouse coordinate */
  443. int cyResolution;
  444. int mouseCommPort; /* comm port # to reserve since mouse is using it */
  445. } MOUSEINFO;
  446. typedef struct tagCURSORINFO
  447. {
  448. int csXRate;
  449. int csYRate;
  450. } CURSORINFO;
  451. typedef struct tagCURSORSHAPE
  452. {
  453. int xHotSpot;
  454. int yHotSpot;
  455. int cx;
  456. int cy;
  457. int cbWidth; /* Bytes per row, accounting for word alignment. */
  458. BYTE Planes;
  459. BYTE BitsPixel;
  460. } CURSORSHAPE;
  461. typedef CURSORSHAPE *PCURSORSHAPE;
  462. typedef CURSORSHAPE FAR * LPCURSORSHAPE;
  463. // Standard ICON dimensions;
  464. #define STD_ICONWIDTH 32
  465. #define STD_ICONHEIGHT 32
  466. #define STD_CURSORWIDTH 32
  467. #define STD_CURSORHEIGHT 32
  468. typedef struct tagICONINFO
  469. {
  470. int iIconCurrent;
  471. int fHeightChange;
  472. int crw; /* current nunber of rows. */
  473. int cIconInRow; /* maximum icons in a row. */
  474. int cIcon;
  475. int wEvent;
  476. } ICONINFO;
  477. /* Height and Width of the desktop pattern bitmap. */
  478. #define CXYDESKPATTERN 16
  479. /* System object colors. */
  480. #define CSYSCOLORS 21
  481. typedef struct tagSYSCLROBJECTS
  482. {
  483. HBRUSH hbrScrollbar;
  484. HBRUSH hbrDesktop;
  485. HBRUSH hbrActiveCaption;
  486. HBRUSH hbrInactiveCaption;
  487. HBRUSH hbrMenu;
  488. HBRUSH hbrWindow;
  489. HBRUSH hbrWindowFrame;
  490. HBRUSH hbrMenuText;
  491. HBRUSH hbrWindowText;
  492. HBRUSH hbrCaptionText;
  493. HBRUSH hbrActiveBorder;
  494. HBRUSH hbrInactiveBorder;
  495. HBRUSH hbrAppWorkspace;
  496. HBRUSH hbrHiliteBk;
  497. HBRUSH hbrHiliteText;
  498. HBRUSH hbrBtnFace;
  499. HBRUSH hbrBtnShadow;
  500. HBRUSH hbrGrayText;
  501. HBRUSH hbrBtnText;
  502. HBRUSH hbrInactiveCaptionText;
  503. HBRUSH hbrBtnHilite;
  504. } SYSCLROBJECTS;
  505. typedef struct tagSYSCOLORS
  506. {
  507. LONG clrScrollbar;
  508. LONG clrDesktop;
  509. LONG clrActiveCaption;
  510. LONG clrInactiveCaption;
  511. LONG clrMenu;
  512. LONG clrWindow;
  513. LONG clrWindowFrame;
  514. LONG clrMenuText;
  515. LONG clrWindowText;
  516. LONG clrCaptionText;
  517. LONG clrActiveBorder;
  518. LONG clrInactiveBorder;
  519. LONG clrAppWorkspace;
  520. LONG clrHiliteBk;
  521. LONG clrHiliteText;
  522. LONG clrBtnFace;
  523. LONG clrBtnShadow;
  524. LONG clrGrayText;
  525. LONG clrBtnText;
  526. LONG clrInactiveCaptionText;
  527. LONG clrBtnHilite;
  528. } SYSCOLORS;
  529. typedef struct tagCARET
  530. {
  531. HWND hwnd;
  532. BOOL fVisible;
  533. BOOL fOn;
  534. int iHideLevel;
  535. int x;
  536. int y;
  537. int cy;
  538. int cx;
  539. HBITMAP hBitmap;
  540. WORD cmsBlink; /* Blink time in milliseconds. */
  541. WORD hTimer;
  542. } CARET;
  543. /* Resource ID of system menus. */
  544. #define ID_SYSMENU MAKEINTRESOURCE(1)
  545. #define ID_CLOSEMENU MAKEINTRESOURCE(2)
  546. /* Menu Item Structure */
  547. typedef struct tagITEM
  548. {
  549. WORD fFlags; /* Item Flags. Must be first in this
  550. * structure.
  551. */
  552. HMENU cmdMenu; /* Handle to a popup */
  553. int xItem;
  554. int yItem;
  555. int cxItem;
  556. int cyItem;
  557. int dxTab;
  558. HBITMAP hbmpCheckMarkOn; /* Bitmap for an on check */
  559. HBITMAP hbmpCheckMarkOff; /* Bitmap for an off check */
  560. HBITMAP hItem; /* Handle to a bitmap or string */
  561. int ulX; /* String: Underline start */
  562. int ulWidth; /* String: underline width */
  563. int cch; /* String: character count */
  564. } ITEM;
  565. typedef ITEM *PITEM;
  566. typedef ITEM FAR *LPITEM;
  567. #define SIG_MENU ('M' | ('U' << 8))
  568. /* Menu Structure */
  569. typedef struct tagMENU
  570. {
  571. struct tagMENU* pMenuNext;
  572. WORD fFlags; /* Menu Flags.*/
  573. WORD signature; // signature
  574. HQ hqOwner; // owner queue
  575. int cxMenu;
  576. int cyMenu;
  577. int cItems; /* Number of items in rgItems */
  578. HWND hwndNotify; /* The owner hwnd of this menu */
  579. ITEM* rgItems; /* The list of items in this menu */
  580. #ifdef JAPAN
  581. int MenuMode; /* Kanji menu mode flag */
  582. #endif
  583. } MENU;
  584. typedef MENU *PMENU;
  585. // Layout of first part of menu heap structure.
  586. //
  587. typedef struct
  588. {
  589. WORD rgwReserved[8]; // reserve 8 words for standard DS stuff.
  590. MENU* pMenuList;
  591. } MENUHEAPHEADER;
  592. // Head of menu list (USE ONLY WITH DS == MENUHEAP)
  593. #define PMENULIST (((MENUHEAPHEADER*)NULL)->pMenuList)
  594. void FAR SetMenuDS(void);
  595. void FAR SetMenuStringDS(void);
  596. #define MENUSYSMENU SPACE_CHAR /* Space character */
  597. #define MENUCHILDSYSMENU '-' /* Hyphen */
  598. /* Defines for the fVirt field of the Accelerator table structure. */
  599. #define FVIRTKEY TRUE /* Assumed to be == TRUE */
  600. #define FLASTKEY 0x80 /* Indicates last key in the table */
  601. #define FNOINVERT 0x02
  602. #define FSHIFT 0x04
  603. #define FCONTROL 0x08
  604. #define FALT 0x10
  605. /* Accelerator Table structure */
  606. typedef struct tagACCEL
  607. {
  608. BYTE fVirt; /* Also called the flags field */
  609. WORD key;
  610. WORD cmd;
  611. } ACCEL;
  612. typedef ACCEL FAR *LPACCEL;
  613. /* OEM Bitmap Information Structure */
  614. typedef struct tagOEMBITMAPINFO
  615. {
  616. HBITMAP hBitmap;
  617. int cx;
  618. int cy;
  619. } OEMBITMAPINFO;
  620. /* OEM Information Structure */
  621. typedef struct tagOEMINFO
  622. {
  623. OEMBITMAPINFO bmFull;
  624. OEMBITMAPINFO bmUpArrow;
  625. OEMBITMAPINFO bmDnArrow;
  626. OEMBITMAPINFO bmRgArrow;
  627. OEMBITMAPINFO bmLfArrow;
  628. OEMBITMAPINFO bmReduce;
  629. OEMBITMAPINFO bmZoom;
  630. OEMBITMAPINFO bmRestore;
  631. OEMBITMAPINFO bmMenuArrow;
  632. OEMBITMAPINFO bmComboArrow;
  633. OEMBITMAPINFO bmReduceD;
  634. OEMBITMAPINFO bmZoomD;
  635. OEMBITMAPINFO bmRestoreD;
  636. OEMBITMAPINFO bmUpArrowD;
  637. OEMBITMAPINFO bmDnArrowD;
  638. OEMBITMAPINFO bmRgArrowD;
  639. OEMBITMAPINFO bmLfArrowD;
  640. OEMBITMAPINFO bmUpArrowI; // Up Arrow Inactive
  641. OEMBITMAPINFO bmDnArrowI; // Down Arrow Inactive
  642. OEMBITMAPINFO bmRgArrowI; // Right Arrow Inactive
  643. OEMBITMAPINFO bmLfArrowI; // Left Arrow Inactive
  644. int cxbmpHThumb;
  645. int cybmpVThumb;
  646. int cxMin;
  647. int cyMin;
  648. int cxIconSlot;
  649. int cyIconSlot;
  650. int cxIcon;
  651. int cyIcon;
  652. WORD cxPixelsPerInch; /* logical pixels per inch in X direction */
  653. WORD cyPixelsPerInch; /* logical pixels per inch in Y direction */
  654. int cxCursor;
  655. int cyCursor;
  656. WORD DispDrvExpWinVer; /* Display driver expected win version no */
  657. WORD ScreenBitCount; /* (BitCount * No of planes) for display */
  658. int cSKanji;
  659. int fMouse;
  660. } OEMINFO;
  661. /* OEMINFO structure for the monochrome bitmaps */
  662. typedef struct tagOEMINFOMONO
  663. {
  664. OEMBITMAPINFO bmAdjust;
  665. OEMBITMAPINFO bmSize;
  666. OEMBITMAPINFO bmCheck; /* Check mark */
  667. OEMBITMAPINFO bmbtnbmp; /* Check boxes */
  668. OEMBITMAPINFO bmCorner; /* Corner of buttons */
  669. int cxbmpChk;
  670. int cybmpChk;
  671. } OEMINFOMONO;
  672. typedef struct tagBMPDIMENSION
  673. {
  674. int cxBits; /* Width of the Bitmap */
  675. int cyBits; /* Height of the huge bitmap */
  676. } BMPDIMENSION;
  677. /* Holds the offsets of all bitmaps in bmBits (of hdcBits). */
  678. typedef struct tagRESINFO
  679. {
  680. /* The next 9 match resInfo */
  681. int dxClose;
  682. int dxUpArrow;
  683. int dxDnArrow;
  684. int dxRgArrow;
  685. int dxLfArrow;
  686. int dxReduce;
  687. int dxZoom;
  688. int dxRestore;
  689. int dxMenuArrow;
  690. int dxComboArrow;
  691. int dxReduceD;
  692. int dxZoomD;
  693. int dxRestoreD;
  694. int dxUpArrowD;
  695. int dxDnArrowD;
  696. int dxRgArrowD;
  697. int dxLfArrowD;
  698. int dxUpArrowI; // Up Arrow Inactive.
  699. int dxDnArrowI; // Down Arrow Inactive.
  700. int dxRgArrowI; // Right Arrow Inactive.
  701. int dxLfArrowI; // Left Arrow Inactive.
  702. HBITMAP hbmBits;
  703. BMPDIMENSION bmpDimension;
  704. } RESINFO;
  705. typedef struct tagRESINFOMONO
  706. {
  707. int dxSize;
  708. int dxBtSize;
  709. int dxCheck;
  710. int dxCheckBoxes;
  711. int dxBtnCorners;
  712. HBITMAP hbmBits;
  713. BMPDIMENSION bmpDimensionMono;
  714. } RESINFOMONO;
  715. typedef struct tagTASK
  716. {
  717. HQ hq;
  718. HWND hwnd;
  719. int ID;
  720. WORD count;
  721. WORD freq;
  722. WORD ready;
  723. FARPROC lpfnTask;
  724. } TASK;
  725. //**** SetWindowsHook() related definitions
  726. typedef struct tagHOOKNODE
  727. {
  728. struct tagHOOKNODE* phkNext;// Next in chain
  729. HOOKPROC lpfn; // function ptr to call (NULL if deleted during call)
  730. int idHook; // hook ID for this node
  731. HQ hq; // hq for which this hook applies
  732. HMODULE hmodOwner; // Module handle that contains this hook
  733. BOOL fCalled; // Whether inside call or not
  734. } HOOKNODE;
  735. #define HHOOK_MAGIC ('H' | ('K' << 8))
  736. extern HOOKNODE* rgphkSysHooks[];
  737. extern HOOKNODE* phkDeleted;
  738. extern BYTE rgbHookFlags[];
  739. LRESULT FAR CallHook(int code, WPARAM wParam, LPARAM lParam, int idHook);
  740. BOOL FAR IsHooked(WORD idHook);
  741. BOOL CallKbdHook(int code, WPARAM wParam, LPARAM lParam);
  742. BOOL CallMouseHook(int code, WPARAM wParam, LPARAM lParam);
  743. void UnhookHooks(HANDLE h, BOOL fQueue);
  744. HMODULE FAR PASCAL GetProcModule(FARPROC lpfn);
  745. HQ HqFromTask(HTASK htask);
  746. void UnhookHotKeyHooks(HMODULE hmodule);
  747. #ifdef DISABLE
  748. #define CallVisRgnHook(pparams) (int)CallHook(0, 0, (LONG)(VOID FAR*)pparams, WH_VISRGN) // ;Internal
  749. #endif
  750. // DC cache related declarations
  751. // DC Cache Entry structure (DCE)
  752. #define CACHESIZE 5
  753. typedef struct tagDCE
  754. {
  755. struct tagDCE *pdceNext;
  756. HDC hdc;
  757. HWND hwnd;
  758. HWND hwndOrg;
  759. HWND hwndClip;
  760. HRGN hrgnClip;
  761. DWORD flags;
  762. } DCE;
  763. extern DCE *pdceFirst; // Pointer to first element of cache
  764. extern HRGN hrgnGDC; // Temp used by GetCacheDC et al
  765. extern HRGN hrgnEWL; // Temp used by ExcludeWindowList()
  766. extern HRGN hrgnDCH; // Temp used by DCHook()
  767. extern BOOL fSiblingsTouched;
  768. #define InternalReleaseDC(hdc) ReleaseCacheDC(hdc, FALSE)
  769. /* InvalidateDCCache() flag values */
  770. #define IDC_DEFAULT 0x0001
  771. #define IDC_CHILDRENONLY 0x0002
  772. #define IDC_CLIENTONLY 0x0004
  773. #define IDC_VALID 0x0007 /* ;Internal */
  774. BOOL FAR InvalidateDCCache(HWND hwnd, WORD flags);
  775. int CalcWindowRgn(HWND hwnd, HRGN hrgn, BOOL fClient);
  776. BOOL FAR CalcVisRgn(HRGN hrgn, HWND hwndOrg, HWND hwndClip, DWORD flags);
  777. BOOL FAR ReleaseCacheDC(HDC hdc, BOOL fEndPaint);
  778. HDC FAR GetCacheDC(HWND hwndOrg, HWND hwndClip, HRGN hrgnClip, HDC hdcMatch, DWORD flags);
  779. HDC FAR CreateCacheDC(HWND hwndOrg, DWORD flags);
  780. BOOL FAR DestroyCacheDC(HDC hdc);
  781. HWND FAR WindowFromCacheDC(HDC hdc);
  782. BOOL FAR IntersectWithParents(HWND hwnd, LPRECT lprc);
  783. //**************************************************************************
  784. //
  785. // void SetVisible(hwnd, fSet)
  786. //
  787. // This routine must be used to set or clear the WS_VISIBLE style bit.
  788. // It also handles the setting or clearing of the WF_TRUEVIS bit.
  789. //
  790. #define SetVisible(hwnd, fSet) \
  791. if (fSet) \
  792. { \
  793. SetWF((hwnd), WFVISIBLE); \
  794. } \
  795. else \
  796. { \
  797. ClrWF((hwnd), WFVISIBLE); \
  798. ClrFTrueVis(hwnd); \
  799. }
  800. void FAR ClrFTrueVis(HWND hwnd);
  801. /* Saved Popup Bits structure */
  802. typedef struct tagSPB
  803. {
  804. struct tagSPB *pspbNext;
  805. HWND hwnd;
  806. HBITMAP hbm;
  807. RECT rc;
  808. HRGN hrgn;
  809. WORD flags;
  810. } SPB;
  811. #define SPB_SAVESCREENBITS 0x0001 // (*lpSaveScreenBits) was called
  812. #define SPB_LOCKUPDATE 0x0002 // LockWindowUpdate() SPB
  813. #ifdef DISABLE
  814. #define SPB_DRAWBUFFER 0x0004 // BeginDrawBuffer() SPB
  815. #endif
  816. // SPB related functions
  817. extern SPB* pspbFirst;
  818. extern HRGN hrgnSCR; // Temp rgn used by SpbCheckRect() */
  819. extern HRGN hrgnSPB1; // More temp regions
  820. extern HRGN hrgnSPB2;
  821. // This macro can be used to quickly avoid far calls to the SPB code.
  822. // In some cases it can prevent pulling in the segment that contains
  823. // all the code.
  824. //
  825. #define AnySpbs() (pspbFirst != NULL) // TRUE if there are any SPBs
  826. BOOL SpbValidate(SPB* pspb, HWND hwnd, BOOL fChildren);
  827. void SpbCheckDce(DCE* pdce);
  828. BOOL FBitsTouch(HWND hwndInval, LPRECT lprcDirty, SPB* pspb, DWORD flagsDcx);
  829. void FAR DeleteHrgnClip(DCE* pdce);
  830. void FAR CreateSpb(HWND hwnd, WORD flags, HDC hdcScreen);
  831. void FAR FreeSpb(SPB* pspb);
  832. SPB* FAR FindSpb(HWND hwnd);
  833. void FAR SpbCheckRect(HWND hwnd, LPRECT lprc, DWORD flagsDcx);
  834. void FAR SpbCheckHwnd(HWND hwnd);
  835. BOOL FAR RestoreSpb(HWND hwnd, HRGN hrgnUncovered, HDC FAR* phdcScreen);
  836. void FAR SpbCheck(void);
  837. BOOL FAR SpbCheckRect2(SPB* pspb, HWND hwnd, LPRECT lprc, DWORD flagsDcx);
  838. // LockWindowUpdate related stuff
  839. extern HWND hwndLockUpdate;
  840. extern HQ hqLockUpdate;
  841. void FAR InternalInvalidate(register HWND hwnd, HRGN hrgnUpdate, WORD flags);
  842. BOOL InternalInvalidate2(HWND hwnd, HRGN hrgn, HRGN hrgnSubtract, LPRECT prcParents, WORD flags);
  843. void _fastcall DeleteUpdateRgn(HWND hwnd);
  844. // SmartRectInRegion return codes
  845. //
  846. #define RIR_OUTSIDE 0
  847. #define RIR_INTERSECT 1
  848. #define RIR_INSIDE 2
  849. WORD FAR SmartRectInRegion(HRGN hrgn, LPRECT lprc);
  850. // Function used to redraw the screen
  851. #define RedrawScreen() \
  852. InternalInvalidate(hwndDesktop, (HRGN)1, \
  853. RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_ALLCHILDREN)
  854. extern HRGN hrgnInv1; // Temp used by RedrawWindow()
  855. extern HRGN hrgnInv2; // Temp used by InternalInvalidate()
  856. HDC CALLBACK InternalBeginPaint(HWND hwnd, PAINTSTRUCT FAR *lpps, BOOL fWindowDC);
  857. // Background and frame drawing related stuff
  858. // WM_SYNCPAINT wParam and DoSyncPaint flags
  859. void FAR DoSyncPaint(HWND hwnd, HRGN hrgn, WORD flags);
  860. // NOTE: the first 4 values must be as defined for backward compatibility
  861. // reasons. They are sent as parameters to the WM_SYNCPAINT message.
  862. // They used to be hard-coded constants.
  863. //
  864. // Only ENUMCLIPPEDCHILDREN, ALLCHILDREN, and NOCHECKPARENTS are passed on
  865. // during recursion. The other bits reflect the current window only.
  866. //
  867. #define DSP_ERASE 0x0001 // Send WM_ERASEBKGND
  868. #define DSP_FRAME 0x0002 // Send WM_NCPAINT
  869. #define DSP_ENUMCLIPPEDCHILDREN 0x0004 // Enum children if WS_CLIPCHILDREN
  870. #define DSP_WM_SYNCPAINT 0x0008 // Called from WM_SYNCPAINT handler
  871. #define DSP_NOCHECKPARENTS 0x0010 // Don't check parents for update region
  872. #define DSP_ALLCHILDREN 0x0020 // Enumerate all children.
  873. BOOL FAR SendEraseBkgnd(HWND hwnd, HDC hdcBeginPaint, HRGN hrgnUpdate);
  874. void SendNCPaint(HWND hwnd, HRGN hrgnUpdate);
  875. HWND _fastcall ParentNeedsPaint(HWND hwnd);
  876. // UpdateWindow definitions
  877. #define UW_ENUMCHILDREN 0x0001
  878. #define UW_VALIDATEPARENTS 0x0002
  879. void InternalUpdateWindow(HWND hwnd, WORD flags);
  880. void UpdateWindow2(register HWND hwnd, WORD flags);
  881. void ValidateParents(register HWND hwnd);
  882. // Used for UpdateWindow() calls that really shouldn't be there...
  883. #define UpdateWindow31(hwnd)
  884. // ScrollWindow() definitions
  885. extern HRGN hrgnSW;
  886. extern HRGN hrgnScrl1;
  887. extern HRGN hrgnScrl2;
  888. extern HRGN hrgnScrlVis;
  889. extern HRGN hrgnScrlSrc;
  890. extern HRGN hrgnScrlDst;
  891. extern HRGN hrgnScrlValid;
  892. extern HRGN hrgnScrlUpdate;
  893. // Scroll bar definitions
  894. typedef struct tagSBINFO
  895. {
  896. int pos;
  897. int posMin;
  898. int posMax;
  899. int cpxThumb;
  900. int cpxArrow;
  901. int cpx;
  902. int pxMin;
  903. int cxBorder;
  904. int cyBorder;
  905. int nBar;
  906. HWND calcHwnd; /* used to identify the window described by this info */
  907. } SBINFO;
  908. // The following masks can be used along with the wDisableFlags field of SB
  909. // to find if the Up/Left or Down/Right arrow or Both are disabled;
  910. // Now it is possible to selectively Enable/Disable just one or both the
  911. // arrows in a scroll bar control;
  912. #define LTUPFLAG 0x0001 // Left/Up arrow disable flag.
  913. #define RTDNFLAG 0x0002 // Right/Down arrow disable flag.
  914. #define SBFLAGSINDEX 6 // Index of Scroll bar flags in Wnd->rgwScroll[]
  915. typedef struct tagSB
  916. {
  917. WND wnd;
  918. int pos;
  919. int min;
  920. int max;
  921. BOOL fVert;
  922. WORD wDisableFlags; // Indicates which arrow is disabled;
  923. #ifdef DBCS_IME
  924. BOOL bImeStatus; // IME status save
  925. #endif
  926. } SB;
  927. typedef SB *PSB;
  928. typedef SB FAR *LPSB;
  929. /* Structure for list of drivers installed by USER and opened by applications.
  930. */
  931. typedef struct tagDRIVERTABLE
  932. {
  933. WORD fBusy:1;
  934. WORD fFirstEntry:1;
  935. int idNextDriver; /* Next driver in load chain -1 if end */
  936. int idPrevDriver; /* Prev driver in load chain -1 if begin */
  937. HANDLE hModule;
  938. DWORD dwDriverIdentifier;
  939. char szAliasName[128];
  940. LRESULT (FAR * lpDriverEntryPoint)(DWORD, HDRVR, WORD, LPARAM, LPARAM);
  941. } DRIVERTABLE;
  942. typedef DRIVERTABLE FAR *LPDRIVERTABLE;
  943. LRESULT FAR InternalLoadDriver(LPCSTR szDriverName,
  944. LPCSTR szSectionName,
  945. LPCSTR lpstrTail,
  946. WORD cbTail,
  947. BOOL fSendEnable);
  948. WORD FAR InternalFreeDriver(HDRVR hDriver, BOOL fSendDisable);
  949. /* Defines for InternalBroadcastDriverMessage flags */
  950. #define IBDM_SENDMESSAGE 0x00000001
  951. #define IBDM_REVERSE 0x00000002
  952. #define IBDM_FIRSTINSTANCEONLY 0x00000004
  953. LRESULT FAR InternalBroadcastDriverMessage(HDRVR, WORD, LPARAM, LPARAM, LONG);
  954. /* Application queue structure */
  955. #define MSGQSIZE 10
  956. typedef struct tagQ
  957. {
  958. HQ hqNext;
  959. HTASK hTask;
  960. int cbEntry;
  961. int cMsgs;
  962. WORD pmsgRead;
  963. WORD pmsgWrite;
  964. WORD pmsgMax;
  965. LONG timeLast; /* Time, position, and ID of last message */
  966. POINT ptLast;
  967. int idLast;
  968. DWORD dwExtraInfoLast; /* Additional info */
  969. WORD unused;
  970. LPARAM lParam;
  971. WPARAM wParam;
  972. int message;
  973. HWND hwnd;
  974. LRESULT result;
  975. int cQuit;
  976. int exitCode;
  977. WORD flags;
  978. WORD pMsgFilterChain;
  979. HGLOBAL hDS;
  980. int wVersion;
  981. HQ hqSender;
  982. HQ hqSendList;
  983. HQ hqSendNext;
  984. WORD cPaintsReady;
  985. WORD cTimersReady;
  986. WORD changebits;
  987. WORD wakebits;
  988. WORD wakemask;
  989. WORD pResult;
  990. WORD pResultSend;
  991. WORD pResultReceive;
  992. HOOKNODE* phkCurrent;
  993. HOOKNODE* rgphkHooks[WH_CHOOKS];
  994. DWORD semInput;
  995. HQ hqSemNext;
  996. INTERNALMSG rgmsg[MSGQSIZE];
  997. } Q;
  998. typedef Q FAR *LPQ;
  999. // NOTE: These macros can be recoded to be much faster if
  1000. // hqCurrent and lpqCurrent are defined as globals that are set
  1001. // at task switch time.
  1002. //
  1003. #define Lpq(hq) ((LPQ)MAKELP((hq), 0))
  1004. #define LpqFromHq(hq) Lpq(hq)
  1005. #define LpqCurrent() ((LPQ)(MAKELP(HqCurrent(), 0)))
  1006. typedef WORD ICH;
  1007. // Q flags field bits
  1008. #define QF_SEMWAIT 0x01
  1009. #define QF_INIT 0x02
  1010. #define QF_PALETTEAPP 0x04 /* This app used the palette */
  1011. // Internal GetQueueStatus() flags
  1012. #define QS_SMRESULT 0x8000
  1013. #define QS_SMPARAMSFREE 0x4000
  1014. /* Capture codes */
  1015. #define NO_CAP_CLIENT 0 /* no capture; in client area */
  1016. #define NO_CAP_SYS 1 /* no capture; in sys area */
  1017. #define CLIENT_CAPTURE 2 /* client-relative capture */
  1018. #define WINDOW_CAPTURE 3 /* window-relative capture */
  1019. #define SCREEN_CAPTURE 4 /* screen-relative capture */
  1020. // Extra bytes needed for specific window classes
  1021. //
  1022. #define CBEDITEXTRA 6
  1023. #define CBSTATICEXTRA 6
  1024. #ifdef DBCS_IME
  1025. #define CBBUTTONEXTRA 4 /* need one byte for IME status save */
  1026. #else
  1027. #define CBBUTTONEXTRA 3
  1028. #endif
  1029. #define CBMENUEXTRA 2
  1030. /* DrawBtnText codes */
  1031. #define DBT_TEXT 0x0001
  1032. #define DBT_FOCUS 0x0002
  1033. /* RIP error codes */
  1034. #define RIP_SEMCHECK 0xFFF4 /* Decimal -12 */
  1035. #define RIP_SWP 0xFFF1 /* Decimal -15 */ /* SetMultipleWindowPos */
  1036. #define RIP_MEMALLOC 0x0001 /* Insufficient memory for allocation */
  1037. #define RIP_MEMREALLOC 0x0002 /* Error realloc memory */
  1038. #define RIP_MEMFREE 0x0003 /* Memory cannot be freed */
  1039. #define RIP_MEMLOCK 0x0004 /* Memory cannot be locked */
  1040. #define RIP_MEMUNLOCK 0x0005 /* Memory cannot be unlocked */
  1041. #define RIP_BADGDIOBJECT 0x0006 /* Invalid GDI object */
  1042. #define RIP_BADWINDOWHANDLE 0x0007 /* Invalid Window handle */
  1043. #define RIP_DCBUSY 0x0008 /* Cached display contexts are busy */
  1044. #define RIP_NODEFWINDOWPROC 0x0009
  1045. #define RIP_CLIPBOARDOPEN 0x000A
  1046. #define RIP_GETDCWITHOUTRELEASE 0x000B /* App did a GetDC and destroyed window without release*/
  1047. #define RIP_INVALKEYBOARD 0x000C
  1048. #define RIP_INVALMOUSE 0x000D
  1049. #define RIP_INVALCURSOR 0x000E
  1050. #define RIP_DSUNLOCKED 0x000F
  1051. #define RIP_INVALLOCKSYSQ 0x0010
  1052. #define RIP_CARETBUSY 0x0011
  1053. #define RIP_GETCWRANGE 0x0012
  1054. #define RIP_HWNDOWNSDCS 0x0013 /* One hwnd owns all the DCs */
  1055. #define RIP_BADHQ 0x0014 /* operation on something of wrong task */
  1056. #define RIP_BADDCGRAY 0x0015 /* bad dc gray */
  1057. #define RIP_REFCOUNTOVERFLOW 0x0016 /* Ref Count in CLS overflows */
  1058. #define RIP_REFCOUNTUNDERFLOW 0x0017 /* Ref Count in CLS becomes negative */
  1059. #define RIP_COUNTBAD 0x0018 /* Ref Count should be zero; But not so */
  1060. #define RIP_INVALIDWINDOWSTYLE 0x0019 /* Illegal window style bits were set */
  1061. #define RIP_GLOBALCLASS 0x001A /* An application that registered a global
  1062. * class is terminating, but the reference
  1063. * count is non-zero(somebody else is using
  1064. * it). */
  1065. #define RIP_BADHOOKHANDLE 0x001B
  1066. #define RIP_BADHOOKID 0x001C
  1067. #define RIP_BADHOOKPROC 0x001D
  1068. #define RIP_BADHOOKMODULE 0x001E
  1069. #define RIP_BADHOOKCODE 0x001F
  1070. #define RIP_HOOKNOTALLOWED 0x0020
  1071. #define RIP_UNREMOVEDPROP 0x0021
  1072. #define RIP_BADPROPNAME 0x0022
  1073. #define RIP_BADTASKHANDLE 0x0023
  1074. #define RIP_GETSETINFOERR1 0x0027 /* Bad negative index for Get/Set/Window etc., */
  1075. #define RIP_GETSETINFOERR2 0x0028 /* Bad Positive index for Get/Set/Window etc., */
  1076. #define RIP_DIALOGBOXDESTROYWINDOWED 0x0029 /* App called DestroyWindow on a DialogBox window */
  1077. #define RIP_WINDOWIDNOTFOUND 0x002A /* Dialog control ID not found */
  1078. #define RIP_SYSTEMERRORBOXFAILED 0x002B /* Hard sys error box failed due to no hq */
  1079. #define RIP_INVALIDMENUHANDLE 0x002C /* Invalid hMenu */
  1080. #define RIP_INVALIDMETAFILEINCLPBRD 0x002D /* Invalid meta file pasted into clipboard */
  1081. #define RIP_MESSAGEBOXWITHNOQUEUE 0x002E /* MessageBox called with no message queue initialized */
  1082. #define RIP_DLGWINDOWEXTRANOTALLOCATED 0x002F /* DLGWINDOWEXTRA bytes not allocated for dlg box */
  1083. #define RIP_INTERTASKSENDMSGHANG 0x0030 /* Intertask send message with tasks locked */
  1084. #define RIP_INVALIDPARAM 0x0031 /* Invalid parameter passed to a function */
  1085. #define RIP_ASSERTFAILED 0x0032
  1086. #define RIP_INVALIDFUNCTIONCALLED 0x0033 /* Invalid function was called */
  1087. #define RIP_LOCKINPUTERROR 0x0034 /* LockInput called when input was already locked or when never locked.*/
  1088. #define RIP_NULLWNDPROC 0x0035 /* SetWindowLong uses a NULL wnd proc */
  1089. #define RIP_BAD_UNHOOK 0x0036 /* SetWindowsHook is used to unhook. */
  1090. #define RIP_QUEUE_FULL 0x0037 /* PostMessage failed due to full queue. */
  1091. #ifdef DEBUG
  1092. #define DebugFillStruct DebugFillBuffer
  1093. #define DebugErr(flags, sz) \
  1094. { static char CODESEG rgch[] = "USER: "sz; DebugOutput((flags) | DBF_USER, rgch); }
  1095. extern char CODESEG ErrAssertFailed[];
  1096. #define Assert(f) ((f) ? TRUE : (DebugOutput(DBF_ERROR, ErrAssertFailed), FALSE))
  1097. extern BOOL fRevalidate;
  1098. #define DONTREVALIDATE() fRevalidate = FALSE;
  1099. VOID FAR CheckCbDlgExtra(HWND hwnd);
  1100. #else
  1101. #define DebugErr(flags, sz)
  1102. #define Assert(f) FALSE
  1103. #define DONTREVALIDATE()
  1104. #define CheckCbDlgExtra(hwnd)
  1105. #endif
  1106. #define UserLogError(flags, errcode, sz) \
  1107. { DebugErr((flags), sz); \
  1108. LogError(errcode, NULL); }
  1109. #define BM_CLICK WM_USER+99
  1110. #define CH_PREFIX '&'
  1111. #define CH_HELPPREFIX 0x08
  1112. #if defined(JAPAN) || defined(KOREA)
  1113. // Japan and Korea support both Kanji and English mnemonic characters,
  1114. // toggled from control panel. Both mnemonics are embedded in menu
  1115. // resource templates. The following prefixes guide their parsing.
  1116. //
  1117. #define CH_ENGLISHPREFIX 0x1E
  1118. #define CH_KANJIPREFIX 0x1F
  1119. #define KMM_ENGLISH 2 // English/Romaji menu mode
  1120. #define KMM_KANJI 3 // Kanji/Hangeul menu mode
  1121. extern int KanjiMenuMode;
  1122. #endif
  1123. /* The total number of strings used as Button strings in MessageBoxes */
  1124. #define MAX_MB_STRINGS 8
  1125. /* Dialog box activation border width factor. */
  1126. #define CLDLGFRAME 4
  1127. #define CLDLGFRAMEWHITE 0
  1128. /* Constants for onboard bitmap save. */
  1129. #define ONBOARD_SAVE 0x0000
  1130. #define ONBOARD_RESTORE 0x0001
  1131. #define ONBOARD_CLEAR 0x0002
  1132. /* Bitmap resource IDs */
  1133. #define BMR_ICON 1
  1134. #define BMR_BITMAP 2
  1135. #define BMR_CURSOR 3
  1136. #define BMR_DEVDEP 0
  1137. #define BMR_DEVIND 1
  1138. #define BMR_DEPIND 2
  1139. /* PID definitions */
  1140. #define get_PID 0
  1141. #define get_EMSSave_area 1
  1142. #define dont_free_banks 2
  1143. #define free_PIDs_banks 3
  1144. #define free_handle 4
  1145. #define memory_sizes 5
  1146. #define DDE_shared 6
  1147. // SetWindowPos() related structures and definitions
  1148. //
  1149. extern HRGN hrgnInvalidSum;
  1150. extern HRGN hrgnVisNew;
  1151. extern HRGN hrgnSWP1;
  1152. extern HRGN hrgnValid;
  1153. extern HRGN hrgnValidSum;
  1154. extern HRGN hrgnInvalid;
  1155. // CalcValidRects() "Region Empty" flag values
  1156. // A set bit indicates the corresponding region is empty.
  1157. //
  1158. #define RE_VISNEW 0x0001 // CVR "Region Empty" flag values
  1159. #define RE_VISOLD 0x0002 // A set bit indicates the
  1160. #define RE_VALID 0x0004 // corresponding region is empty.
  1161. #define RE_INVALID 0x0008
  1162. #define RE_SPB 0x0010
  1163. #define RE_VALIDSUM 0x0020
  1164. #define RE_INVALIDSUM 0x0040
  1165. typedef struct tagCVR // cvr
  1166. {
  1167. WINDOWPOS pos; // MUST be first field of CVR!
  1168. int xClientNew; // New client rectangle
  1169. int yClientNew;
  1170. int cxClientNew;
  1171. int cyClientNew;
  1172. RECT rcBlt;
  1173. int dxBlt; // Distance blt rectangle is moving
  1174. int dyBlt;
  1175. WORD fsRE; // RE_ flags: whether hrgnVisOld is empty or not
  1176. HRGN hrgnVisOld; // Previous visrgn
  1177. } CVR;
  1178. typedef struct tagSMWP // smwp
  1179. {
  1180. int ccvr; // Number of CVRs in the SWMP
  1181. int ccvrAlloc; // Number of actual CVRs allocated in the SMWP
  1182. BOOL fInUse;
  1183. WORD signature; // signature word for handle validation
  1184. CVR rgcvr[1];
  1185. } SMWP;
  1186. #define SMWP_SIG ('W' | ('P' << 8))
  1187. #define PEMWP HDWP
  1188. #define NEAR_SWP_PTRS
  1189. #ifdef NEAR_SWP_PTRS
  1190. typedef SMWP* PSMWP;
  1191. typedef CVR* PCVR;
  1192. #else
  1193. typedef SMWP FAR* PSMWP;
  1194. typedef CVR FAR* PCVR;
  1195. #endif
  1196. BOOL ValidateSmwp(PSMWP psmwp, BOOL FAR* pfSyncPaint);
  1197. HWND SmwpFindActive(PSMWP psmwp);
  1198. void SendChangedMsgs(PSMWP psmwp);
  1199. BOOL ValidateWindowPos(WINDOWPOS FAR *ppos);
  1200. BOOL BltValidBits(PSMWP psmwp);
  1201. BOOL SwpCalcVisRgn(HWND hwnd, HRGN hrgn);
  1202. BOOL CombineOldNewVis(HRGN hrgn, HRGN hrgnVisOld, HRGN hrgnVisNew, WORD crgn, WORD fsRgnEmpty);
  1203. void CalcValidRects(PSMWP psmwp, HWND FAR* phwndNewActive);
  1204. BOOL ValidateZorder(PCVR pcvr);
  1205. PSMWP ZOrderByOwner(PSMWP psmwp);
  1206. PSMWP AddCvr(PSMWP psmwp, HWND hwnd, HWND hwndInsertAfter, WORD flags);
  1207. BOOL SwpActivate(HWND hwndNewActive);
  1208. void FAR HandleWindowPosChanged(HWND hwnd, WINDOWPOS FAR *lppos);
  1209. void FAR OffsetChildren(HWND hwnd, int dx, int dy, LPRECT prcHitTest);
  1210. BOOL FAR IntersectWithParents(HWND hwnd, LPRECT lprcParents);
  1211. // Preallocated buffers for use during SetWindowPos to prevent memory
  1212. // allocation failures.
  1213. //
  1214. #define CCVR_WORKSPACE 4
  1215. #define CCVR_MSG_WORKSPACE 2
  1216. #define CB_WORKSPACE ((sizeof(SMWP) - sizeof(CVR)) + CCVR_WORKSPACE * sizeof(CVR))
  1217. #define CB_MSG_WORKSPACE ((sizeof(SMWP) - sizeof(CVR)) + CCVR_MSG_WORKSPACE * sizeof(CVR))
  1218. extern BYTE workspace[];
  1219. extern BYTE msg_workspace[];
  1220. typedef struct tagSTAT
  1221. {
  1222. WND wnd;
  1223. HFONT hFont;
  1224. HBRUSH hBrush;
  1225. HICON hIcon;
  1226. } STAT;
  1227. typedef STAT *PSTAT;
  1228. #define IsCrlf(x) ((char)(x)==0x0D)
  1229. /* Help Engine stuff */
  1230. typedef struct
  1231. {
  1232. unsigned short cbData; /* Size of data */
  1233. unsigned short usCommand; /* Command to execute */
  1234. unsigned long ulTopic; /* Topic/context number (if needed) */
  1235. unsigned long ulReserved; /* Reserved (internal use) */
  1236. unsigned short offszHelpFile; /* Offset to help file in block */
  1237. unsigned short offabData; /* Offset to other data in block */
  1238. } HLP;
  1239. typedef HLP FAR *LPHLP;
  1240. typedef HANDLE HDCS;
  1241. /* DrawFrame() Commands */
  1242. #define DF_SHIFT0 0x0000
  1243. #define DF_SHIFT1 0x0001
  1244. #define DF_SHIFT2 0x0002
  1245. #define DF_SHIFT3 0x0003
  1246. #define DF_PATCOPY 0x0000
  1247. #define DF_PATINVERT 0x0004
  1248. #define DF_SCROLLBAR (COLOR_SCROLLBAR << 3)
  1249. #define DF_BACKGROUND (COLOR_BACKGROUND << 3)
  1250. #define DF_ACTIVECAPTION (COLOR_ACTIVECAPTION << 3)
  1251. #define DF_INACTIVECAPTION (COLOR_INACTIVECAPTION << 3)
  1252. #define DF_MENU (COLOR_MENU << 3)
  1253. #define DF_WINDOW (COLOR_WINDOW << 3)
  1254. #define DF_WINDOWFRAME (COLOR_WINDOWFRAME << 3)
  1255. #define DF_MENUTEXT (COLOR_MENUTEXT << 3)
  1256. #define DF_WINDOWTEXT (COLOR_WINDOWTEXT << 3)
  1257. #define DF_CAPTIONTEXT (COLOR_CAPTIONTEXT << 3)
  1258. #define DF_ACTIVEBORDER (COLOR_ACTIVEBORDER << 3)
  1259. #define DF_INACTIVEBORDER (COLOR_INACTIVEBORDER << 3)
  1260. #define DF_APPWORKSPACE (COLOR_APPWORKSPACE << 3)
  1261. #define DF_GRAY (DF_APPWORKSPACE + (1 << 3))
  1262. #ifdef FASTFRAME
  1263. typedef struct tagFRAMEBITMAP
  1264. {
  1265. int x; /* Top Left co-ordinates */
  1266. int y;
  1267. int dx; /* Width of the bitmap */
  1268. int dy; /* Height of the bitmap */
  1269. } FRAMEBITMAP;
  1270. #define FB_THICKFRAME FALSE
  1271. #define FB_DLGFRAME TRUE
  1272. #define FB_ACTIVE 0
  1273. #define FB_INACTIVE 1
  1274. #define FB_HORZ 0
  1275. #define FB_VERT 1
  1276. #define FB_DLG_HORZ 2
  1277. #define FB_DLG_VERT 3
  1278. #define FB_CAPTION 4
  1279. typedef struct tagFRAMEDETAILS
  1280. {
  1281. HBITMAP hFrameBitmap[5][2]; /* indices explained above */
  1282. FRAMEBITMAP ActBorderH[4]; /* Four parts of Thick frame Horz bitmap */
  1283. FRAMEBITMAP ActBorderV[4];
  1284. FRAMEBITMAP DlgFrameH[4]; /* Four parts of Dlg Frame Horz bitmap */
  1285. FRAMEBITMAP DlgFrameV[4];
  1286. FRAMEBITMAP CaptionInfo[7];
  1287. int clBorderWidth;
  1288. } FRAMEDETAILS;
  1289. typedef FRAMEBITMAP *PFRAMEBITMAP;
  1290. // Fast frame related macros
  1291. #define FC_ACTIVEBORDER 0x01
  1292. #define FC_INACTIVEBORDER 0x02
  1293. #define FC_ACTIVECAPTION 0x04
  1294. #define FC_INACTIVECAPTION 0x08
  1295. #define FC_WINDOWFRAME 0x10
  1296. #define FC_ACTIVEBIT 0x01
  1297. #define FC_INACTIVEBIT 0x02
  1298. #define FC_STATUSBITS (FC_ACTIVEBIT | FC_INACTIVEBIT)
  1299. #endif /* FASTFRAME */
  1300. // The following defines the components of nKeyboardSpeed
  1301. #define KSPEED_MASK 0x001F // Defines the key repeat speed.
  1302. #define KDELAY_MASK 0x0060 // Defines the keyboard delay.
  1303. #define KDELAY_SHIFT 5
  1304. /*--------------------------------------------------------------------------*/
  1305. /* */
  1306. /* Secret Imports - */
  1307. /* */
  1308. /*--------------------------------------------------------------------------*/
  1309. #ifndef MSDWP
  1310. /* Imported from Kernel. */
  1311. HQ FAR GetTaskQueue(HTASK);
  1312. HQ FAR SetTaskQueue(HTASK, HQ);
  1313. void FAR LockCurrentTask(BOOL);
  1314. HANDLE FAR emscopy();
  1315. //void FAR ExitKernel(int);
  1316. int FAR LocalCountFree(void);
  1317. int FAR LocalHeapSize(void);
  1318. BOOL FAR IsWinoldapTask(HTASK);
  1319. WORD FAR GetExeVersion(void);
  1320. DWORD FAR GetTaskDS(void);
  1321. void FAR SetTaskSignalProc(WORD, FARPROC);
  1322. DWORD FAR GetHeapSpaces(HMODULE hModule);
  1323. int FAR IsScreenGrab(void);
  1324. /* Imported from GDI. */
  1325. int API IntersectVisRect(HDC, int, int, int, int);
  1326. int API ExcludeVisRect(HDC, int, int, int, int);
  1327. int API SelectVisRgn(HDC, HRGN);
  1328. int API SaveVisRgn(HDC);
  1329. int API RestoreVisRgn(HDC);
  1330. HRGN API InquireVisRgn(HDC);
  1331. HDCS API GetDCState(HDC);
  1332. BOOL API SetDCState(HDC, HDCS);
  1333. HFONT API GetCurLogFont(HDC); // From GDI
  1334. #define SwapHandle(foo)
  1335. HANDLE FAR GDIInit2(HANDLE, HANDLE);
  1336. HRGN API GetClipRgn(HDC);
  1337. HBITMAP FAR CreateUserBitmap(int, int, int, int, LONG);
  1338. void FAR UnRealizeObject(HBRUSH);
  1339. void FAR LRCCFrame(HDC, LPRECT, HBRUSH, DWORD);
  1340. void FAR Death(HDC);
  1341. void FAR Resurrection(HDC, LONG, LONG, LONG);
  1342. void FAR DeleteAboveLineFonts(void);
  1343. BOOL FAR GDIInitApp(void);
  1344. HBITMAP FAR CreateUserDiscardableBitmap(HDC, int, int);
  1345. void FAR FinalGDIInit(HBRUSH);
  1346. void FAR GDIMoveBitmap(HBITMAP);
  1347. BOOL FAR IsValidMetaFile(HMETAFILE);
  1348. #define GDIMoveBitmap(d1)
  1349. #endif /* MSDWP */
  1350. /*--------------------------------------------------------------------------*/
  1351. /* */
  1352. /* DS Global Variables (from WINDS.C) */
  1353. /* */
  1354. /*--------------------------------------------------------------------------*/
  1355. //***** Initialization globals
  1356. extern HINSTANCE hInstanceWin;
  1357. extern HMODULE hModuleWin;
  1358. //WORD rgwSysMet[]; // Defined in winmisc2.asm
  1359. //***** System mode globals
  1360. extern BOOL fDialog; // Dialog box is active
  1361. extern BOOL fEndSession; // Shutting down system
  1362. extern BOOL fTaskIsLocked; // LockTask() called
  1363. extern BOOL fMessageBox; // hard message box active
  1364. extern HWND hwndSysModal;
  1365. extern HQ hqAppExit; // hq of app in app termination code
  1366. //***** System option settings globals
  1367. extern int nKeyboardSpeed; // keyboard repeat rate
  1368. extern int iScreenSaveTimeOut; // screen saver timeout
  1369. extern BOOL fHires; /* VERTRES > 300? */
  1370. extern BOOL fPaletteDisplay; /* Are we on a palette display driver? */
  1371. extern BOOL fEdsunChipSet; /* Edsun vga chip set? */
  1372. //***** Window manager globals
  1373. extern HWND hwndDesktop; // Desktop window
  1374. extern PCLS pclsList; // List of registered classes
  1375. extern PBWL pbwlCache; // BuildWindowList() globals
  1376. extern PBWL pbwlList;
  1377. //***** Input globals
  1378. extern BOOL fThunklstrcmp; // if TRUE we thunk to Win32
  1379. extern WORD idSysPeek; /* ID in sys queue of msg being looked at */
  1380. extern DWORD timeLastInputMessage; // Time of the last keyboard, mouse, or
  1381. // other input message.
  1382. extern HWND hwndCursor;
  1383. extern HWND hwndDblClk; // doubleclick parsing
  1384. extern RECT rcDblClk;
  1385. extern WORD dtDblClk;
  1386. extern WORD msgDblClk;
  1387. extern DWORD timeDblClk;
  1388. extern int defQueueSize; // Default msg queue size
  1389. extern HTASK hTaskLockInput; /* Task which has called LockInput() */
  1390. extern KBINFO keybdInfo;
  1391. extern BYTE *pState; // Pointer to buffer for ToAscii
  1392. extern BOOL fShrinkGDI; /* Does GDI's heap needs shrinking? */
  1393. extern BOOL fLockNorem; /* PeekMsg NOREMOVE flag */
  1394. //***** Activation/Focus/Capture related globals
  1395. extern HWND hwndActive;
  1396. extern HWND hwndActivePrev;
  1397. extern HWND hwndFocus;
  1398. extern int codeCapture;
  1399. extern HWND hwndCapture;
  1400. //***** SetWindowPos() related globals
  1401. extern HRGN hrgnInvalidSum; // Temps used by SetWindowPos()
  1402. extern HRGN hrgnVisNew;
  1403. extern HRGN hrgnSWP1;
  1404. extern HRGN hrgnValid;
  1405. extern HRGN hrgnValidSum;
  1406. extern HRGN hrgnInvalid;
  1407. #ifdef LATER
  1408. // Are these still needed now that SysErrorBox() is working?
  1409. #endif
  1410. extern BYTE workspace[]; // Buffers used to prevent mem alloc
  1411. extern BYTE msg_workspace[]; // failures in messagebox
  1412. //***** General graphics globals
  1413. extern HDC hdcBits; /* DC with User's bitmaps */
  1414. extern HDC hdcMonoBits; /* DC with User's MONO bitmaps */
  1415. extern OEMINFO oemInfo;
  1416. extern OEMINFOMONO oemInfoMono;
  1417. extern RESINFO resInfo;
  1418. extern RESINFOMONO resInfoMono;
  1419. extern SYSCLROBJECTS sysClrObjects;
  1420. extern SYSCOLORS sysColors;
  1421. extern HFONT hFontSys; // alias for GetStockObject(SYSTEM_FONT);
  1422. extern HFONT hFontSysFixed; // alias for GetStockObject(SYSTEM_FIXED_FONT);
  1423. extern HBRUSH hbrWhite; // alias for GetStockObject(WHITE_BRUSH);
  1424. extern HBRUSH hbrBlack; // alias for GetStockObject(BLACK_BRUSH);
  1425. extern HPALETTE hPalDefaultPalette; // alias for GetStockObject(DEFAULT_PALETTE);
  1426. //***** DC Cache related globals
  1427. extern DCE* pdceFirst; /* Ptr to first entry in cache */
  1428. extern HRGN hrgnEWL; // Temp used by ExcludeWindowList()
  1429. extern HRGN hrgnGDC; // Temp used by GetCacheDC() et al
  1430. extern HRGN hrgnDCH; // Temp used by DCHook()
  1431. extern HRGN hrgnNull; // empty rgn
  1432. extern HRGN hrgnScreen; // rcScreen-sized rgn
  1433. extern HDCS hdcsReset;
  1434. extern HDC hdcScreen;
  1435. //***** Begin/EndDrawBuffer() globals
  1436. #ifdef DISABLE
  1437. extern HWND hwndBuffer;
  1438. extern HBITMAP hbmBuffer;
  1439. extern HBITMAP hbmBufferSave;
  1440. extern int cxBuffer;
  1441. extern int cyBuffer;
  1442. extern int dxBuffer;
  1443. extern DCE* pdceBuffer;
  1444. extern int dxBufferVisRgn;
  1445. extern int dyBufferVisRgn;
  1446. extern BOOL fBufferFlushed;
  1447. extern RECT rcBuffer;
  1448. extern HDCS hdcsMemReset;
  1449. #endif
  1450. //***** LockWindowUpdate related globals
  1451. extern HQ hqLockUpdate;
  1452. extern HWND hwndLockUpdate;
  1453. //***** SPB related globals
  1454. extern SPB *pspbFirst;
  1455. extern HRGN hrgnSCR; // Temp used by SpbCheckRect()
  1456. extern HRGN hrgnSPB1;
  1457. extern HRGN hrgnSPB2;
  1458. extern HRGN hrgnInv0; // Temps used by InternalInvalidate()
  1459. extern HRGN hrgnInv1;
  1460. extern HRGN hrgnInv2;
  1461. //***** General Metrics
  1462. extern RECT rcScreen; // Screen rectangle
  1463. extern int cxScreen; // Screen height/width
  1464. extern int cyScreen;
  1465. extern BOOL fBeep; /* Warning beeps allowed? */
  1466. extern int cxSysFontChar; // System font metrics
  1467. extern int cxSysFontOverhang;
  1468. extern int cySysFontAscent;
  1469. extern int cySysFontChar;
  1470. extern int cySysFontExternLeading;
  1471. extern int cxBorder; // Nominal border width/height
  1472. extern int cyBorder;
  1473. extern int cyCaption; // height of caption
  1474. extern int cxSize; // dimensions of system menu bitmap
  1475. extern int cySize;
  1476. extern int cyHScroll; // scroll bar dimensions
  1477. extern int cxVScroll;
  1478. extern int cxSlot; // icon slot dimensions
  1479. extern int cySlot;
  1480. //***** ScrollWindow/ScrollDC related globals
  1481. extern HRGN hrgnSW; // Temps used by ScrollDC/ScrollWindow
  1482. extern HRGN hrgnScrl1;
  1483. extern HRGN hrgnScrl2;
  1484. extern HRGN hrgnScrlVis;
  1485. extern HRGN hrgnScrlSrc;
  1486. extern HRGN hrgnScrlDst;
  1487. extern HRGN hrgnScrlValid;
  1488. extern HRGN hrgnScrlUpdate;
  1489. //***** Clipboard globals
  1490. extern int cNumClipFormats; // Number of formats in clipboard
  1491. extern CLIP *pClipboard; // Clipboard data
  1492. extern HQ hqClipLock; // hq of app accessing clipboard
  1493. extern HWND hwndClipOwner; // clipboard owner
  1494. extern HWND hwndClipViewer; // clipboard viewer
  1495. extern BOOL fClipboardChanged; // TRUE if DrawClipboard needs to be called
  1496. extern BOOL fDrawingClipboard; // TRUE if inside DrawClipboard()
  1497. extern HWND hwndClipOpen; // hwnd of app accessing clipboard
  1498. extern BOOL fCBLocked; /* Is clibboard locked? */
  1499. //***** Fast frame drawing globals
  1500. #ifdef FASTFRAME
  1501. extern BOOL fFastFrame;
  1502. extern FRAMEDETAILS Frame;
  1503. #endif /* FASTFRAME */
  1504. //***** WinOldAppHackoMaticFlags
  1505. extern WORD winOldAppHackoMaticFlags; /* Flags for doing special things for
  1506. winold app */
  1507. //***** TaskManager exec globals
  1508. extern PSTR pTaskManName; // Task manager file name
  1509. //***** atom management globals
  1510. extern HANDLE hWinAtom; // global atom manager heap
  1511. //***** WM_HOTKEY globals
  1512. extern PSTR pHotKeyList; /* Pointer to list of hot keys in system. */
  1513. extern int cHotKeyCount; /* Count of hot keys in list. */
  1514. //***** WinHelp() globals
  1515. extern WORD msgWinHelp;
  1516. //***** SetWindowsHook() system hook table
  1517. extern HOOKNODE* rgphkSysHooks[];
  1518. extern HOOKNODE* phkDeleted;
  1519. //***** Driver management globals
  1520. extern int cInstalledDrivers; /* Count of installed driver structs allocated*/
  1521. extern HDRVR hInstalledDriverList; /* List of installable drivers */
  1522. extern int idFirstDriver; /* First driver in load chain */
  1523. extern int idLastDriver; /* Last driver in load chain */
  1524. //***** Display driver globals
  1525. extern HINSTANCE hInstanceDisplay;
  1526. extern BOOL fOnBoardBitmap; /* Can display save bitmaps onboard? */
  1527. extern BOOL (CALLBACK *lpSaveBitmap)(LPRECT lprc, WORD flags);
  1528. extern VOID (CALLBACK *lpDisplayCriticalSection)(BOOL fLock);
  1529. extern VOID (CALLBACK *lpWin386ShellCritSection)(VOID);
  1530. typedef int (FAR *FARGETDRIVERPROC)(int, LPCSTR);
  1531. extern FARGETDRIVERPROC lpfnGetDriverResourceId;
  1532. //***** Comm driver definitions and globals
  1533. // Comm driver constants
  1534. //
  1535. #define LPTx 0x80 /* Mask to indicate cid is for LPT device */
  1536. #define LPTxMask 0x7F /* Mask to get cid for LPT device */
  1537. #define PIOMAX 3 /* Max number of LPTx devices in high level */
  1538. #define CDEVMAX 10 /* Max number of COMx devices in high level */
  1539. #define DEVMAX (CDEVMAX+PIOMAX) /* Max number of devices in high level */
  1540. // qdb - queue definition block
  1541. //
  1542. typedef struct {
  1543. char far *pqRx; /* pointer to rx queue */
  1544. int cbqRx; /* size of RX Queue in bytes */
  1545. char far *pqTx; /* Pointer to TX Queue */
  1546. int cbqTx; /* Size of TX Queue in bytes */
  1547. } qdb;
  1548. // cinfo - Communications Device Information
  1549. //
  1550. typedef struct
  1551. {
  1552. WORD fOpen : 1; /* Device open flag */
  1553. WORD fchUnget : 1; /* Flag for backed-up character */
  1554. WORD fReservedHardware:1; /* Reserved for hardware (mouse etc) */
  1555. HTASK hTask; /* Handle to task who opened us */
  1556. char chUnget; /* Backed-up character */
  1557. qdb qdbCur; /* Queue information */
  1558. } cinfo;
  1559. extern cinfo rgcinfo[];
  1560. extern int (FAR PASCAL *lpCommWriteString)(int, LPCSTR, WORD);
  1561. /* Ptr to the comm driver's
  1562. * commwritestring function. Only
  1563. * exists in 3.1 drivers.
  1564. */
  1565. extern int (FAR PASCAL *lpCommReadString)(int, LPSTR, WORD);
  1566. /* Ptr to the comm driver's
  1567. * commreadstring function. Only
  1568. * exists in 3.1 drivers.
  1569. */
  1570. extern BOOL (FAR PASCAL *lpCommEnableNotification)(int, HWND, int, int);
  1571. /* Ptr to the comm driver's
  1572. * EnableNotification function.
  1573. * Only exists in 3.1 drivers.
  1574. */
  1575. //***** PenWinProc globals
  1576. /* Ptr to register us as pen aware dlg box
  1577. */
  1578. extern VOID (CALLBACK *lpRegisterPenAwareApp)(WORD i, BOOL fRegister);
  1579. //***** Resource handler globals
  1580. extern RSRCHDLRPROC lpDefaultResourceHandler;
  1581. //***** NLS related globals
  1582. extern HINSTANCE hLangDrv; /* The module handle of the language driver */
  1583. extern FARPROC fpLangProc; /* The entry point into the language driver */
  1584. #ifdef DBCS_IME
  1585. extern HINSTANCE hWinnls; /* WINNLS.DLL module handle */
  1586. #endif
  1587. //***** Caret globals
  1588. extern CARET caret;
  1589. extern HQ hqCaret;
  1590. //***** Cursor globals
  1591. extern CURSORINFO cursInfo;
  1592. #ifdef LATER
  1593. // Is this array big enough?
  1594. #endif
  1595. extern HCURSOR rghCursor[];
  1596. extern HBITMAP hbmCursorBitmap; /* Pre created bitmap for SetCursor */
  1597. extern HGLOBAL hPermanentCursor; /* Precreated permanent cursor resource */
  1598. extern HCURSOR hCurCursor;
  1599. extern HCURSOR hCursNormal;
  1600. extern HCURSOR hCursUpArrow;
  1601. extern HCURSOR hCursIBeam;
  1602. extern HCURSOR hCursSizeAll;
  1603. //INT iLevelCursor; NOTE: overlays sys metrics array (winmisc2.asm)
  1604. //***** Icon globals
  1605. extern HICON hIconBang;
  1606. extern HICON hIconHand;
  1607. extern HICON hIconNote;
  1608. extern HICON hIconQues;
  1609. extern HICON hIconSample;
  1610. extern HICON hIconWarn;
  1611. extern HICON hIconErr;
  1612. extern HBITMAP hbmDrawIconMono; /* Pre created bitmaps for drawicon */
  1613. extern HBITMAP hbmDrawIconColor; /* Pre created bitmaps for drawicon */
  1614. extern HTASK hTaskGrayString; /* Task in graystring */
  1615. //***** Desktop/Wallpaper globals
  1616. extern HBITMAP hbmDesktop; /* Monochrome Desktop pattern */
  1617. extern HBITMAP hbmWallpaper; /* Bitmap that will be drawn on the desktop */
  1618. //***** Window move/size tracking globals
  1619. extern RECT rcDrag;
  1620. extern RECT rcWindow;
  1621. extern RECT rcParent;
  1622. extern WORD cmd;
  1623. extern HICON hdragIcon;
  1624. extern BOOL fTrack;
  1625. extern int dxMouse;
  1626. extern int dyMouse;
  1627. extern int impx;
  1628. extern int impy;
  1629. extern HWND hwndTrack;
  1630. extern BOOL fInitSize;
  1631. extern POINT ptMinTrack;
  1632. extern POINT ptMaxTrack;
  1633. extern BOOL fmsKbd;
  1634. extern POINT ptRestore;
  1635. extern HCURSOR hIconWindows; /* Cool windows icon */
  1636. extern BOOL fDragFullWindows; /* Drag xor rect or full windows */
  1637. /* Added flag to stop anyone from setting the cursor while
  1638. * we are moving the hDragIcon. This was done to fix a bug in micrografix
  1639. * Draw (They are doing a Setcursor() whenever they get a paint message).
  1640. */
  1641. extern BOOL fdragIcon; // Prevent SetCursor while dragging icon
  1642. /* When an iconic window is moved around with a mouse, IsWindowVisible() call
  1643. * returns FALSE! This is because, the window is internally hidden and what is
  1644. * visible is only a mouse cursor! But how will the Tracer guys know this?
  1645. * They won't! So, when an Icon window is moved around, its hwnd is preserved
  1646. * in this global and IsWindowVisible() will return a true for
  1647. * this window!
  1648. */
  1649. extern HWND hwndDragIcon;
  1650. //***** MessageBox globals
  1651. extern int cntMBox; // Nesting level for overlap tiling of mboxes
  1652. extern WORD wDefButton; // index of current default button
  1653. extern WORD wMaxBtnSize; // width of biggest button in any message box
  1654. //***** Size border metric globals
  1655. extern int clBorder; /* # of logical units in window frame */
  1656. extern int cxSzBorder; /* Window border width (cxBorder*clBorder) */
  1657. extern int cySzBorder; /* Window border height (cyBorder*clBorder) */
  1658. extern int cxSzBorderPlus1; /* cxBorder*(clBorder+1). We overlap a line */
  1659. extern int cySzBorderPlus1; /* cyBorder*(clBorder+1). We overlap a line */
  1660. //***** Window tiling/cascading globals
  1661. extern int cxyGranularity; /* Top-level window grid granularity */
  1662. extern int cyCWMargin; /* Space on top of toplevel window 'stack' */
  1663. extern int cxCWMargin; /* Space on right of toplevel window 'stack'*/
  1664. extern int iwndStack;
  1665. extern int cxHalfIcon; // rounding helpers for icon positioning
  1666. extern int cyHalfIcon;
  1667. //***** Alt-tab switching globals
  1668. extern HWND hwndAltTab;
  1669. extern HWND hwndSwitch;
  1670. extern HWND hwndKbd;
  1671. extern BOOL fFastAltTab; /* Don't use Tandy's switcher? */
  1672. extern BOOL fInAltTab;
  1673. //***** Icon title globals
  1674. extern int cyTitleSpace;
  1675. extern BOOL fIconTitleWrap; /* Wrap icon titles or just use single line? */
  1676. extern LOGFONT iconTitleLogFont; /* LogFont struct for icon title font */
  1677. extern HFONT hIconTitleFont; /* Font used in icon titles */
  1678. //***** GrayString globals
  1679. extern HBRUSH hbrGray; // GrayString globals.
  1680. extern HBITMAP hbmGray;
  1681. extern HDC hdcGray;
  1682. extern int cxGray; // current dimensions of hbmGray
  1683. extern int cyGray;
  1684. //***** WM_GETMINMAXINFO globals
  1685. extern POINT rgptMinMaxWnd[];
  1686. extern POINT rgptMinMax[];
  1687. //***** Menu globals
  1688. extern int menuSelect;
  1689. extern int mnFocus;
  1690. extern HANDLE hMenuHeap; /* Menu heap */
  1691. extern _segment menuBase;
  1692. extern HANDLE hMenuStringHeap;
  1693. extern _segment menuStringBase;
  1694. //PPOPUPMENU pGlobalPopupMenu; // mnloop.c
  1695. extern HWND hwndRealPopup;
  1696. extern BOOL fMenu; /* Using a menu? */
  1697. extern BOOL fSysMenu;
  1698. extern BOOL fInsideMenuLoop; /* MenuLoop capture? */
  1699. extern BOOL fMenuStatus;
  1700. extern int iActivatedWindow;/* This global is examined in the menu loop
  1701. * code so that we exit from menu mode if
  1702. * another window was activated while we were
  1703. * tracking menus. This global is incremented
  1704. * whenever we activate a new window.
  1705. */
  1706. extern WORD iDelayMenuShow; /* Delay till the hierarchical menu is shown*/
  1707. extern WORD iDelayMenuHide; /* Delay till the hierarchical menu is hidden
  1708. when user drags outside of it */
  1709. extern HMENU hSysMenu;
  1710. extern HBITMAP hbmSysMenu;
  1711. extern RECT rcSysMenuInvert;
  1712. //***** Scroll bar globals
  1713. extern ATOM atomScrollBar; /* Atom for the scrollbar control wnd class */
  1714. extern HWND hwndSB;
  1715. extern HWND hwndSBNotify;
  1716. extern HWND hwndSBTrack;
  1717. extern int dpxThumb;
  1718. extern int posOld;
  1719. extern int posStart;
  1720. extern int pxBottom;
  1721. extern int pxDownArrow;
  1722. extern int pxLeft;
  1723. extern int pxOld;
  1724. extern int pxRight;
  1725. extern int pxStart;
  1726. extern int pxThumbBottom;
  1727. extern int pxThumbTop;
  1728. extern int pxTop;
  1729. extern int pxUpArrow;
  1730. extern BOOL fHitOld;
  1731. extern int cmdSB;
  1732. extern VOID (*pfnSB)(HWND, WORD, WPARAM, LPARAM);
  1733. extern RECT rcSB;
  1734. extern RECT rcThumb;
  1735. extern RECT rcTrack;
  1736. extern BOOL fTrackVert;
  1737. extern BOOL fCtlSB;
  1738. extern WORD hTimerSB;
  1739. extern BOOL fVertSB;
  1740. extern SBINFO *psbiSB;
  1741. extern SBINFO sbiHorz;
  1742. extern SBINFO sbiVert;
  1743. extern int cmsTimerInterval;
  1744. //***** Control globals
  1745. extern ATOM atomSysClass[];
  1746. //***** Constant strings
  1747. extern char szUNTITLED[];
  1748. extern char szERROR[];
  1749. extern char szOK[];
  1750. extern char szCANCEL[];
  1751. extern char szABORT[];
  1752. extern char szRETRY[];
  1753. extern char szIGNORE[];
  1754. extern char szYYES[];
  1755. extern char szCLOSE[];
  1756. extern char szNO[];
  1757. extern char szAM[];
  1758. extern char szPM[];
  1759. extern PSTR pTimeTagArray[];
  1760. extern char szAttr[];
  1761. extern char szOEMBIN[];
  1762. extern char szDISPLAY[];
  1763. extern char szOneChar[];
  1764. extern char szSLASHSTARDOTSTAR[];
  1765. extern char szYes[];
  1766. extern char szNullString[];
  1767. #ifdef DEBUG
  1768. extern char CODESEG ErrAssertFailed[];
  1769. extern char CODESEG ErrInvalParam[];
  1770. #endif
  1771. #ifdef JAPAN
  1772. extern char szJWordBreak[]; // Japanese word breaking char table
  1773. #endif
  1774. #ifdef KOREA
  1775. void FAR SetLevel(HWND);
  1776. BOOL FAR RequestHanjaMode(HWND, LPSTR);
  1777. WORD FAR PASCAL TranslateHangeul(WORD);
  1778. #endif
  1779. /*--------------------------------------------------------------------------*/
  1780. /* */
  1781. /* Global Variables from ASM files */
  1782. /* */
  1783. /*--------------------------------------------------------------------------*/
  1784. extern BYTE rgbKeyState[];
  1785. extern int iLevelCursor;
  1786. extern WORD rgwSysMet[];
  1787. /*--------------------------------------------------------------------------*/
  1788. /* */
  1789. /* INTDS interrupt-accessible globals
  1790. /* */
  1791. /*--------------------------------------------------------------------------*/
  1792. extern BOOL INTDSSEG fInt24;
  1793. extern BOOL INTDSSEG fMouseMoved;
  1794. extern BOOL INTDSSEG fEnableInput;
  1795. extern BOOL INTDSSEG fSwapButtons;
  1796. extern BOOL INTDSSEG fQueueDirty;
  1797. extern BOOL INTDSSEG fInScanTimers;
  1798. extern BYTE INTDSSEG vKeyDown;
  1799. extern BYTE INTDSSEG TimerTable[];
  1800. extern BYTE INTDSSEG rgbAsyncKeyState[];
  1801. extern BYTE* INTDSSEG TimerTableMax;
  1802. extern char INTDSSEG szDivZero[];
  1803. extern char INTDSSEG szNull[];
  1804. extern char INTDSSEG szSysError[];
  1805. extern DWORD INTDSSEG tSysTimer;
  1806. #ifdef DOS30
  1807. extern INTDSSEGPROC INTDSSEG lpSysProc;
  1808. #endif
  1809. extern HANDLE INTDSSEG hSysTimer;
  1810. extern TIMERINFO INTDSSEG timerInfo;
  1811. extern WORD __WinFlags;
  1812. #define WinFlags ((WORD)(&__WinFlags))
  1813. // Input globals
  1814. #ifdef DISABLE
  1815. extern WORD modeInput;
  1816. #endif
  1817. extern HQ INTDSSEG hqSysLock; /* HQ of guy who is looking at current event */
  1818. extern WORD INTDSSEG idSysLock; /* Msg ID of event that is locking sys queue */
  1819. extern POINT INTDSSEG ptTrueCursor;
  1820. extern POINT INTDSSEG ptCursor;
  1821. extern RECT INTDSSEG rcCursorClip;
  1822. extern WORD INTDSSEG MouseSpeed;
  1823. extern WORD INTDSSEG MouseThresh1;
  1824. extern WORD INTDSSEG MouseThresh2;
  1825. extern WORD INTDSSEG cMsgRsrv;
  1826. extern WORD INTDSSEG x_mickey_rate;
  1827. extern WORD INTDSSEG y_mickey_rate;
  1828. extern WORD INTDSSEG cur_x_mickey;
  1829. extern WORD INTDSSEG cur_y_mickey;
  1830. extern WORD INTDSSEG cxScreenCS;
  1831. extern WORD INTDSSEG cyScreenCS;
  1832. extern WORD INTDSSEG cQEntries;
  1833. extern WORD INTDSSEG dtSysTimer;
  1834. extern DWORD INTDSSEG dtJournal;
  1835. extern WORD INTDSSEG msgJournal;
  1836. extern BOOL INTDSSEG fJournalPlayback;
  1837. extern WORD INTDSSEG rgMsgUpDowns[];
  1838. extern DWORD INTDSSEG lpMouseStack;
  1839. extern LPVOID INTDSSEG prevSSSP;
  1840. extern BYTE INTDSSEG nestCount;
  1841. extern WORD INTDSSEG cHotKeyHooks;
  1842. extern HQ INTDSSEG hqActive;
  1843. extern HQ INTDSSEG hqList;
  1844. extern HQ INTDSSEG hqCursor;
  1845. extern HQ INTDSSEG hqSysQueue;
  1846. extern HQ INTDSSEG hqSysModal;
  1847. extern HQ INTDSSEG hqMouse;
  1848. extern HQ INTDSSEG hqKeyboard;
  1849. extern HQ INTDSSEG hqCapture;
  1850. /*--------------------------------------------------------------------------*/
  1851. /* */
  1852. /* Assembly Function Declarations */
  1853. /* */
  1854. /*--------------------------------------------------------------------------*/
  1855. #ifdef WOWEDIT
  1856. void FAR LCopyStruct(CONST VOID FAR* lpSrc, LPVOID lpDest, WORD cb);
  1857. #else
  1858. /*
  1859. why is this required? Its here for the intrinsic pragma
  1860. to recognize memcpy ... jonle on a saturday!
  1861. */
  1862. #ifndef WOWDBG
  1863. LPVOID memcpy(LPVOID lpDst, LPVOID lpSrc, int cb);
  1864. #endif
  1865. #pragma intrinsic(memcpy)
  1866. #define LCopyStruct(s,d,n) memcpy((LPVOID)(d),(LPVOID)(s),(int)(n))
  1867. #endif
  1868. WORD FAR GetAppVer(void);
  1869. #ifndef MSDWP
  1870. /* Suppport routines for separate segment stuff. */
  1871. #undef min
  1872. #undef max
  1873. #define min(a, b) ((int)(a) < (int)(b) ? (int)(a) : (int)(b))
  1874. #define max(a, b) ((int)(a) > (int)(b) ? (int)(a) : (int)(b))
  1875. #define umin(a, b) ((unsigned)(a) < (unsigned)(b) ? (unsigned)(a) : (unsigned)(b))
  1876. #define umax(a, b) ((unsigned)(a) > (unsigned)(b) ? (unsigned)(a) : (unsigned)(b))
  1877. int FAR MultDiv(WORD a, WORD b, WORD c);
  1878. void FAR LFillStruct(LPVOID, WORD, WORD);
  1879. HDC FAR GetClientDc(void);
  1880. HQ FAR HqCurrent(void);
  1881. BOOL FAR ActivateWindow(HWND, WORD);
  1882. BOOL CheckHwndFilter(HWND, HWND);
  1883. BOOL CheckMsgFilter(WORD, WORD, WORD);
  1884. BOOL WriteMessage(HQ, LONG, WORD, WORD, HWND, DWORD);
  1885. BOOL ReceiveMessage(VOID);
  1886. VOID FlushSentMessages(VOID);
  1887. LPSTR WINAPI lstrcpyn(LPSTR, LPCSTR, int);
  1888. #define PSTextOut(a, b, c, d, e) TextOut(a, b, c, d, e)
  1889. #define PSGetTextExtent(a, b, c) GetTextExtent(a, b, c)
  1890. #define PSFillRect(a, b, c) FillRect(a, b, c)
  1891. #define PSInvertRect(a, b) InvertRect(a, b)
  1892. WORD FAR GetNextSysMsg(WORD, INTERNALSYSMSG FAR *);
  1893. void FAR SkipSysMsg(SYSMSG FAR *, BOOL);
  1894. void TransferWakeBit(WORD);
  1895. void ClearWakeBit(WORD, BOOL);
  1896. void SetWakeBit(HQ, WORD);
  1897. void FAR FarSetWakeBit(HQ, WORD);
  1898. void FAR InitSysQueue(void);
  1899. BOOL FAR CreateQueue(int);
  1900. void DeleteQueue(void);
  1901. void SuspendTask(void);
  1902. void ReleaseTask(void);
  1903. void FAR GlobalInitAtom(void);
  1904. void MoveRect(LONG);
  1905. void SizeRect(LONG);
  1906. BOOL FAR SysHasKanji(void);
  1907. void FAR SetDivZero(void);
  1908. int FAR FindCharPosition(LPCSTR, char);
  1909. void FAR OEMSetCursor(LPSTR);
  1910. void FAR SetFMouseMoved(void);
  1911. BOOL AttachDC(HWND);
  1912. BOOL LastApplication(void);
  1913. void CheckCursor(HWND);
  1914. void FAR IncPaintCount(HWND);
  1915. void FAR DecPaintCount(HWND);
  1916. void FAR DeleteProperties(HWND);
  1917. void FAR DestroyTimers(HQ, HWND);
  1918. int FAR InquireSystem(int, int);
  1919. int FAR EnableKeyboard(FARPROC, LPSTR);
  1920. int FAR InquireKeyboard(LPSTR);
  1921. void FAR DisableKeyboard(void);
  1922. int FAR EnableMouse(FARPROC);
  1923. int FAR InquireMouse(LPSTR);
  1924. void FAR DisableMouse(void);
  1925. int FAR InquireCursor(LPSTR);
  1926. void FAR EnableSystemTimers(void);
  1927. void FAR DisableSystemTimers(void);
  1928. void FAR CreateSystemTimer(int, TIMERPROC);
  1929. WORD FAR SetSystemTimer(HWND, int, int, TIMERPROC);
  1930. BOOL FAR KillSystemTimer(HWND, int);
  1931. void FAR CrunchX2(CURSORSHAPE FAR *, CURSORSHAPE FAR *, int, int);
  1932. void FAR CrunchY(CURSORSHAPE FAR *, CURSORSHAPE FAR *, int, int, int);
  1933. void FAR MenuBarDraw(HWND hwnd, HDC hdc, int cxFrame, int cyFrame);
  1934. BOOL FAR ReadMessage(HQ, LPMSG, HWND, WORD, WORD, BOOL);
  1935. int GetCurrentDrive(void);
  1936. int GetCurrentDirectory(LPSTR, int);
  1937. int SetCurrentDrive(int);
  1938. int SetCurrentDirectory(LPCSTR);
  1939. BOOL FFirst(LPSTR, LPSTR, WORD);
  1940. BOOL FNext(LPSTR, WORD);
  1941. FAR DestroyAllWindows(void);
  1942. BOOL FAR LockWindowVerChk(HWND);
  1943. #ifndef NOFASTFRAME
  1944. void FAR SplitRectangle(LPRECT, LPRECT, int, int); /* WinRect.asm */
  1945. #endif
  1946. #endif /* MSDWP */
  1947. /*--------------------------------------------------------------------------*/
  1948. /* */
  1949. /* Internal Function Declarations */
  1950. /* */
  1951. /*--------------------------------------------------------------------------*/
  1952. #ifndef MSDWP
  1953. LRESULT CALLBACK ButtonWndProc(HWND hwnd, WORD message, WPARAM wParam, LPARAM lParam);
  1954. LRESULT CALLBACK StaticWndProc(HWND hwnd, WORD message, WPARAM wParam, LPARAM lParam);
  1955. LRESULT CALLBACK TitleWndProc(HWND hwnd, WORD message, WPARAM wParam, LPARAM lParam);
  1956. LRESULT CALLBACK SwitchWndProc(HWND hwnd, WORD message, WPARAM wParam, LPARAM lParam);
  1957. LRESULT CALLBACK DesktopWndProc(HWND hwndIcon, WORD message, WPARAM wParam, LPARAM lParam);
  1958. LRESULT CALLBACK MenuWindowProc(HWND hwnd, WORD message, WPARAM wParam, LPARAM lParam);
  1959. LRESULT FAR EditWndProc(HWND hwnd, WORD message, WPARAM wParam, LPARAM lParam);
  1960. LRESULT CALLBACK LBoxCtlWndProc(HWND hwnd, WORD message, WPARAM wParam, LPARAM lParam);
  1961. LRESULT CALLBACK ComboBoxCtlWndProc(HWND hwnd, WORD message, WPARAM wParam, LPARAM lParam);
  1962. LRESULT CALLBACK SBWndProc(PSB psb, WORD message, WPARAM wParam, LPARAM lParam);
  1963. LRESULT CALLBACK MDIClientWndProc(HWND hwnd, WORD message, WPARAM wParam, LPARAM lParam);
  1964. void FAR SkipSM2(void);
  1965. HWND FAR GetFirstTab(HWND hwnd);
  1966. CONST BYTE FAR* SkipSz(CONST BYTE FAR *lpsz);
  1967. void FAR DlgSetFocus(HWND hwnd);
  1968. HWND FAR PrevChild(HWND hwndDlg, HWND hwnd);
  1969. HWND FAR NextChild(HWND hwndDlg, HWND hwnd);
  1970. HWND FAR GetFirstLevelChild(HWND hwndDlg, HWND hwndLevel);
  1971. void FAR CheckDefPushButton(HWND hwndDlg, HWND hwndOldFocus, HWND hwndNewFocus);
  1972. HWND FAR GotoNextMnem(HWND hwndDlg, HWND hwndStart, char ch);
  1973. int FAR FindMnemChar(LPSTR lpstr, char ch, BOOL fFirst, BOOL fPrefix);
  1974. int FAR FindNextValidMenuItem(PMENU pMenu, int i, int dir, BOOL fHelp);
  1975. BOOL CALLBACK MenuPrint(HDC hdc, LPARAM lParam, int cch);
  1976. int FAR MenuBarCompute(HMENU hMenu, HWND hwndNotify, int yMenuTop, int xMenuLeft, int cxMax);
  1977. HMENU CALLBACK LookupMenuHandle(HMENU hMenu, WORD cmd);
  1978. BOOL CALLBACK StaticPrint(HDC hdc, LPRECT lprc, HWND hwnd);
  1979. HICON FAR ColorToMonoIcon(HICON);
  1980. HGLOBAL CALLBACK LoadCursorIconHandler(HGLOBAL hRes, HINSTANCE hResFile, HRSRC hResIndex);
  1981. HGLOBAL CALLBACK LoadDIBCursorHandler(HGLOBAL hRes, HINSTANCE hResFile, HRSRC hResIndex);
  1982. HGLOBAL CALLBACK LoadDIBIconHandler(HGLOBAL hRes, HINSTANCE hResFile, HRSRC hResIndex);
  1983. void CallOEMCursor(void);
  1984. void FAR DestroyClipBoardData(void);
  1985. BOOL FAR SendClipboardMessage(int message);
  1986. void FAR DrawClipboard(void);
  1987. PCLIP FAR FindClipFormat(WORD format);
  1988. BOOL IsDummyTextHandle(PCLIP pClip);
  1989. HANDLE InternalSetClipboardData(WORD format, HANDLE hData);
  1990. PPCLS FAR GetClassPtr(LPCSTR lpszClassName, HINSTANCE hInstance, BOOL fUserModule);
  1991. PPCLS GetClassPtrASM(ATOM, HMODULE, BOOL);
  1992. void FAR DelWinClass(PPCLS ppcls);
  1993. VOID CALLBACK CaretBlinkProc(HWND hwnd, WORD message, WORD id, DWORD time);
  1994. void FAR InternalHideCaret(void);
  1995. void FAR InternalShowCaret(void);
  1996. void FAR InternalDestroyCaret(void);
  1997. HDC FAR GetScreenDC(void);
  1998. PBWL FAR BuildHwndList(HWND hwnd, int flags);
  1999. void FAR FreeHwndList(PBWL pbwl);
  2000. void CALLBACK DrawFrame(HDC hdc, LPRECT lprect, int clFrame, int cmd);
  2001. void FAR RedrawFrame(HWND hwnd);
  2002. void FAR BltColor(HDC, HBRUSH, HDC, int, int, int, int, int, int, BOOL);
  2003. void FAR EnableInput(void);
  2004. void FAR DisableInput(void);
  2005. void FAR CopyKeyState(void);
  2006. void CALLBACK EnableOEMLayer(void);
  2007. void CALLBACK DisableOEMLayer(void);
  2008. void FAR ColorInit(void);
  2009. BOOL FAR SetKeyboardSpeed(BOOL fInquire);
  2010. void FAR InitBorderSysMetrics(void);
  2011. void FAR InitSizeBorderDimensions(void);
  2012. void FAR SetMinMaxInfo(void);
  2013. // Returns TRUE if a GetDC() will return an empty visrgn or not
  2014. // (doesn't take into account being clipped away; just checks WFVISIBE
  2015. // and WFMINIMIZED)
  2016. //
  2017. BOOL FAR IsVisible(HWND hwnd, BOOL fClient);
  2018. // Returns TRUE if hwndChild == hwndParent or is one of its children.
  2019. //
  2020. BOOL FAR IsDescendant(HWND hwndParent, HWND hwndChild);
  2021. void FAR SetRedraw(HWND hwnd, BOOL fRedraw);
  2022. HBRUSH CALLBACK GetControlColor(HWND hwndParent, HWND hwndCtl, HDC hdc, WORD type);
  2023. HBRUSH CALLBACK GetControlBrush(HWND hwnd, HDC hdc, WORD type);
  2024. void FAR StoreMessage(LPMSG lpMsg, HWND hwnd, WORD message, WPARAM wParam, LPARAM lParam, DWORD time);
  2025. LONG FAR GetPrefixCount(LPCSTR lpstr, int cch, LPSTR lpstrCopy, int copycount);
  2026. void FAR PSMTextOut(HDC hdc, int xLeft, int yTop, LPCSTR lpsz, int cch);
  2027. DWORD FAR PSMGetTextExtent(HDC hdc, LPCSTR lpstr, int cch);
  2028. HWND FAR GetTopLevelTiled(HWND hwnd);
  2029. BOOL FAR TrueIconic(HWND hwnd);
  2030. void FAR ChangeToCurrentTask(HWND hwnd1, HWND hwnd2);
  2031. HWND FAR GetLastTopMostWindow(void);
  2032. void FAR SendSizeMessage(HWND hwnd, WORD cmdSize);
  2033. HWND FAR NextTopWindow(HWND hwnd, HWND hwndSkip, BOOL fPrev, BOOL fDisabled);
  2034. void FAR DisableVKD(BOOL fDisable);
  2035. void FAR CheckFocus(HWND hwnd);
  2036. BOOL CALLBACK FChildVisible(HWND hwnd);
  2037. #define InternalGetClientRect(hwnd, lprc) CopyRect(lprc, &hwnd->rcClient)
  2038. void FAR CheckByteAlign(HWND hwnd, LPRECT lprc);
  2039. void FAR CancelMode(HWND hwnd);
  2040. void FAR RedrawIconTitle(HWND hwnd);
  2041. void FAR DisplayIconicWindow(HWND hwnd, BOOL fActivate, BOOL fShow);
  2042. DWORD FAR GetIconTitleSize(HWND hwnd);
  2043. BOOL FAR SendZoom(HWND hwnd, LPARAM lParam);
  2044. BOOL CALLBACK DestroyTaskWindowsEnum(HWND hwnd, LPARAM lParam);
  2045. void CALLBACK LockMyTask(BOOL fLock);
  2046. void CALLBACK RepaintScreen(void);
  2047. HANDLE FAR BcastCopyString(LPARAM lParam);
  2048. BOOL CALLBACK SignalProc(HTASK hTask, WORD message, WPARAM wParam, LPARAM lParam);
  2049. BOOL CALLBACK NewSignalProc(HTASK hTask, WORD message, WPARAM wParam, LPARAM lParam);
  2050. HWND FAR GetWindowCreator(HWND hwnd);
  2051. void FAR InitSendValidateMinMaxInfo(HWND hwnd);
  2052. void FAR DrawDragRect(LPRECT lprc, WORD flags);
  2053. void FAR MoveSize(HWND hwnd, WORD cmdMove);
  2054. BYTE FAR SetClrWindowFlag(HWND hwnd, WORD style, BYTE cmd);
  2055. void FAR ParkIcon(HWND hwnd, CHECKPOINT * pcp);
  2056. void FAR ShowOwnedWindows(HWND hwndOwner, WORD cmdShow);
  2057. HWND FAR MinMaximize(HWND hwnd, WORD cmd, BOOL fKeepHidden);
  2058. void FAR SetTiledRect(HWND hwnd, LPRECT lprc);
  2059. #endif // MSDWP
  2060. void FAR AdjustSize(HWND hwnd, LPINT lpcx, LPINT lpcy);
  2061. #ifndef MSDWP
  2062. void FAR NextWindow(WORD flags);
  2063. void FAR DoScroll(HWND hwnd, HWND hwndNotify, int cmd, int pos, BOOL fVert);
  2064. void CALLBACK ContScroll(HWND hwnd, WORD message, WORD id, DWORD time);
  2065. void FAR MoveThumb(HWND hwnd, int px, BOOL fCancel);
  2066. void FAR SBTrackInit(HWND hwnd, LPARAM lParam, int curArea);
  2067. void FAR DrawSize(HWND hwnd, HDC hdc, int cxFrame, int cyFrame, BOOL fBorder);
  2068. void FAR CalcSBStuff(HWND hwnd, BOOL fVert);
  2069. WORD GetWndSBDisableFlags(HWND, BOOL);
  2070. void FreeWindow(HWND hwnd);
  2071. void FAR DestroyTaskWindows(HQ hq);
  2072. BOOL FAR TrackInitSize(HWND hwnd, WORD message, WPARAM wParam, LPARAM lParam);
  2073. void FAR DrawPushButton(HDC hdc, LPRECT lprc, WORD style, BOOL fInvert, HBRUSH hbrBtn, HWND hwnd);
  2074. void FAR DrawBtnText(HDC hdc, HWND hwnd, BOOL dbt, BOOL fDepress);
  2075. void FAR Capture(HWND hwnd, int code);
  2076. int FAR SystoChar(WORD message, LPARAM lParam);
  2077. void FAR LinkWindow(HWND, HWND, HWND *);
  2078. void FAR UnlinkWindow(HWND, HWND *);
  2079. void FAR DrawScrollBar(HWND hwnd, HDC hdc, BOOL fVert);
  2080. void CALLBACK PaintRect(HWND hwndBrush, HWND hwndPaint, HDC hdc, HBRUSH hbr, LPRECT lprc);
  2081. BOOL FAR SetDeskPattern(LPSTR);
  2082. BOOL FAR SetDeskWallpaper(LPSTR);
  2083. void FAR SetGridGranularity(WORD);
  2084. int FAR GetAveCharWidth(HDC);
  2085. #ifndef NOTEXTMETRIC
  2086. int FAR GetCharDimensions(HDC, TEXTMETRIC FAR *);
  2087. #endif
  2088. BOOL FAR LW_ReloadLangDriver(LPSTR);
  2089. HBRUSH FAR GetSysClrObject(int);
  2090. int API SysErrorBox(LPCSTR lpszText, LPCSTR lpszCaption, unsigned int btn1, unsigned int btn2, unsigned int btn3);
  2091. BOOL FAR SnapWindow(HWND hwnd);
  2092. WORD FAR MB_FindLongestString(void);
  2093. #ifdef FASTFRAME
  2094. HBITMAP FAR CreateCaptionBitmaps(void);
  2095. HBITMAP FAR CreateBorderVertBitmaps(BOOL fDlgFrame);
  2096. HBITMAP FAR CreateBorderHorzBitmaps(BOOL fDlgFrame);
  2097. void FAR GetCaptionBitmapsInfo(FRAMEBITMAP Caption[], HBITMAP hBitmap);
  2098. void FAR GetHorzBitmapsInfo(FRAMEBITMAP Bitmap[], BOOL fDlgFrame, HBITMAP hBitmap);
  2099. void FAR GetVertBitmapsInfo(FRAMEBITMAP Bitmap[], BOOL fDlgFrame, HBITMAP hBitmap);
  2100. BOOL FAR DrawIntoCaptionBitmaps(HDC hdc,HBITMAP hBitmap, FRAMEBITMAP FrameInfo[], BOOL fActive);
  2101. BOOL FAR DrawIntoHorzBitmaps(HDC hdc, HBITMAP hBitmap, FRAMEBITMAP FrameInfoH[], BOOL fActive, BOOL fDlgFrame);
  2102. BOOL FAR DrawIntoVertBitmaps(HDC hdc, HBITMAP hBitmap, FRAMEBITMAP FrameInfoH[], FRAMEBITMAP FrameInfoV[], BOOL fActive, BOOL fDlgFrame);
  2103. BOOL FAR RecreateFrameBitmaps(void);
  2104. void FAR DeleteFrameBitmaps(int, int);
  2105. BOOL FAR PASCAL UpdateFrameBitmaps(WORD wColorFlags);
  2106. BOOL FAR PASCAL RecolorFrameBitmaps(WORD wColorFlags);
  2107. #endif /* FASTFRAME */
  2108. void PostButtonUp(WORD msg);
  2109. #endif /* MSDWP */
  2110. void CALLBACK EndMenu(void);
  2111. void CALLBACK FillWindow(HWND hwndBrush, HWND hwndPaint, HDC hdc, HBRUSH hbr);
  2112. void FAR SysCommand(HWND hwnd, int cmd, LPARAM lParam);
  2113. void FAR HandleNCMouseGuys(HWND hwnd, WORD message, int htArea, LPARAM lParam);
  2114. void FAR EndScroll(HWND hwnd, BOOL fCancel);
  2115. HWND FAR GetTopLevelWindow(HWND hwnd);
  2116. void FAR RedrawIconTitle(HWND hwnd);
  2117. int FAR FindNCHit(HWND hwnd, LONG lPt);
  2118. void FAR CalcClientRect(HWND hwnd, LPRECT lprc);
  2119. BOOL FAR DepressTitleButton(HWND hwnd, RECT rcCapt, RECT rcInvert, WORD hit);
  2120. void FAR SetSysMenu(HWND hwnd);
  2121. HMENU FAR GetSysMenuHandle(HWND hwnd);
  2122. int *FAR InitPwSB(HWND hwnd);
  2123. BOOL FAR DefSetText(HWND hwnd, LPCSTR lpsz);
  2124. void FAR DrawWindowFrame(HWND hwnd, HRGN hrgnClip);
  2125. void FAR ShowIconTitle(HWND hwnd, BOOL fShow);
  2126. HBRUSH FAR GetBackBrush(HWND hwnd);
  2127. BOOL FAR IsSystemFont(HDC);
  2128. BOOL FAR IsSysFontAndDefaultMode(HDC);
  2129. VOID FAR DiagOutput(LPCSTR);
  2130. VOID FAR UserDiagOutput(int, LPCSTR);
  2131. #define UDO_INIT 0
  2132. #define UDO_INITDONE 1
  2133. #define UDO_STATUS 2
  2134. HANDLE FAR TextAlloc(LPCSTR);
  2135. HANDLE FAR TextFree(HANDLE);
  2136. WORD FAR TextCopy(HANDLE, LPSTR, WORD);
  2137. #define TextPointer(h) (LPSTR)MAKELP(hWinAtom, h)
  2138. BOOL CALLBACK FARValidatePointer(LPVOID);
  2139. // GDI exports
  2140. #ifdef DEBUG
  2141. VOID CALLBACK SetObjectOwner(HGDIOBJ, HINSTANCE);
  2142. #else
  2143. #define SetObjectOwner(d1, d2)
  2144. #endif
  2145. BOOL CALLBACK MakeObjectPrivate(HGDIOBJ, BOOL);
  2146. VOID CALLBACK GDITaskTermination(HTASK);
  2147. VOID CALLBACK RealizeDefaultPalette(HDC);
  2148. // Internal functions called directly by debug version to
  2149. // prevent validation errors
  2150. //
  2151. #ifdef DEBUG
  2152. HDC API IGetDCEx(register HWND hwnd, HRGN hrgnClip, DWORD flags);
  2153. BOOL API IGrayString(HDC, HBRUSH, GRAYSTRINGPROC, LPARAM, int, int, int, int, int);
  2154. BOOL API IRedrawWindow(HWND hwnd, CONST RECT FAR* lprcUpdate, HRGN hrgnUpdate, WORD flags);
  2155. int API IScrollWindowEx(HWND hwnd, int dx, int dy,
  2156. CONST RECT FAR* prcScroll, CONST RECT FAR* prcClip,
  2157. HRGN hrgnUpdate, RECT FAR* prcUpdate, WORD flags);
  2158. #endif
  2159. #ifdef DBCS_IME
  2160. #define WM_IMECONTROL WM_USER
  2161. void FAR InitIME(void); // wmcaret.c
  2162. BOOL _loadds FAR EnableIME( HWND, BOOL ); // wmcaret.c
  2163. VOID API SetImeBoundingRect(HWND, DWORD, LPRECT); // wmcaret.c
  2164. BOOL API ControlIME(HWND, BOOL); // wmcaret.c
  2165. HANDLE API SetFontForIME(HWND, HANDLE); // wmcaret.c
  2166. VOID API ControlCaretIme(BOOL); // wmcaret.c
  2167. BOOL API EatString(HWND, LPSTR, WORD); // editec.c
  2168. VOID API CheckKatanaInstalled(HWND); // wmcaret.c
  2169. #endif
  2170. #ifdef JAPAN
  2171. // Save time of WM_LBUTTONDOWN and WM_LBUTTONUP, used to decided
  2172. // whether to lock large popup menus that cover the static portion
  2173. // of the menu...
  2174. extern int fLongPMenu;
  2175. extern DWORD lbuttondown_time;
  2176. #endif
  2177. /****************************************************************************
  2178. debugging support
  2179. ****************************************************************************/
  2180. #ifdef DEBUG
  2181. extern void cdecl dDbgOut(int iLevel, LPSTR lpszFormat, ...);
  2182. extern void cdecl dDbgAssert(LPSTR exp, LPSTR file, int line);
  2183. DWORD __dwEval;
  2184. #define dprintf dDbgOut
  2185. #define WinAssert(exp) \
  2186. ((exp) ? (void)0 : dDbgAssert(#exp, __FILE__, __LINE__))
  2187. #define WinEval(exp) \
  2188. ((__dwEval=(DWORD)(LPVOID)(exp)) ? (void)0 : dDbgAssert(#exp, __FILE__, __LINE__), __dwEval)
  2189. #else
  2190. #define dprintf /##/
  2191. // #define dprintf if (0) ((int (*)(char *, ...)) 0)
  2192. #define WinAssert(exp) 0
  2193. #define WinEval(exp) (exp)
  2194. #endif