Coop.Windows.Display.Mod 81 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289
  1. MODULE Display; (** fof , source Win32.Windows.Mod+Win32.Displays.Mod+Windows.Display.Mod+Win32.Viewers.Mod **)
  2. IMPORT SYSTEM, Environment, Activities, Counters, Kernel32, User32, Modules, KernelLog, GDI32, Displays, Strings,
  3. AosInputs := Inputs, Commands, Objects,WinFS, Options;
  4. CONST
  5. dbgDisableReleaseMsg = TRUE;
  6. CONST
  7. WMSetup = User32.WMUser + 1; WMCreateWindow = User32.WMUser + 2;
  8. (* Windows, WinMenus: User32.WMUser .. User32.WMUser+9
  9. NetSystem: User32.WMUser+10 .. User32.WMUser+19
  10. NPPlugIns: User32.WMUser+20 .. User32.WMUser+29
  11. OLE*: User32.WMUser+30 .. User32.WMUser+39 *)
  12. IDFirstAccelCmd = 0; (* addAccel *)
  13. IDFirstMenuCmd* = 64; (** first ID to be used by menus (see: WinMenus) *)
  14. Insert = 0A0X; Delete = 0A1X; Backspace = 07FX; Home = 0A8X; End = 0A9X; PageUp = 0A2X; PageDown = 0A3X;
  15. Up = 0C1X; Down = 0C2X; Right = 0C3X; Left = 0C4X; (* cursor keys *) Enter = 0DX; F1 = 0A4X; F2 = 0A5X;
  16. F3 = 0A6X; F4 = 0A7X; F5 = 0F5X; F6 = 0F6X; F7 = 0F7X; F8 = 0F8X; F9 = 0F9X; F10 = 0FAX; F11 = 0FBX; F12 = 0FCX;
  17. update = 0; dummy = 1; minimized = 2; external = 3; control = 4; maximized = 5; MaxAccel = 32; MaxCmd = 128;
  18. ML = 0; MM = 1; MR = 2; MX = 3; WHEEL = 31; GWLWindow* = 0; GWLControl* = 4; SHIFT* = 0; CTRL* = 1;
  19. ALT* = 2; (** constants for KeyState *)
  20. create* = 0; remove* = 1; (** display has been created or destroyed *)
  21. restore* = 2; suspend* = 3; (** display has been minimized or restored *)
  22. redraw* = 4; resize* = 5; (** display needs redraw *)
  23. print* = 6; (** print the display in the give context *)
  24. focus* = 7; defocus* = 8; (** display got or lost the keyboard focus *)
  25. consume* = 9; track* = 10; (** keyboard or mouse data available *)
  26. dupdate* = 11; (** notification, that an object has been updated *)
  27. execute* = 12; (** request to execute a command *)
  28. quit* = 13; (** notification, that the Event service is shutdown *)
  29. ping* = 14; (** checks whether the event dispatcher (Oberon.Loop) is running *)
  30. wheel* = 15; (** mouse wheel *)
  31. get* = 0; set* = 1;
  32. pressed = 15; toggled = 0;
  33. letWindowsHandleTheBuffer = FALSE;
  34. CONST
  35. kPageUp = User32.VKPrior; kPageDown = User32.VKNext; kEnd = User32.VKEnd; kHome = User32.VKHome;
  36. kLeft = User32.VKLeft; kRight = User32.VKRight; kUp = User32.VKUp; kDown = User32.VKDown;
  37. kInsert = User32.VKInsert; kDelete = User32.VKDelete; kF1 = User32.VKF1; kF2 = User32.VKF2; kF3 = User32.VKF3;
  38. kF4 = User32.VKF4; kF5 = User32.VKF5; kF6 = User32.VKF6; kF7 = User32.VKF7; kF8 = User32.VKF8; kF9 = User32.VKF9;
  39. kF10 = User32.VKF10; kF11 = User32.VKF11; kF12 = User32.VKF12; kCtrl = 17; kAlt = 18; kWindows = 91; kShift = 16;
  40. kMenu = 93; kNumlock = 144; kEnter = 13; kPAdd = 107; kPMinus = 109; kPDiv = 111; kPMult = 106; kPause = 19;
  41. kCapsLock = 20; kEscape = 27; kTab = 9; kReturn = User32.VKReturn;
  42. VK0 = 030H; VK9 = 39H;
  43. VKMenu = 18;
  44. VKScroll = 145;
  45. VKLShift = 160; VKRShift = 161; VKLCtrl = 162; VKRCtrl = 163; VKLMenu = 164; VKRMenu = 165;
  46. VKLWin = 05BH; VKRWin = 05CH;
  47. SMCXFullscreen = 16; SMCYFullscreen = 17; SMCYScreen = 1; SMCXScreen = 0; MODWin = 8;
  48. WMHOTKEY = 786;
  49. Sizemaximized = 2; Sizeminimized = 1; Sizerestored = 0;
  50. WindowTitle = "WinAOS (Cooperative)";
  51. WM_DEVICECHANGE = 0219H;
  52. DBT_CONFIGCHANGECANCELED = 00019H ;
  53. DBT_CONFIGCHANGED =00018H ;
  54. DBT_CUSTOMEVENT =08006H ;
  55. DBT_DEVICEARRIVAL =08000H ;
  56. DBT_DEVICEQUERYREMOVE =08001H ;
  57. DBT_DEVICEQUERYREMOVEFAILED = 08002H ;
  58. DBT_DEVICEREMOVECOMPLETE = 08004H ;
  59. DBT_DEVICEREMOVEPENDING = 08003H ;
  60. DBT_DEVICETYPESPECIFIC =08005H ;
  61. DBT_DEVNODES_CHANGED = 00007H ;
  62. DBT_QUERYCHANGECONFIG = 00017H;
  63. DBT_USERDEFINED = 0FFFFH ;
  64. DBT_DEVTYP_VOLUME = 00002H;
  65. TYPE
  66. DEV_BROADCAST_HDR = RECORD
  67. dbch_size: LONGINT;
  68. dbch_devicetype: LONGINT ;
  69. dbch_reserved: LONGINT;
  70. END;
  71. DEV_BROADCAST_HDRP = POINTER TO DEV_BROADCAST_HDR;
  72. DEV_BROADCAST_VOLUME = RECORD (DEV_BROADCAST_HDR)
  73. dbcv_unitmask: SET;
  74. dbcv_flags: INTEGER;
  75. padding: INTEGER;
  76. END;
  77. DEV_BROADCAST_VOLUMEP= POINTER TO DEV_BROADCAST_VOLUME;
  78. Inputs = RECORD
  79. keys: SET;
  80. X, Y, Z, dx, dy: LONGINT;
  81. flags: SET;
  82. END;
  83. (** The BITMAPINFO structure defines the dimensions and color information for a Win32 DIB. *)
  84. BitmapInfo* = RECORD
  85. bmiHeader*: GDI32.BitmapInfoHeader;
  86. colors: ARRAY 3 OF LONGINT;
  87. (* old: colors: ANY; *)
  88. END;
  89. Window = POINTER TO RECORD
  90. hWnd: User32.HWND; (** handle of this window *)
  91. hWndParent: User32.HWND; (** handle of the parent window, = hWnd for document windows *)
  92. hDC: User32.HDC;
  93. width, height: LONGINT; (** current size *)
  94. defWindowProc: User32.WndProc; (** default window procedure for all messages not handled here *)
  95. windowRect: User32.Rect;
  96. state: SET (* update, dummy, minimized, external, control *) ;
  97. link: Window;
  98. bmp: GDI32.HBitmap;
  99. bmadr: LONGINT;
  100. bmphdc: User32.HDC;
  101. track: Inputs;
  102. pal: POINTER TO ARRAY OF GDI32.PaletteEntry;
  103. dx, dy: LONGINT;
  104. hBrush: GDI32.HBrush;
  105. frame: BOOLEAN;
  106. processor: Activities.Activity;
  107. END;
  108. DisplayProc* = PROCEDURE ( disp: Window );
  109. PaintProc* = PROCEDURE ( disp: Window; x, y, w, h: LONGINT );
  110. CreateStruct = POINTER TO RECORD
  111. win: Window;
  112. finished: BOOLEAN;
  113. className: ARRAY 32 OF CHAR;
  114. style: SET;
  115. x, y, w, h: LONGINT;
  116. hMenu: User32.HMenu
  117. END;
  118. (** handler called for registered window messages *)
  119. WindowHandlerProc* = PROCEDURE {WINAPI} ( win: Window; uMsg: LONGINT; wParam: User32.WParam;
  120. lParam: User32.LParam ): User32.LResult;
  121. Display = OBJECT (Displays.Display) (* only one instance of this object allowed ! *)
  122. PROCEDURE Transfer( VAR buf: ARRAY OF CHAR; ofs, stride, x, y, w, h, op: LONGINT );
  123. BEGIN
  124. IF letWindowsHandleTheBuffer THEN
  125. IF op = Displays.set THEN
  126. ToMemory( root, buf, ofs, stride, x, y, w, h ); ToWindow( root, x, y, w, h, root.dx, root.dy );
  127. ELSE FromMemory( root, buf, ofs, stride, x, y, w, h );
  128. END;
  129. ELSE
  130. IF root.bmadr = 0 THEN GetDC( root ) END;
  131. InitFrameBuffer( root.bmadr, disp.width * disp.height * format, disp.width * disp.format); Transfer^( buf, ofs, stride, x, y, w, h, op );
  132. IF Displays.reverse THEN
  133. IF op = Displays.set THEN ToWindow( root, disp.width-x-w,disp.height-y-h, w, h, root.dx, root.dy ); END;
  134. ELSE
  135. IF op = Displays.set THEN ToWindow( root, x, y, w, h, root.dx, root.dy ); END;
  136. END;
  137. END;
  138. END Transfer;
  139. END Display;
  140. VAR
  141. dummyClass, windowClass: User32.WndClassEx;
  142. dummyClassName, windowClassName, controlClassName, windowTitle : ARRAY 32 OF CHAR;
  143. nWindows: LONGINT; aControlWinClass: LONGINT; fixedFrameX, fixedFrameY, frameX, frameY, captionY, menuY: LONGINT;
  144. hCurrentCursor, hAlternativeCursor: User32.HCursor; capture, hook, mouse: Window; kioskmode*: BOOLEAN;
  145. dummyWin*: Window;
  146. ISOToOberon: ARRAY 256 OF CHAR;
  147. moduleCS: Kernel32.CriticalSection; root: Window;
  148. bmi: RECORD
  149. info: BitmapInfo;
  150. pal: ARRAY 256 OF GDI32.ColorRef
  151. END;
  152. disp: Display;
  153. format* : SHORTINT;
  154. KeyHandled: BOOLEAN;
  155. fullscreen: BOOLEAN; (*ALEX 2005.11.30*)
  156. closeRequests: LONGINT;
  157. PROCEDURE CreateHWND( create: CreateStruct );
  158. VAR str: ARRAY 32 OF CHAR;
  159. ret: Kernel32.BOOL;
  160. BEGIN
  161. str := "";
  162. create.win.hWnd :=
  163. User32.CreateWindowEx( 0, create.className, str, create.style, create.x, create.y, create.w, create.h,
  164. create.win.hWndParent, create.hMenu, Kernel32.hInstance,
  165. SYSTEM.VAL( User32.LParam, create ) );
  166. IF User32.WSMaximize IN create.style THEN
  167. INCL( create.win.state, maximized ); ret := User32.ShowWindow( create.win.hWnd, User32.SWShowMaximized )
  168. ELSIF User32.WSVisible IN create.style THEN ret := User32.ShowWindow( create.win.hWnd, User32.SWShow )
  169. END;
  170. IF create.win.hWndParent = Kernel32.NULL THEN create.win.hWndParent := create.win.hWnd END;
  171. END CreateHWND;
  172. (* wParam contains the virtual key code
  173. lParam: {0..15}: Key repeat count, {16..23}: Scan code, {24}: Extended-key flag, {25..28}: Reserved,
  174. {29}: Context code (1 if ALT was down, 0 otherwise), {30}: Previous key-state flag, {31}: Transition-state flag *)
  175. PROCEDURE DecomposeKeyEvent( wParam, lParam: LONGINT; VAR ch: CHAR; VAR key: LONGINT; char: BOOLEAN );
  176. VAR scancode: LONGINT; previous: LONGINT; repeat: LONGINT; extended: BOOLEAN;
  177. BEGIN
  178. repeat := lParam MOD ASH( 1, 16 ); scancode := ASH( lParam, -16 ) MOD ASH( 1, 8 ); extended := ODD( ASH( lParam, -24 ) );
  179. previous := ASH( lParam, -30 ) MOD 2;
  180. key := 0; ch := 0X;
  181. CASE wParam OF
  182. | kEnter:
  183. IF extended THEN key := AosInputs.KsKPEnter ELSE key := AosInputs.KsReturn END; ch := Enter;
  184. | kPageUp:
  185. key := AosInputs.KsPageUp; ch := PageUp (* if ~extended then on numerical pad *)
  186. | kPageDown:
  187. key := AosInputs.KsPageDown; ch := PageDown;
  188. | kEnd:
  189. key := AosInputs.KsEnd; ch := End;
  190. | kHome:
  191. key := AosInputs.KsHome; ch := Home;
  192. | kLeft:
  193. key := AosInputs.KsLeft; ch := Left;
  194. | kRight:
  195. key := AosInputs.KsRight; ch := Right;
  196. | kUp:
  197. key := AosInputs.KsUp; ch := Up;
  198. | kDown:
  199. key := AosInputs.KsDown; ch := Down;
  200. | kInsert:
  201. key := AosInputs.KsInsert; ch := Insert;
  202. | kDelete:
  203. key := AosInputs.KsDelete; ch := Delete;
  204. | kF1:
  205. key := AosInputs.KsF1; ch := F1;
  206. | kF2:
  207. key := AosInputs.KsF2; ch := F2;
  208. | kF3:
  209. key := AosInputs.KsF3; ch := F3;
  210. | kF4:
  211. key := AosInputs.KsF4; ch := F4;
  212. | kF5:
  213. key := AosInputs.KsF5; ch := F5;
  214. | kF6:
  215. key := AosInputs.KsF6; ch := F6;
  216. | kF7:
  217. key := AosInputs.KsF7; ch := F7;
  218. | kF8:
  219. key := AosInputs.KsF8; ch := F8;
  220. | kF9:
  221. key := AosInputs.KsF9; ch := F9;
  222. | kF10:
  223. key := AosInputs.KsF10; ch := F10;
  224. | kF11:
  225. key := AosInputs.KsF11; ch := F11;
  226. | kF12:
  227. key := AosInputs.KsF12; ch := F12;
  228. | kCtrl:
  229. IF extended THEN key := AosInputs.KsControlR ELSE key := AosInputs.KsControlL END;
  230. | kAlt:
  231. IF extended THEN key := AosInputs.KsAltR ELSE key := AosInputs.KsAltL END;
  232. | kMenu:
  233. key := AosInputs.KsMenu;
  234. | kNumlock:
  235. key := AosInputs.KsNumLock
  236. | kShift:
  237. IF extended THEN key := AosInputs.KsShiftR ELSE key := AosInputs.KsShiftL END;
  238. | kPause:
  239. key := AosInputs.KsPause
  240. | kCapsLock:
  241. key := AosInputs.KsCapsLock;
  242. | kEscape:
  243. key := AosInputs.KsEscape;
  244. | kTab:
  245. key := AosInputs.KsTab; ch := 09X;
  246. | User32.VKBack:
  247. key := AosInputs.KsBackSpace; ch := Backspace;
  248. ELSE
  249. IF char THEN GetChar( wParam, lParam, ch, key ); END;
  250. END;
  251. END DecomposeKeyEvent;
  252. PROCEDURE GetChar( wParam, lParam: LONGINT; VAR ch: CHAR; VAR key: LONGINT );
  253. BEGIN
  254. ch := ISOToOberon[wParam]; key := ORD( ch );
  255. END GetChar;
  256. PROCEDURE GetKeyState( key: LONGINT; what: INTEGER ): BOOLEAN;
  257. VAR state: INTEGER;
  258. BEGIN
  259. state := User32.GetKeyState( key ); RETURN what IN SYSTEM.VAL( SET, state );
  260. END GetKeyState;
  261. (* Common base handler for all variants of windows provided by this module. *)
  262. PROCEDURE DummyHandler( win: Window; uMsg: LONGINT; wParam: User32.WParam; lParam: User32.LParam ): User32.LResult;
  263. VAR res: User32.LResult; proc: User32.WndProc; hhWnd: ADDRESS; ret: Kernel32.BOOL;
  264. BEGIN
  265. IF (uMsg = User32.WMDestroy) & ~(external IN win.state) THEN
  266. EXCL( win.state, update ); DEC( nWindows );
  267. IF (nWindows = 1) & (dummyWin # NIL ) THEN (* only dummyWin left *)
  268. IF win = dummyWin THEN dummyWin := NIL END;
  269. IF res > 1 THEN RETURN 0 END
  270. ELSIF nWindows >= 1 THEN (* other windows left *)
  271. RETURN 0
  272. END;
  273. User32.PostQuitMessage( 0 )
  274. ELSIF uMsg = User32.WMClose THEN
  275. EXCL( win.state, update );
  276. IF hook = win THEN HandleFocus( win, User32.WMKillFocus, 0 ); END;
  277. IF mouse = win THEN mouse := NIL END;
  278. IF root = win THEN root := NIL END;
  279. IF capture = win THEN ret := User32.ReleaseCapture(); capture := NIL END;
  280. IF Objects.oberonLoop = NIL THEN Modules.Shutdown( Modules.PowerDown ); END;
  281. (* win.getDC := GetDC; win.releaseDC := ReleaseDC; *)
  282. win.hDC := -1; (* ??? *)
  283. IF ~(external IN win.state) THEN ret := User32.DestroyWindow( win.hWnd ); win.hWnd := Kernel32.NULL END
  284. ELSIF uMsg = WMCreateWindow THEN CreateHWND( SYSTEM.VAL( CreateStruct, lParam ) )
  285. ELSE proc := win.defWindowProc; hhWnd := SYSTEM.VAL( ANY, win.hWnd );
  286. ASSERT ( proc # NIL );
  287. RETURN win.defWindowProc( win.hWnd, uMsg, wParam, lParam )
  288. END;
  289. RETURN 0
  290. END DummyHandler;
  291. PROCEDURE HandleFocus( win: Window; uMsg: LONGINT; wParam: User32.WParam );
  292. BEGIN
  293. IF (uMsg = User32.WMSetFocus) & (hook # win) THEN
  294. Kernel32.Sleep( 0 ); (* ????????????????????? *)
  295. ELSIF uMsg = User32.WMKillFocus THEN
  296. IF wParam # Kernel32.NULL THEN
  297. IF wParam = win.hWnd THEN RETURN END;
  298. END;
  299. END
  300. END HandleFocus;
  301. (** add a new display to the list of installed displays *)
  302. PROCEDURE Add( disp: Window; noView: BOOLEAN );
  303. BEGIN
  304. Kernel32.EnterCriticalSection( moduleCS ); disp.link := root; root := disp; Kernel32.LeaveCriticalSection( moduleCS )
  305. END Add;
  306. PROCEDURE SetupWin( win: Window );
  307. VAR rect: User32.Rect; ret: Kernel32.BOOL;
  308. BEGIN
  309. ret := User32.GetWindowRect( win.hWnd, win.windowRect ); ret := User32.GetClientRect( win.hWnd, rect );
  310. win.width := rect.right - rect.left; win.height := rect.bottom - rect.top; Add( win, FALSE );
  311. IF User32.GetFocus() = win.hWnd THEN HandleFocus( win, User32.WMSetFocus, 0 ) END;
  312. END SetupWin;
  313. PROCEDURE {WINAPI} DummyProc( hwnd: User32.HWND; uMsg: LONGINT; wParam: User32.WParam;
  314. lParam: User32.LParam ): User32.LResult;
  315. VAR win: Window; create: CreateStruct; ret: Kernel32.BOOL;
  316. BEGIN {UNCOOPERATIVE, UNCHECKED}
  317. Environment.RestoreActivity;
  318. win := SYSTEM.VAL( Window, User32.GetWindowLong( hwnd, GWLWindow ) );
  319. IF win # NIL THEN RETURN DummyHandler( win, uMsg, wParam, lParam )
  320. ELSIF uMsg = User32.WMCreate THEN
  321. SYSTEM.GET( lParam, create ); wParam := SYSTEM.VAL( User32.WParam, create );
  322. lParam := SYSTEM.VAL( User32.LParam, create.win );
  323. ret := User32.PostMessage( hwnd, WMSetup, wParam, lParam )
  324. ELSIF uMsg = WMSetup THEN
  325. win := SYSTEM.VAL( Window, lParam ); ret := User32.SetWindowLong( hwnd, GWLWindow, lParam );
  326. create := SYSTEM.VAL( CreateStruct, wParam );
  327. IF ~(dummy IN win.state) THEN SetupWin( win ) ELSE Add( win, TRUE ) END;
  328. IF ~(external IN win.state) THEN INC( nWindows ) END;
  329. BEGIN{EXCLUSIVE}
  330. create.finished := TRUE
  331. END;
  332. END;
  333. RETURN User32.DefWindowProc( hwnd, uMsg, wParam, lParam )
  334. END DummyProc;
  335. PROCEDURE ChangeCursor;
  336. VAR point: User32.Point; ret: Kernel32.BOOL;
  337. BEGIN
  338. ret := User32.GetCursorPos( point ); ret := User32.SetCursor( hCurrentCursor );
  339. IF hCurrentCursor = Kernel32.NULL THEN
  340. REPEAT UNTIL User32.ShowCursor( Kernel32.False ) < 0
  341. ELSIF hCurrentCursor # Kernel32.NULL THEN
  342. REPEAT UNTIL User32.ShowCursor( Kernel32.True ) >= 0
  343. END;
  344. INC( point.x ); INC( point.y ); ret := User32.SetCursorPos( point.x, point.y ); DEC( point.x ); DEC( point.y );
  345. ret := User32.SetCursorPos( point.x, point.y )
  346. END ChangeCursor;
  347. PROCEDURE SetCursor( hCursor: User32.HCursor );
  348. BEGIN
  349. IF hCurrentCursor # hCursor THEN hCurrentCursor := hCursor; ChangeCursor() END
  350. END SetCursor;
  351. PROCEDURE HandleMouse( win: Window; uMsg: LONGINT; wParam: User32.WParam; lParam: User32.LParam );
  352. VAR m: AosInputs.AbsMouseMsg; oldx, oldy: LONGINT; keys: SET; ret: Kernel32.BOOL;
  353. BEGIN
  354. (* User32.SetCursor(hCurrentCursor);*)
  355. oldx := win.track.X; oldy := win.track.Y;
  356. win.track.X := SHORT( lParam MOD ASH( 1, 16 ) ) - win.dx;
  357. win.track.Y := SHORT( (* win.height-*) ASH( lParam, -16 ) - 1 ) - win.dy;
  358. m.x := win.track.X; m.y := win.track.Y; m.z := win.track.Z;
  359. m.dx := 0; m.dy := 0; m.dz := 0;
  360. IF (m.x <= 0) THEN m.dx := win.track.dx - 2;
  361. ELSIF (m.x >= MIN( win.width, disp.width ) - 1) THEN m.x := disp.width - 1; m.dx := win.track.dx + 2;
  362. END;
  363. IF (m.y <= 0) THEN m.dy := win.track.dy - 2;
  364. ELSIF (m.y >= MIN( win.height, disp.height ) - 1) THEN m.y := disp.height - 1; m.dy := win.track.dy + 2;
  365. END;
  366. win.track.dx := m.dx; win.track.dy := m.dy;
  367. IF (m.dx # 0) OR (m.dy # 0) THEN ret := User32.SetCursor( hAlternativeCursor );
  368. ELSE ret := User32.SetCursor( hCurrentCursor )
  369. END;
  370. keys := win.track.keys;
  371. CASE uMsg OF
  372. User32.WMLButtonDown:
  373. INCL( keys, ML )
  374. | User32.WMLButtonUp:
  375. EXCL( keys, ML )
  376. | User32.WMMButtonDown:
  377. INCL( keys, MM )
  378. | User32.WMMButtonUp:
  379. EXCL( keys, MM )
  380. | User32.WMRButtonDown:
  381. INCL( keys, MR )
  382. | User32.WMRButtonUp:
  383. EXCL( keys, MR )
  384. | User32.WMXButtonDown:
  385. INCL( keys, MX )
  386. | User32.WMXButtonUp:
  387. EXCL( keys, MX )
  388. | User32.WMMouseWheel:
  389. IF SHORT( ASH( wParam, -16 ) ) > 0 THEN m.dz := -1 ELSE m.dz := 1 END;
  390. m.x := oldx; m.y := oldy; win.track.X := oldx; win.track.Y := oldy;
  391. (* strange: if wheel used, then coordinates are not realtive to windows -> use coordinates of last event, fof *)
  392. ELSE
  393. END;
  394. IF (keys # {}) & (capture # win) THEN ret := User32.SetCapture( win.hWnd ); capture := win
  395. ELSIF (keys = {}) & (capture # NIL ) THEN ret := User32.ReleaseCapture(); capture := NIL
  396. END;
  397. win.track.keys := keys; m.keys := keys;
  398. AosInputs.mouse.Handle( m );
  399. END HandleMouse;
  400. (* Get the state of CTRL, ALT and SHIFT keys *)
  401. PROCEDURE GetKeyFlags(VAR flags : SET);
  402. BEGIN
  403. flags := {};
  404. IF GetKeyState( VKLShift, pressed ) THEN INCL( flags, AosInputs.LeftShift ); END;
  405. IF GetKeyState( VKRShift, pressed ) THEN INCL( flags, AosInputs.RightShift ); END;
  406. IF GetKeyState( VKLCtrl, pressed ) THEN INCL( flags, AosInputs.LeftCtrl ); END;
  407. IF GetKeyState( VKRCtrl, pressed ) THEN INCL( flags, AosInputs.RightCtrl ); END;
  408. IF GetKeyState( VKLMenu, pressed ) THEN INCL( flags, AosInputs.LeftAlt ); END;
  409. IF GetKeyState( VKRMenu, pressed ) THEN INCL( flags, AosInputs.RightAlt ); END;
  410. IF GetKeyState( VKLWin, pressed) THEN INCL(flags, AosInputs.LeftMeta); END;
  411. IF GetKeyState( VKRWin, pressed) THEN INCL(flags, AosInputs.RightMeta); END;
  412. END GetKeyFlags;
  413. (* default handler for WMChar messages *)
  414. PROCEDURE HandleChar( win: Window; wParam: User32.WParam; lParam: User32.LParam );
  415. VAR ch: CHAR; msg: AosInputs.KeyboardMsg; key: LONGINT;
  416. BEGIN
  417. GetChar( wParam, lParam, ch, key );
  418. GetKeyFlags(msg.flags);
  419. msg.ch := ch; msg.keysym := key;
  420. (*
  421. KernelLog.String("HandleChar, ch, keysm="); KernelLog.Int(ORD(ch),10); KernelLog.Hex(msg.keysym,10); KernelLog.String(","); KernelLog.Bits(msg.flags,0,32); KernelLog.Ln;
  422. *)
  423. IF (*ch # 0X*) TRUE THEN
  424. lParam := lParam MOD ASH( 1, 16 );
  425. WHILE lParam > 0 DO AosInputs.keyboard.Handle( msg );
  426. (* Displays.WriteChar(win, ch); *)
  427. DEC( lParam )
  428. END
  429. END
  430. END HandleChar;
  431. (* default handler for WMKeyDown or WMKeyUp messages *)
  432. PROCEDURE HandleKey( win: Window; wParam: User32.WParam; lParam: User32.LParam );
  433. VAR ch: CHAR; msg: AosInputs.KeyboardMsg; key : LONGINT; rect: User32.Rect; ret: Kernel32.BOOL;
  434. BEGIN
  435. DecomposeKeyEvent( wParam, lParam, ch, key, FALSE );
  436. IF (key = AosInputs.KsF8) & (maximized IN win.state) & ~fullscreen (*ALEX 2005.11.30*) THEN
  437. IF win.frame THEN
  438. ret :=
  439. User32.SetWindowLong( win.hWnd, User32.GWLStyle,
  440. SYSTEM.VAL( LONGINT, SYSTEM.VAL( SET, User32.GetWindowLong( win.hWnd, User32.GWLStyle ) ) + SYSTEM.VAL( SET, 12582912 (* WScaption *) ) ) );
  441. ret := User32.GetWindowRect( win.hWnd, rect );
  442. ret :=
  443. User32.SetWindowRgn( win.hWnd,
  444. GDI32.CreateRectRgn( rect.left, rect.bottom, rect.right, rect.top (* +User32.GetSystemMetrics(User32.SMCYCaption) *) ),
  445. 1 );
  446. ELSE
  447. ret :=
  448. User32.SetWindowLong( win.hWnd, User32.GWLStyle,
  449. SYSTEM.VAL( LONGINT, SYSTEM.VAL( SET, User32.GetWindowLong( win.hWnd, User32.GWLStyle ) ) - SYSTEM.VAL( SET, 12582912 (* WScaption *) ) ) );
  450. ret := User32.GetWindowRect( win.hWnd, rect );
  451. ret :=
  452. User32.SetWindowRgn( win.hWnd,
  453. GDI32.CreateRectRgn( rect.left, rect.bottom, rect.right, rect.top (* -User32.GetSystemMetrics(User32.SMCYCaption)*) ),
  454. 1 );
  455. END;
  456. win.frame := ~win.frame; RETURN;
  457. END;
  458. GetKeyFlags(msg.flags);
  459. IF (msg.flags * AosInputs.Ctrl # {}) & (msg.flags * AosInputs.Alt = {}) & (VK0 <= wParam) & (wParam <= VK9) THEN
  460. (* Same behaviour as AOS *)
  461. ch := CHR(wParam); key := wParam;
  462. END;
  463. IF (AosInputs.LeftAlt IN msg.flags) & (AosInputs.LeftShift IN msg.flags) THEN
  464. INCL(win.track.flags, AosInputs.LeftMeta);
  465. END;
  466. CASE key OF
  467. | AosInputs.KsMenu:
  468. INCL( win.track.flags, AosInputs.LeftMeta );
  469. | AosInputs.KsF9:
  470. INCL( win.track.flags, AosInputs.RightMeta );
  471. | AosInputs.KsF1:
  472. INCL( win.track.flags, AosInputs.LeftMeta );
  473. ELSE
  474. END;
  475. msg.flags := msg.flags + win.track.flags; msg.ch := ch; msg.keysym := key;
  476. (* ch := TranslateKey(wParam, FALSE); *)
  477. (*IF ch # 0X THEN*)
  478. lParam := lParam MOD ASH( 1, 16 );
  479. IF (msg.keysym # 0) OR (msg.ch # 0X) THEN
  480. (*
  481. KernelLog.String("HandleKey, ch, keysm="); KernelLog.Int(ORD(ch),10); KernelLog.Hex(msg.keysym,10); KernelLog.Bits(msg.flags,0,32); KernelLog.Ln;
  482. *)
  483. KeyHandled := TRUE;
  484. WHILE lParam > 0 DO AosInputs.keyboard.Handle( msg );
  485. (*Displays.WriteChar(win, ch); *) DEC( lParam )
  486. END;
  487. ELSE KeyHandled := FALSE;
  488. END;
  489. END HandleKey;
  490. (* default handler for WMKeyDown or WMKeyUp messages *)
  491. PROCEDURE HandleKeyUp( win: Window; wParam: User32.WParam; lParam: User32.LParam );
  492. VAR ch: CHAR; msg: AosInputs.KeyboardMsg; key : LONGINT;
  493. BEGIN
  494. DecomposeKeyEvent( wParam, lParam, ch, key, TRUE );
  495. GetKeyFlags(msg.flags);
  496. IF ~((AosInputs.LeftAlt IN msg.flags) & (AosInputs.LeftShift IN msg.flags)) THEN
  497. EXCL(win.track.flags, AosInputs.LeftMeta);
  498. END;
  499. CASE key OF
  500. | AosInputs.KsMenu:
  501. EXCL( win.track.flags, AosInputs.LeftMeta );
  502. | AosInputs.KsF9:
  503. EXCL( win.track.flags, AosInputs.RightMeta );
  504. | AosInputs.KsF1:
  505. EXCL( win.track.flags, AosInputs.LeftMeta );
  506. ELSE
  507. END;
  508. msg.flags := msg.flags + win.track.flags + {AosInputs.Release}; msg.ch := ch; msg.keysym := key;
  509. IF dbgDisableReleaseMsg THEN msg.ch := 0X; msg.keysym := AosInputs.KsNil; END;
  510. AosInputs.keyboard.Handle( msg );
  511. END HandleKeyUp;
  512. PROCEDURE SetDocRect( win: Window; resize: BOOLEAN );
  513. VAR rect: User32.Rect; ret: Kernel32.BOOL;
  514. BEGIN
  515. IF ~(minimized IN win.state) THEN
  516. IF resize THEN ret := User32.GetWindowRect( win.hWnd, win.windowRect )
  517. ELSE
  518. ret := User32.GetWindowRect( win.hWnd, rect );
  519. win.windowRect.right := rect.left + (win.windowRect.right - win.windowRect.left);
  520. win.windowRect.left := rect.left;
  521. win.windowRect.bottom := rect.top + (win.windowRect.bottom - win.windowRect.top);
  522. win.windowRect.top := rect.top
  523. END;
  524. END;
  525. END SetDocRect;
  526. PROCEDURE UpdateDisplay( win: Window; id: LONGINT; lParam: User32.LParam; wParam: User32.WParam );
  527. VAR x, y, w, h, dx, dy, bw, bh: LONGINT; hOldBr: GDI32.HBrush; ret: Kernel32.BOOL;
  528. BEGIN
  529. IF ~(minimized IN win.state) THEN
  530. IF id = resize THEN win.width := lParam MOD ASH( 1, 16 ); win.height := lParam DIV ASH( 1, 16 ); SetDocRect( win, TRUE ) END;
  531. ret := User32.ValidateRect( win.hWnd, NIL );
  532. IF win.hDC = 0 THEN GetDC( win ); END;
  533. IF win.hBrush = 0 THEN
  534. win.hBrush := GDI32.CreateSolidBrush( GDI32.RGB( 100, 0, 0 ) );
  535. hOldBr := GDI32.SelectObject( win.hDC, win.hBrush );
  536. END;
  537. w := win.width; h := win.height;
  538. IF disp.width < w THEN (* fill rest with color *)
  539. dx := (w - disp.width) DIV 2; bw := disp.width; ret := GDI32.PatBlt( win.hDC, 0, 0, dx, h, GDI32.PatCopy );
  540. ret := GDI32.PatBlt( win.hDC, w - dx, 0, dx, h, GDI32.PatCopy );
  541. ELSE bw := w;
  542. END;
  543. IF disp.height < h THEN (* fill rest with color *)
  544. dy := (h - disp.height) DIV 2; bh := disp.height; ret := GDI32.PatBlt( win.hDC, 0, 0, w, dy, GDI32.PatCopy );
  545. ret := GDI32.PatBlt( win.hDC, 0, h - dy, w, dy, GDI32.PatCopy );
  546. ELSE bh := h;
  547. END;
  548. hOldBr := GDI32.SelectObject( win.hDC, hOldBr );
  549. (* IF win.fullScreen THEN dy := dy- User32.GetSystemMetrics(User32.SMCYCaption); END; *)
  550. win.dx := dx; win.dy := dy; ToWindow( win, x, y, bw, bh, dx, dy );
  551. END
  552. END UpdateDisplay;
  553. PROCEDURE FromMemory( win: Window; VAR buf: ARRAY OF CHAR; ofs, stride, x, y, w, h: LONGINT );
  554. END FromMemory;
  555. PROCEDURE ToMemory( win: Window; VAR buf: ARRAY OF CHAR; ofs, stride, x, y, w, h: LONGINT );
  556. VAR adr: ADDRESS; hDC: User32.HDC; ret: Kernel32.BOOL;
  557. BEGIN
  558. hDC := win.bmphdc; (* hDC := win.hDC; (* writes to screen*) *)
  559. bmi.info.bmiHeader.biWidth := stride DIV format (* w *) ; bmi.info.bmiHeader.biHeight := -h; (* top-down *)
  560. adr := ADDRESSOF( buf[ofs] );
  561. ret :=
  562. GDI32.SetDIBitsToDevice( hDC, x, y, w, h, 0, 0, 0, h, adr, SYSTEM.VAL( GDI32.BitmapInfo, bmi.info ),
  563. GDI32.DIBPalColors )
  564. (* ELSE
  565. bmi.info.bmiHeader.biHeight := 1;
  566. WHILE h > 0 DO
  567. ret :=
  568. GDI32.SetDIBitsToDevice( hDC, x, y, w, 1, 0, 0, 0, 1, adr, SYSTEM.VAL( GDI32.BitmapInfo, bmi.info ),
  569. GDI32.DIBPalColors );
  570. INC( adr, stride ); DEC( h ); INC( y )
  571. END;
  572. END;
  573. *)
  574. END ToMemory;
  575. PROCEDURE ToWindow*( win: Window; x, y, w, h: LONGINT; dx, dy: LONGINT );
  576. VAR ret: Kernel32.BOOL;
  577. BEGIN
  578. IF traceDisplay THEN
  579. ret := GDI32.BitBlt( win.hDC (* = destination *) , x + dx, y + dy, w, h, win.bmphdc (* source *) , x, y, GDI32.NotSrcCopy );
  580. Environment.Sleep(50);
  581. END;
  582. ret := GDI32.BitBlt( win.hDC (* = destination *) , x + dx, y + dy, w, h, win.bmphdc (* source *) , x, y, GDI32.SrcCopy );
  583. END ToWindow;
  584. PROCEDURE GetMinMaxInfo( win: Window; lParam: User32.LParam ): BOOLEAN;
  585. VAR mm: User32.MinMaxInfo;
  586. BEGIN
  587. SYSTEM.MOVE( lParam, ADDRESSOF( mm ), SIZEOF( User32.MinMaxInfo ) ); mm.ptMaxSize.x := disp.width;
  588. mm.ptMaxSize.y := disp.height; mm.ptMaxTrackSize := mm.ptMaxSize; RETURN TRUE;
  589. END GetMinMaxInfo;
  590. PROCEDURE Minimize( win: Window );
  591. BEGIN
  592. INCL( win.state, minimized ); EXCL( win.state, maximized );
  593. END Minimize;
  594. PROCEDURE Maximize( win: Window );
  595. BEGIN
  596. EXCL( win.state, minimized ); INCL( win.state, maximized );
  597. END Maximize;
  598. PROCEDURE Restore( win: Window );
  599. BEGIN
  600. EXCL( win.state, minimized ); EXCL( win.state, maximized );
  601. END Restore;
  602. PROCEDURE PosChanging( win: Window; lParam: User32.LParam );
  603. VAR pos: User32.WindowPos;
  604. BEGIN
  605. SYSTEM.MOVE( lParam, ADDRESSOF( pos ), SIZEOF( User32.WindowPos ) );
  606. IF ~(User32.SWPNoMove IN pos.flags) THEN
  607. IF (pos.x < -disp.width) & (pos.y < -disp.height) THEN Minimize( win )
  608. ELSIF (pos.x >= 0) & (pos.y >= 0) THEN Restore( win )
  609. END
  610. END;
  611. (* Viewers.sorted := FALSE*)
  612. END PosChanging;
  613. (** Common base handler for all visual windows (document or control) provided by this module. *)
  614. PROCEDURE WindowHandler( win: Window; uMsg: LONGINT; wParam: User32.WParam;
  615. lParam: User32.LParam ): User32.LResult;
  616. VAR handled: BOOLEAN; ret: Kernel32.BOOL;
  617. closer: OBJECT (* to call a close request in an A2 thread, otherwise finalization does not work etc. *)
  618. BEGIN{ACTIVE}
  619. Modules.Shutdown(Modules.PowerDown);
  620. User32.PostQuitMessage(0);
  621. END;
  622. BEGIN
  623. IF update IN win.state THEN
  624. handled := TRUE;
  625. IF uMsg < User32.WMKeyFirst THEN
  626. CASE uMsg OF
  627. User32.WMMove:
  628. SetDocRect( win, FALSE )
  629. | User32.WMSize:
  630. IF wParam = User32.SizeMaximized THEN Maximize( win ); UpdateDisplay( win, resize, lParam, wParam );
  631. ELSIF wParam = User32.SizeMinimized THEN Minimize( win );
  632. ELSIF wParam = User32.SizeRestored THEN Restore( win ); UpdateDisplay( win, resize, lParam, wParam );
  633. END;
  634. | User32.WMPaint:
  635. UpdateDisplay( win, redraw, lParam, wParam );
  636. | User32.WMMouseActivate:
  637. IF (hook = NIL ) OR ((lParam MOD 65536) # (User32.HTClient)) THEN ret := User32.SetFocus( win.hWnd ) END;
  638. RETURN User32.MANoActivate
  639. | User32.WMGetMinMaxInfo:
  640. handled := GetMinMaxInfo( win, lParam )
  641. | User32.WMWindowPosChanging:
  642. handled := GetMinMaxInfo( win, lParam ); PosChanging( win, lParam ); handled := FALSE
  643. | User32.WMSetFocus, User32.WMKillFocus:
  644. HandleFocus( win, uMsg, wParam )
  645. | User32.WMClose:
  646. IF closeRequests < 3 THEN
  647. NEW(closer); INC(closeRequests);
  648. ELSE
  649. Modules.Shutdown(Modules.PowerDown);
  650. User32.PostQuitMessage( 0 ) (*ALEX 2005.12.13 added this line*)
  651. END;
  652. ELSE handled := FALSE
  653. END
  654. ELSIF (User32.WMKeyFirst <= uMsg) & (uMsg <= User32.WMKeyLast) THEN
  655. CASE uMsg OF
  656. | User32.WMKeyDown:
  657. HandleKey( win, wParam, lParam);
  658. | User32.WMKeyUp:
  659. HandleKeyUp( win, wParam, lParam );
  660. | User32.WMChar:
  661. IF ~KeyHandled THEN
  662. HandleChar( win, wParam, lParam )
  663. END;
  664. | User32.WMSysKeyDown: HandleKey(win, wParam, lParam);
  665. | User32.WMSysKeyUp: HandleKeyUp(win, wParam, lParam);
  666. ELSE handled := FALSE;
  667. END;
  668. ELSIF (User32.WMMouseFirst <= uMsg) & (uMsg <= User32.WMMouseLast) THEN
  669. HandleMouse( win, uMsg, wParam, lParam )
  670. ELSE handled := FALSE
  671. END
  672. ELSE handled := FALSE
  673. END;
  674. IF ~handled THEN RETURN DummyHandler( win, uMsg, wParam, lParam ) ELSE RETURN 0 END
  675. END WindowHandler;
  676. PROCEDURE {WINAPI} WindowProc( hwnd: User32.HWND; uMsg: LONGINT; wParam: User32.WParam;
  677. lParam: User32.LParam ): User32.LResult;
  678. VAR win {UNTRACED}: Window; dbh {UNTRACED}: DEV_BROADCAST_HDRP; dbv {UNTRACED}: DEV_BROADCAST_VOLUMEP; i: LONGINT;
  679. BEGIN {UNCOOPERATIVE, UNCHECKED}
  680. Environment.RestoreActivity;
  681. IF uMsg = WM_DEVICECHANGE THEN
  682. IF wParam = DBT_DEVICEARRIVAL THEN
  683. dbh := SYSTEM.VAL(DEV_BROADCAST_HDRP,lParam);
  684. IF dbh.dbch_devicetype = DBT_DEVTYP_VOLUME THEN
  685. dbv := SYSTEM.VAL(DEV_BROADCAST_VOLUMEP,lParam);
  686. WinFS.DeviceNotification(wParam,dbv.dbcv_unitmask);
  687. END;
  688. ELSIF wParam = DBT_DEVICEREMOVECOMPLETE THEN
  689. dbh := SYSTEM.VAL(DEV_BROADCAST_HDRP,lParam);
  690. IF dbh.dbch_devicetype = DBT_DEVTYP_VOLUME THEN
  691. dbv := SYSTEM.VAL(DEV_BROADCAST_VOLUMEP,lParam);
  692. WinFS.DeviceNotification(wParam,dbv.dbcv_unitmask);
  693. END;
  694. END;
  695. END;
  696. win := SYSTEM.VAL( Window, User32.GetWindowLong( hwnd, GWLWindow ) );
  697. IF win # NIL THEN RETURN WindowHandler( win, uMsg, wParam, lParam )
  698. ELSE RETURN DummyProc( hwnd, uMsg, wParam, lParam )
  699. END
  700. END WindowProc;
  701. (** Implementation of GetDC for all visual windows (document or control) provided by this module. *)
  702. PROCEDURE GetDC( win: Window );
  703. VAR oldhbm: GDI32.HBitmap; ret: LONGINT;
  704. BEGIN
  705. IF win.hWnd # Kernel32.NULL THEN
  706. win.hDC := User32.GetDC( win.hWnd );
  707. IF letWindowsHandleTheBuffer THEN
  708. win.bmp := GDI32.CreateCompatibleBitmap( win.hDC, disp.width, disp.height );
  709. win.bmphdc := GDI32.CreateCompatibleDC( win.hDC ); oldhbm := GDI32.SelectObject( win.bmphdc, win.bmp );
  710. NEW( win.pal, 1024 ); ret := GDI32.GetSystemPaletteEntries( win.hDC, 0, 1024, win.pal^ )
  711. ELSE win.bmphdc := GDI32.CreateCompatibleDC( win.hDC );
  712. win.bmadr := 0;
  713. bmi.info.bmiHeader.biSizeImage := disp.width * disp.height * format; bmi.info.bmiHeader.biWidth := disp.width;
  714. bmi.info.bmiHeader.biHeight := -disp.height; (* top-down *)
  715. win.bmp :=
  716. GDI32.CreateDIBSection( win.hDC, SYSTEM.VAL( GDI32.BitmapInfo, bmi.info ), GDI32.DIBRGBColors,
  717. win.bmadr, 0, 0 );
  718. ASSERT ( win.bmadr # 0 );
  719. oldhbm := GDI32.SelectObject( win.bmphdc, win.bmp );
  720. (*oldhbm := GDI32.SelectObject( win.bmphdc, win.bmp ); *)
  721. NEW( win.pal, 1024 ); ret := GDI32.GetSystemPaletteEntries( win.hDC, 0, 1024, win.pal^ )
  722. END;
  723. ELSE win.hDC := Kernel32.NULL
  724. END;
  725. (*
  726. depth := GDI32.GetDeviceCaps(win.hDC, GDI32.BitsPixel);
  727. *)
  728. (* IF disp = root THEN Msg2(TRUE,"RegisterHotkey:",User32.RegisterHotKey(disp.hWnd,100,MODWin,65),0); END; *)
  729. END GetDC;
  730. (** Install a externaly created window in the display space.
  731. You must already have set up the fields:
  732. handle, getDC, releaseDC, hWnd and defWindowProc *)
  733. PROCEDURE InstallW( win: Window; ctrl: BOOLEAN );
  734. VAR h: User32.HWND;
  735. BEGIN
  736. INCL( win.state, external );
  737. IF ctrl THEN INCL( win.state, control ) END;
  738. h := win.hWnd;
  739. WHILE h # Kernel32.NULL DO win.hWndParent := h; h := User32.GetParent( h ) END;
  740. SetupWin( win )
  741. END InstallW;
  742. (** Initialize the fields of a new Window instance with default values.
  743. You must call this procedure whenever you alloc a new Window instance
  744. or an extension of it. *)
  745. PROCEDURE Init( win: Window );
  746. BEGIN
  747. (*
  748. Viewers.InitWindow(win);
  749. win.viewer := NIL;
  750. win.getDC := Displays.GetDC; win.releaseDC := Displays.ReleaseDC;
  751. *)
  752. win.defWindowProc := User32.DefWindowProc; win.windowRect.left := 0; win.windowRect.right := 0;
  753. win.windowRect.top := 0; win.windowRect.bottom := 0; win.state := {update}
  754. END Init;
  755. PROCEDURE RegisterClasses;
  756. VAR str: ARRAY 32 OF CHAR;
  757. ret: Kernel32.ATOM;
  758. BEGIN
  759. dummyClass.cbSize := SIZEOF( User32.WndClassEx ); dummyClass.style := {}; dummyClass.lpfnWndProc := DummyProc;
  760. dummyClass.cbClsExtra := 0; dummyClass.cbWndExtra := 4; dummyClass.hInstance := Kernel32.hInstance;
  761. dummyClass.hIcon := Kernel32.NULL; dummyClass.hIconSm := Kernel32.NULL; dummyClass.hCursor := Kernel32.NULL;
  762. dummyClass.hbrBackground := Kernel32.NULL; dummyClass.lpszMenuName := Kernel32.NULL;
  763. dummyClass.lpszClassName := SYSTEM.VAL( Kernel32.LPSTR, ADDRESSOF( dummyClassName ) );
  764. ret := User32.RegisterClassEx( dummyClass );
  765. windowClass.cbSize := SIZEOF( User32.WndClassEx );
  766. windowClass.style := {7}; (* Cs_parentdc: INTEGER is 128 = 2^7 *)
  767. windowClass.lpfnWndProc := WindowProc; windowClass.cbClsExtra := 0; windowClass.cbWndExtra := 4;
  768. windowClass.hInstance := Kernel32.hInstance; str := "Console"; windowClass.hIcon := User32.LoadIcon( Kernel32.hInstance, str );
  769. str := "Console.Small"; windowClass.hIconSm := User32.LoadIcon( Kernel32.hInstance, str ); windowClass.hCursor := Kernel32.NULL;
  770. windowClass.hbrBackground := Kernel32.NULL; windowClass.lpszMenuName := Kernel32.NULL;
  771. windowClass.lpszClassName := SYSTEM.VAL( Kernel32.LPSTR, ADDRESSOF( windowClassName ) );
  772. ret := User32.RegisterClassEx( windowClass )
  773. END RegisterClasses;
  774. PROCEDURE UnregisterClasses;
  775. VAR ret: Kernel32.BOOL;
  776. BEGIN
  777. ret := User32.UnregisterClass( dummyClassName, Kernel32.hInstance );
  778. ret := User32.UnregisterClass( windowClassName, Kernel32.hInstance )
  779. END UnregisterClasses;
  780. PROCEDURE FirstWindow( ): Window;
  781. VAR disp: Window; w: Window;
  782. BEGIN
  783. w := NIL; disp := root;
  784. WHILE (w = NIL ) & (disp # NIL ) DO
  785. IF disp IS Window THEN
  786. w := disp( Window );
  787. IF (w.hWnd = Kernel32.NULL) OR (~(update IN w.state) & ~(dummy IN w.state)) OR (external IN w.state) THEN
  788. w := NIL
  789. END
  790. END;
  791. disp := disp.link
  792. END;
  793. RETURN w
  794. END FirstWindow;
  795. PROCEDURE {WINAPI} WindowThread (create {UNTRACED}: ANY): LONGINT;
  796. BEGIN {UNCOOPERATIVE, UNCHECKED}
  797. Kernel32.InstallExceptionHandler;
  798. Activities.CallVirtual (MessageLoop, create, create(CreateStruct).win.processor);
  799. RETURN 0;
  800. END WindowThread;
  801. PROCEDURE MessageLoop (c: ADDRESS);
  802. VAR activity: Activities.Activity; create: CreateStruct;
  803. VAR msg: User32.Msg; i: LONGINT; mode: LONGINT;
  804. BEGIN
  805. create := SYSTEM.VAL (CreateStruct, c);
  806. KernelLog.String( "Display: Initialize message dispatcher..." ); KernelLog.Ln;
  807. RegisterClasses(); CreateHWND( create ); create := NIL;
  808. KernelLog.String( "Display: Start message dispatching" ); KernelLog.Ln;
  809. REPEAT
  810. i := User32.GetMessage( msg, 0, 0, 0 );
  811. IF i = 0 THEN
  812. ELSIF i # -1 THEN
  813. IF ( msg.message = User32.WMKeyDown ) THEN
  814. (* Translate virtual key code to character. This generates a WMChar message if translation succeeds. Since
  815. AOS doesn't allow ALT-Printable-Keys combinations, we don't translate User32.WMSysKeyDown messages
  816. that would generate WMSysChar messages *)
  817. User32.TranslateMessage( msg );
  818. END;
  819. User32.DispatchMessage( msg )
  820. END;
  821. UNTIL (i = 0) OR (Environment.status # 0);
  822. UnregisterClasses();
  823. Counters.Dec (Activities.awaiting);
  824. END MessageLoop;
  825. PROCEDURE CreateWin( create: CreateStruct );
  826. VAR hThread: Kernel32.HANDLE; theWin: Window; ret: Kernel32.BOOL;
  827. BEGIN
  828. IF nWindows <= 0 THEN
  829. Counters.Inc (Activities.awaiting);
  830. create.win.processor := Activities.CreateVirtualProcessor ();
  831. Kernel32.CreateThread (NIL, 0, WindowThread, create, {}, NIL);
  832. root := create.win;
  833. ELSE
  834. theWin := FirstWindow();
  835. ret := User32.PostMessage( theWin.hWnd, WMCreateWindow, 0, SYSTEM.VAL( User32.LParam, create ) )
  836. END;
  837. BEGIN {EXCLUSIVE}
  838. AWAIT(create.finished)
  839. END;
  840. END CreateWin;
  841. PROCEDURE {WINAPI} ControlWindowProc( hwnd: User32.HWND; uMsg: LONGINT; wParam: User32.WParam;
  842. lParam: User32.LParam ): User32.LResult;
  843. VAR win: Window; ret: Kernel32.BOOL;
  844. BEGIN {UNCOOPERATIVE, UNCHECKED}
  845. Environment.RestoreActivity;
  846. win := SYSTEM.VAL( Window, User32.GetWindowLong( hwnd, GWLWindow ) );
  847. IF win # NIL THEN RETURN WindowHandler( win, uMsg, wParam, lParam )
  848. ELSIF uMsg = User32.WMCreate THEN
  849. SYSTEM.GET( lParam, win ); win.hWnd := hwnd;
  850. ret := User32.SetWindowLong( hwnd, GWLWindow, SYSTEM.VAL( LONGINT, win ) ); InstallW( win, TRUE ); RETURN 0
  851. ELSE RETURN DummyProc(hwnd,uMsg,wParam,lParam);
  852. END
  853. END ControlWindowProc;
  854. PROCEDURE {WINAPI} UnregisterControlWinClass;
  855. VAR ret: Kernel32.BOOL;
  856. BEGIN {UNCOOPERATIVE, UNCHECKED}
  857. IF aControlWinClass # Kernel32.NULL THEN
  858. ret := User32.UnregisterClass( controlClassName, Kernel32.hInstance ); aControlWinClass := Kernel32.NULL
  859. END
  860. END UnregisterControlWinClass;
  861. PROCEDURE InitMod;
  862. VAR (* path: FileDir.FileName;*) i: LONGINT;
  863. str: ARRAY 32 OF CHAR;
  864. BEGIN
  865. fixedFrameX := User32.GetSystemMetrics( User32.SMCXFixedFrame );
  866. fixedFrameY := User32.GetSystemMetrics( User32.SMCYFixedFrame );
  867. frameX := User32.GetSystemMetrics( User32.SMCXFrame ); frameY := User32.GetSystemMetrics( User32.SMCYFrame );
  868. captionY := User32.GetSystemMetrics( User32.SMCYCaption );
  869. menuY := User32.GetSystemMetrics( User32.SMCYMenu ); capture := NIL; hook := NIL; mouse := NIL;
  870. (* winMain := NIL; *) nWindows := 0; str := "PointCircle";
  871. hCurrentCursor := User32.LoadCursor( Kernel32.hInstance, str ); (* Kernel32.NULL; *);
  872. str := "Cross"; hAlternativeCursor := User32.LoadCursor( Kernel32.hInstance, str ); dummyClassName := "Aos.Dummy.Class";
  873. windowClassName := "Aos.Window.Class"; controlClassName := "Aos.ControlWindow.Class"; aControlWinClass := Kernel32.NULL; kioskmode := FALSE;
  874. Kernel32.InitializeCriticalSection( moduleCS );
  875. (*
  876. nAccel := 0; Registry.OberonPath("HotKeys", path);
  877. Registry.EnumerateKeyValue(Registry.CurrentUser, path, AddRegHotKeys); (* done in Oberon.Mod, needs configuration Oberon.Text *)
  878. *)
  879. dummyWin := NIL;
  880. FOR i := 0 TO 255 DO ISOToOberon[i] := CHR( i ); END;
  881. ISOToOberon[146] := CHR( 39 ); ISOToOberon[160] := CHR( 32 ); ISOToOberon[162] := CHR( 99 );
  882. ISOToOberon[166] := CHR( 124 ); ISOToOberon[168] := CHR( 34 ); ISOToOberon[169] := CHR( 99 ); ISOToOberon[170] := CHR( 97 );
  883. ISOToOberon[171] := CHR( 60 ); ISOToOberon[173] := CHR( 45 ); ISOToOberon[174] := CHR( 114 ); ISOToOberon[175] := CHR( 45 );
  884. ISOToOberon[176] := CHR( 111 ); ISOToOberon[178] := CHR( 50 ); ISOToOberon[179] := CHR( 51 ); ISOToOberon[180] := CHR( 39 );
  885. ISOToOberon[183] := CHR( 46 ); ISOToOberon[185] := CHR( 49 ); ISOToOberon[186] := CHR( 48 ); ISOToOberon[187] := CHR( 62 );
  886. ISOToOberon[192] := CHR( 65 ); ISOToOberon[193] := CHR( 65 ); ISOToOberon[194] := CHR( 65 ); ISOToOberon[195] := CHR( 65 );
  887. ISOToOberon[196] := CHR( 128 ); ISOToOberon[197] := CHR( 65 ); ISOToOberon[198] := CHR( 65 ); ISOToOberon[199] := CHR( 67 );
  888. ISOToOberon[200] := CHR( 69 ); ISOToOberon[201] := CHR( 69 ); ISOToOberon[202] := CHR( 69 ); ISOToOberon[203] := CHR( 69 );
  889. ISOToOberon[204] := CHR( 73 ); ISOToOberon[205] := CHR( 73 ); ISOToOberon[206] := CHR( 73 ); ISOToOberon[207] := CHR( 73 );
  890. ISOToOberon[208] := CHR( 68 ); ISOToOberon[209] := CHR( 78 ); ISOToOberon[210] := CHR( 79 ); ISOToOberon[211] := CHR( 79 );
  891. ISOToOberon[212] := CHR( 79 ); ISOToOberon[213] := CHR( 79 ); ISOToOberon[214] := CHR( 129 ); ISOToOberon[215] := CHR( 42 );
  892. ISOToOberon[216] := CHR( 79 ); ISOToOberon[217] := CHR( 85 ); ISOToOberon[218] := CHR( 85 ); ISOToOberon[219] := CHR( 85 );
  893. ISOToOberon[220] := CHR( 130 ); ISOToOberon[221] := CHR( 89 ); ISOToOberon[222] := CHR( 80 );
  894. ISOToOberon[223] := CHR( 150 ); ISOToOberon[224] := CHR( 139 ); ISOToOberon[225] := CHR( 148 );
  895. ISOToOberon[226] := CHR( 134 ); ISOToOberon[227] := CHR( 97 ); ISOToOberon[228] := CHR( 131 );
  896. ISOToOberon[229] := CHR( 97 ); ISOToOberon[230] := CHR( 97 ); ISOToOberon[231] := CHR( 147 );
  897. ISOToOberon[232] := CHR( 140 ); ISOToOberon[233] := CHR( 144 ); ISOToOberon[234] := CHR( 135 );
  898. ISOToOberon[235] := CHR( 145 ); ISOToOberon[236] := CHR( 141 ); ISOToOberon[237] := CHR( 105 );
  899. ISOToOberon[238] := CHR( 136 ); ISOToOberon[239] := CHR( 146 ); ISOToOberon[240] := CHR( 100 );
  900. ISOToOberon[241] := CHR( 149 ); ISOToOberon[242] := CHR( 142 ); ISOToOberon[243] := CHR( 111 );
  901. ISOToOberon[244] := CHR( 137 ); ISOToOberon[245] := CHR( 111 ); ISOToOberon[246] := CHR( 132 );
  902. ISOToOberon[248] := CHR( 111 ); ISOToOberon[249] := CHR( 143 ); ISOToOberon[250] := CHR( 117 );
  903. ISOToOberon[251] := CHR( 138 ); ISOToOberon[252] := CHR( 133 ); ISOToOberon[253] := CHR( 121 );
  904. ISOToOberon[254] := CHR( 112 ); ISOToOberon[255] := CHR( 121 );
  905. InitBMI;
  906. COPY(WindowTitle, windowTitle);
  907. END InitMod;
  908. PROCEDURE DisableCursor*;
  909. BEGIN
  910. hCurrentCursor := Kernel32.NULL
  911. END DisableCursor;
  912. PROCEDURE InitBMI;
  913. BEGIN
  914. bmi.info.bmiHeader.biSize := SIZEOF( GDI32.BitmapInfoHeader ); bmi.info.bmiHeader.biWidth := 0;
  915. bmi.info.bmiHeader.biHeight := 0; bmi.info.bmiHeader.biPlanes := 1; bmi.info.bmiHeader.biBitCount := (format * 8);
  916. bmi.info.bmiHeader.biCompression := GDI32.BIRGB; bmi.info.bmiHeader.biSizeImage := 0;
  917. bmi.info.bmiHeader.biXPelsPerMeter := 0; bmi.info.bmiHeader.biYPelsPerMeter := 0;
  918. IF format > 1 THEN bmi.info.bmiHeader.biClrUsed := 0; bmi.info.bmiHeader.biClrImportant := 0
  919. ELSE bmi.info.bmiHeader.biClrUsed := 256; bmi.info.bmiHeader.biClrImportant := 256;
  920. END;
  921. IF format = Displays.color565 THEN
  922. bmi.info.bmiHeader.biCompression := 3; (*: BIBITFIELDS *)
  923. bmi.info.colors[0] := 15 * 16 * 16 * 16 + 8 * 16 * 16; bmi.info.colors[1] := 14 * 16 + 7 * 16 * 16;
  924. bmi.info.colors[2] := 15 + 16;
  925. END;
  926. END InitBMI;
  927. PROCEDURE Shutdown;
  928. VAR disp: Window;
  929. BEGIN
  930. (*
  931. disp := Displays.root;
  932. WHILE disp # NIL DO
  933. IF disp IS Window THEN
  934. WITH disp: Window DO
  935. IF disp.hWnd # Kernel32.NULL THEN
  936. User32.PostMessage(disp.hWnd, User32.WMClose, 0, 0)
  937. END
  938. END
  939. END;
  940. disp := disp.link
  941. END;
  942. IF dummyWin # NIL THEN
  943. User32.PostMessage(dummyWin.hWnd, User32.WMClose, 0, 0)
  944. END;
  945. *)
  946. UnregisterControlWinClass()
  947. END Shutdown;
  948. PROCEDURE DoInstall( w, h, left, top: LONGINT );
  949. VAR ts: ARRAY 16 OF CHAR;
  950. res: WORD; create: CreateStruct; win: Window; hMenu: User32.HMenu; x, y: LONGINT;
  951. VAR border: LONGINT; rect: User32.Rect; (*ALEX 2005.11.30*)
  952. hDC: User32.HDC;
  953. CONST SMCYMaximized = 62; SMCXMaximized = 61;
  954. BEGIN
  955. IF disp = NIL THEN
  956. NEW( win ); Init( win ); hMenu := Kernel32.NULL; RegisterClasses(); NEW( create ); create.win := win;
  957. create.hMenu := hMenu;
  958. IF ~fullscreen THEN
  959. create.style :=
  960. {User32.WSMinimizeBox, User32.WSMaximizeBox, User32.WSSysMenu, User32.WSVisible, User32.WSBorder, User32.WSThickFrame};
  961. x := User32.CWUseDefault; y := User32.CWUseDefault; COPY( windowClassName, create.className ); border := 0;
  962. IF h = 0 THEN
  963. h := User32.GetSystemMetrics( SMCYMaximized ) - captionY - 2 * frameY;
  964. IF w = 0 THEN
  965. w := User32.GetSystemMetrics( SMCXMaximized ) - 2 * frameX;
  966. create.style := create.style + {User32.WSMaximize};
  967. END;
  968. ELSE
  969. h := h - captionY - 2 * frameY;
  970. IF (w # 0) THEN
  971. w := w - 2 * frameX;
  972. END;
  973. END;
  974. IF w = 0 THEN w := User32.GetSystemMetrics( SMCXMaximized ) - 2 * frameX; END;
  975. create.w := w + 2 * frameX; create.h := h + captionY + 2*frameY;
  976. create.x := x; create.y := y;
  977. IF (left # 0) THEN
  978. create.x := left; create.y := top;
  979. END;
  980. ELSE
  981. create.style := {}; x := User32.CWUseDefault; y := User32.CWUseDefault;
  982. COPY( windowClassName, create.className ); border := 0; h := User32.GetSystemMetrics( SMCYScreen );
  983. w := User32.GetSystemMetrics( SMCXScreen ); create.style := create.style + {User32.WSMaximize};
  984. create.x := x; create.y := y; create.w := w; create.h := h + captionY;
  985. END;
  986. NEW( disp ); disp.width := w; disp.height := h; disp.format := format; disp.desc := "Display driver ("; Strings.IntToStr( disp.width, ts );
  987. Strings.Append( disp.desc, ts ); Strings.Append( disp.desc, "x" ); Strings.IntToStr( disp.height, ts );
  988. Strings.Append( disp.desc, ts ); Strings.Append( disp.desc, "x" ); Strings.IntToStr( disp.format, ts );
  989. Strings.Append( disp.desc, ts ); Strings.Append( disp.desc, ")" ); create.finished := FALSE;
  990. CreateWin( create );
  991. User32.SetWindowText(root.hWnd, windowTitle);
  992. User32.BringWindowToTop( root.hWnd ); User32.SetForegroundWindow( root.hWnd );
  993. Displays.registry.Add( disp, res );
  994. ASSERT ( res = 0 );
  995. IF fullscreen THEN
  996. res :=
  997. User32.SetWindowLong( win.hWnd, User32.GWLStyle,
  998. SYSTEM.VAL( LONGINT, SYSTEM.VAL( SET, User32.GetWindowLong( win.hWnd, User32.GWLStyle ) ) - SYSTEM.VAL( SET, 12582912 (* WScaption *) ) ) );
  999. res := User32.GetWindowRect( win.hWnd, rect );
  1000. res := User32.SetWindowRgn( win.hWnd, GDI32.CreateRectRgn( rect.left, rect.bottom, rect.right, rect.top ), 1 );
  1001. win.frame := TRUE
  1002. END
  1003. ELSIF root = NIL THEN w := disp.width; h := disp.height;
  1004. NEW( win ); Init( win ); hMenu := Kernel32.NULL; RegisterClasses(); NEW( create ); create.win := win;
  1005. create.hMenu := hMenu;
  1006. create.style :=
  1007. {User32.WSMinimizeBox, User32.WSMaximizeBox, User32.WSSysMenu, User32.WSVisible, User32.WSBorder, User32.WSThickFrame};
  1008. x := User32.CWUseDefault; y := User32.CWUseDefault; COPY( windowClassName, create.className ); create.x := x;
  1009. create.y := y; create.w := w; create.h := h + User32.GetSystemMetrics( User32.SMCYCaption );
  1010. create.finished := FALSE;
  1011. CreateWin( create );
  1012. User32.SetWindowText(root.hWnd, windowTitle);
  1013. User32.BringWindowToTop( root.hWnd ); disp.Update;
  1014. User32.SetForegroundWindow( root.hWnd );
  1015. ELSE
  1016. KernelLog.Enter; KernelLog.String( "Display: Display already open, window still open" ); KernelLog.Exit;
  1017. IF minimized IN root.state THEN User32.ShowWindow( root.hWnd, User32.SWRestore ); END;
  1018. User32.BringWindowToTop( root.hWnd ); User32.SetForegroundWindow( root.hWnd );
  1019. END;
  1020. hDC := User32.GetDC(0);
  1021. disp.unit := GDI32.GetDeviceCaps(hDC,GDI32.LogPixelsX);
  1022. disp.unit := ENTIER((36000.0*disp.unit)/25.4);
  1023. User32.ReleaseDC(0,hDC);
  1024. END DoInstall;
  1025. PROCEDURE Install*(context : Commands.Context); (** ["H"] [ width [height] ] ["FULLSCREEN"] [ x [y] ] *)
  1026. VAR x,y,w,h : LONGINT; options: Options.Options;
  1027. BEGIN
  1028. NEW(options);
  1029. options.Add("b","bits16",Options.Flag);
  1030. options.Add("f","fullscreen",Options.Flag);
  1031. options.Add("w","width",Options.Integer);
  1032. options.Add("h","height",Options.Integer);
  1033. options.Add("x","xOffset",Options.Integer);
  1034. options.Add("y","yOffset",Options.Integer);
  1035. options.Add("n","noMouseCursor",Options.Flag);
  1036. IF ~options.Parse(context.arg, context.error) THEN
  1037. w := 0; h := 0; x := 0; y := 0;
  1038. ELSE
  1039. IF options.GetFlag("b") THEN format := Displays.color565; InitBMI END;
  1040. fullscreen := options.GetFlag("f");
  1041. IF ~options.GetInteger("x", x) THEN x := 0 END;
  1042. IF ~options.GetInteger("y", y) THEN y := 0 END;
  1043. IF ~options.GetInteger("w", w) THEN w := 0 END;
  1044. IF ~options.GetInteger("h", h) THEN h := 0 END;
  1045. IF options.GetFlag("n") THEN DisableCursor END;
  1046. END;
  1047. closeRequests := 0;
  1048. DoInstall( w, h, x, y);
  1049. END Install;
  1050. VAR traceDisplay: BOOLEAN;
  1051. PROCEDURE TraceDisplay*;
  1052. BEGIN
  1053. traceDisplay := ~traceDisplay;
  1054. END TraceDisplay;
  1055. BEGIN
  1056. traceDisplay := FALSE;
  1057. format := Displays.color8888;
  1058. InitMod(); Modules.InstallTermHandler( Shutdown ); KeyHandled := FALSE;
  1059. END Display.
  1060. Aos.Call Display.Install 1024 768 ~
  1061. Aos.Call Display.Install ~
  1062. Aos.Call WindowManager.Install
  1063. Aos.Call MM.Open Menu.XML ~
  1064. (* window constants :
  1065. indexing
  1066. description: "Window message (WM) constants."
  1067. status: "See notice at end of class."
  1068. date: "$Date: 2001/11/12 17:58:05 $"
  1069. revision: "$Revision: 1.3 $"
  1070. class interface
  1071. WEL_WM_CONSTANTS
  1072. feature -- Access
  1073. Wm_activate: INTEGER is 6
  1074. -- Declared in Windows as WM_ACTIVATE
  1075. Wm_activateapp: INTEGER is 28
  1076. -- Declared in Windows as WM_ACTIVATEAPP
  1077. Wm_afxfirst: INTEGER is 864
  1078. -- Declared in Windows as WM_AFXFIRST
  1079. Wm_afxlast: INTEGER is 895
  1080. -- Declared in Windows as WM_AFXLAST
  1081. Wm_app: INTEGER is 32768
  1082. -- Declared in Windows as WM_APP
  1083. Wm_appcommand: INTEGER is 793
  1084. -- Declared in Windows as WM_APPCOMMAND
  1085. Wm_askcbformatname: INTEGER is 780
  1086. -- Declared in Windows as WM_ASKCBFORMATNAME
  1087. Wm_canceljournal: INTEGER is 75
  1088. -- Declared in Windows as WM_CANCELJOURNAL
  1089. Wm_cancelmode: INTEGER is 31
  1090. -- Declared in Windows as WM_CANCELMODE
  1091. Wm_capturechanged: INTEGER is 533
  1092. -- Declared in Windows as WM_CAPTURECHANGED
  1093. Wm_changecbchain: INTEGER is 781
  1094. -- Declared in Windows as WM_CHANGECBCHAIN
  1095. Wm_changeuistate: INTEGER is 295
  1096. -- Declared in Windows as WM_CHANGEUISTATE
  1097. Wm_char: INTEGER is 258
  1098. -- Declared in Windows as WM_CHAR
  1099. Wm_chartoitem: INTEGER is 47
  1100. -- Declared in Windows as WM_CHARTOITEM
  1101. Wm_childactivate: INTEGER is 34
  1102. -- Declared in Windows as WM_CHILDACTIVATE
  1103. Wm_clear: INTEGER is 771
  1104. -- Declared in Windows as WM_CLEAR
  1105. Wm_close: INTEGER is 16
  1106. -- Declared in Windows as WM_CLOSE
  1107. Wm_command: INTEGER is 273
  1108. -- Declared in Windows as WM_COMMAND
  1109. Wm_commnotify: INTEGER is 68
  1110. -- Declared in Windows as WM_COMMNOTIFY
  1111. Wm_compacting: INTEGER is 65
  1112. -- Declared in Windows as WM_COMPACTING
  1113. Wm_compareitem: INTEGER is 57
  1114. -- Declared in Windows as WM_COMPAREITEM
  1115. Wm_contextmenu: INTEGER is 123
  1116. -- Declared in Windows as WM_CONTEXTMENU
  1117. Wm_copy: INTEGER is 769
  1118. -- Declared in Windows as WM_COPY
  1119. Wm_copydata: INTEGER is 74
  1120. -- Declared in Windows as WM_COPYDATA
  1121. Wm_create: INTEGER is 1
  1122. -- Declared in Windows as WM_CREATE
  1123. Wm_cut: INTEGER is 768
  1124. -- Declared in Windows as WM_CUT
  1125. Wm_deadchar: INTEGER is 259
  1126. -- Declared in Windows as WM_DEADCHAR
  1127. Wm_deleteitem: INTEGER is 45
  1128. -- Declared in Windows as WM_DELETEITEM
  1129. Wm_destroy: INTEGER is 2
  1130. -- Declared in Windows as WM_DESTROY
  1131. Wm_destroyclipboard: INTEGER is 775
  1132. -- Declared in Windows as WM_DESTROYCLIPBOARD
  1133. Wm_devicechange: INTEGER is 537
  1134. -- Declared in Windows as WM_DEVICECHANGE
  1135. Wm_devmodechange: INTEGER is 27
  1136. -- Declared in Windows as WM_DEVMODECHANGE
  1137. Wm_displaychange: INTEGER is 126
  1138. -- Declared in Windows as WM_DISPLAYCHANGE
  1139. Wm_drawclipboard: INTEGER is 776
  1140. -- Declared in Windows as WM_DRAWCLIPBOARD
  1141. Wm_drawitem: INTEGER is 43
  1142. -- Declared in Windows as WM_DRAWITEM
  1143. Wm_dropfiles: INTEGER is 563
  1144. -- Declared in Windows as WM_DROPFILES
  1145. Wm_enable: INTEGER is 10
  1146. -- Declared in Windows as WM_ENABLE
  1147. Wm_endsession: INTEGER is 22
  1148. -- Declared in Windows as WM_ENDSESSION
  1149. Wm_enteridle: INTEGER is 289
  1150. -- Declared in Windows as WM_ENTERIDLE
  1151. Wm_entermenuloop: INTEGER is 529
  1152. -- Declared in Windows as WM_ENTERMENULOOP
  1153. Wm_entersizemove: INTEGER is 561
  1154. -- Declared in Windows as WM_ENTERSIZEOFMOVE
  1155. Wm_erasebkgnd: INTEGER is 20
  1156. -- Declared in Windows as WM_ERASEBKGND
  1157. Wm_exitmenuloop: INTEGER is 530
  1158. -- Declared in Windows as WM_EXITMENULOOP
  1159. Wm_exitsizemove: INTEGER is 562
  1160. -- Declared in Windows as WM_EXITSIZEOFMOVE
  1161. Wm_fontchange: INTEGER is 29
  1162. -- Declared in Windows as WM_FONTCHANGE
  1163. Wm_getdlgcode: INTEGER is 135
  1164. -- Declared in Windows as WM_GETDLGCODE
  1165. Wm_getfont: INTEGER is 49
  1166. -- Declared in Windows as WM_GETFONT
  1167. Wm_gethotkey: INTEGER is 51
  1168. -- Declared in Windows as WM_GETHOTKEY
  1169. Wm_geticon: INTEGER is 127
  1170. -- Declared in Windows as WM_GETICON
  1171. Wm_getminmaxinfo: INTEGER is 36
  1172. -- Declared in Windows as WM_GETMINMAXINFO
  1173. Wm_getobject: INTEGER is 61
  1174. -- Declared in Windows as WM_GETOBJECT
  1175. Wm_gettext: INTEGER is 13
  1176. -- Declared in Windows as WM_GETTEXT
  1177. Wm_gettextlength: INTEGER is 14
  1178. -- Declared in Windows as WM_GETTEXTLENGTH
  1179. Wm_handheldfirst: INTEGER is 856
  1180. -- Declared in Windows as WM_HANDHELDFIRST
  1181. Wm_handheldlast: INTEGER is 863
  1182. -- Declared in Windows as WM_HANDHELDLAST
  1183. Wm_help: INTEGER is 83
  1184. -- Declared in Windows as WM_HELP
  1185. Wm_hotkey: INTEGER is 786
  1186. -- Declared in Windows as WM_HOTKEY
  1187. Wm_hscroll: INTEGER is 276
  1188. -- Declared in Windows as WM_HSCROLL
  1189. Wm_hscrollclipboard: INTEGER is 782
  1190. -- Declared in Windows as WM_HSCROLLCLIPBOARD
  1191. Wm_iconerasebkgnd: INTEGER is 39
  1192. -- Declared in Windows as WM_ICONERASEBKGND
  1193. Wm_ime_char: INTEGER is 646
  1194. -- Declared in Windows as WM_IME_CHAR
  1195. Wm_ime_composition: INTEGER is 271
  1196. -- Declared in Windows as WM_IME_COMPOSITION
  1197. Wm_ime_compositionfull: INTEGER is 644
  1198. -- Declared in Windows as WM_IME_COMPOSITIONFULL
  1199. Wm_ime_control: INTEGER is 643
  1200. -- Declared in Windows as WM_IME_CONTROL
  1201. Wm_ime_endcomposition: INTEGER is 270
  1202. -- Declared in Windows as WM_IME_ENDCOMPOSITION
  1203. Wm_ime_keydown: INTEGER is 656
  1204. -- Declared in Windows as WM_IME_KEYDOWN
  1205. wm_ime_keylast: INTEGER
  1206. -- Declared in Windows as WM_IME_KEYLAST
  1207. Wm_ime_keyup: INTEGER is 657
  1208. -- Declared in Windows as WM_IME_KEYUP
  1209. Wm_ime_notify: INTEGER is 642
  1210. -- Declared in Windows as WM_IME_NOTIFY
  1211. Wm_ime_request: INTEGER is 648
  1212. -- Declared in Windows as WM_IME_REQUEST
  1213. Wm_ime_select: INTEGER is 645
  1214. -- Declared in Windows as WM_IME_SELECT
  1215. Wm_ime_setcontext: INTEGER is 641
  1216. -- Declared in Windows as WM_IME_SETCONTEXT
  1217. Wm_ime_startcomposition: INTEGER is 269
  1218. -- Declared in Windows as WM_IME_STARTCOMPOSITION
  1219. Wm_initdialog: INTEGER is 272
  1220. -- Declared in Windows as WM_INITDIALOG
  1221. Wm_initmenu: INTEGER is 278
  1222. -- Declared in Windows as WM_INITMENU
  1223. Wm_initmenupopup: INTEGER is 279
  1224. -- Declared in Windows as WM_INITMENUPOPUP
  1225. Wm_inputlangchange: INTEGER is 81
  1226. -- Declared in Windows as WM_INPUTLANGCHANGE
  1227. Wm_inputlangchangerequest: INTEGER is 80
  1228. -- Declared in Windows as WM_INPUTLANGCHANGEREQUEST
  1229. Wm_keydown: INTEGER is 256
  1230. -- Declared in Windows as WM_KEYDOWN
  1231. Wm_keyfirst: INTEGER is 256
  1232. -- Declared in Windows as WM_KEYFIRST
  1233. wm_keylast: INTEGER
  1234. -- Declared in Windows as WM_KEYLAST
  1235. Wm_keyup: INTEGER is 257
  1236. -- Declared in Windows as WM_KEYUP
  1237. Wm_killfocus: INTEGER is 8
  1238. -- Declared in Windows as WM_KILLFOCUS
  1239. Wm_lbuttondblclk: INTEGER is 515
  1240. -- Declared in Windows as WM_LBUTTONDBLCLK
  1241. Wm_lbuttondown: INTEGER is 513
  1242. -- Declared in Windows as WM_LBUTTONDOWN
  1243. Wm_lbuttonup: INTEGER is 514
  1244. -- Declared in Windows as WM_LBUTTONUP
  1245. Wm_mbuttondblclk: INTEGER is 521
  1246. -- Declared in Windows as WM_MBUTTONDBLCLK
  1247. Wm_mbuttondown: INTEGER is 519
  1248. -- Declared in Windows as WM_MBUTTONDOWN
  1249. Wm_mbuttonup: INTEGER is 520
  1250. -- Declared in Windows as WM_MBUTTONUP
  1251. Wm_mdiactivate: INTEGER is 546
  1252. -- Declared in Windows as WM_MDIACTIVATE
  1253. Wm_mdicascade: INTEGER is 551
  1254. -- Declared in Windows as WM_MDICASCADE
  1255. Wm_mdicreate: INTEGER is 544
  1256. -- Declared in Windows as WM_MDICREATE
  1257. Wm_mdidestroy: INTEGER is 545
  1258. -- Declared in Windows as WM_MDIDESTROY
  1259. Wm_mdigetactive: INTEGER is 553
  1260. -- Declared in Windows as WM_MDIGETACTIVE
  1261. Wm_mdiiconarrange: INTEGER is 552
  1262. -- Declared in Windows as WM_MDIICONARRANGE
  1263. Wm_mdimaximize: INTEGER is 549
  1264. -- Declared in Windows as WM_MDIMAXIMIZE
  1265. Wm_mdinext: INTEGER is 548
  1266. -- Declared in Windows as WM_MDINEXT
  1267. Wm_mdirefreshmenu: INTEGER is 564
  1268. -- Declared in Windows as WM_MDIREFRESHMENU
  1269. Wm_mdirestore: INTEGER is 547
  1270. -- Declared in Windows as WM_MDIRESTORE
  1271. Wm_mdisetmenu: INTEGER is 560
  1272. -- Declared in Windows as WM_MDISETMENU
  1273. Wm_mditile: INTEGER is 550
  1274. -- Declared in Windows as WM_MDITILE
  1275. Wm_measureitem: INTEGER is 44
  1276. -- Declared in Windows as WM_MEASUREITEM
  1277. Wm_menuchar: INTEGER is 288
  1278. -- Declared in Windows as WM_MENUCHAR
  1279. Wm_menucommand: INTEGER is 294
  1280. -- Declared in Windows as WM_MENUCOMMAND
  1281. Wm_menudrag: INTEGER is 291
  1282. -- Declared in Windows as WM_MENUDRAG
  1283. Wm_menugetobject: INTEGER is 292
  1284. -- Declared in Windows as WM_MENUGETOBJECT
  1285. Wm_menurbuttonup: INTEGER is 290
  1286. -- Declared in Windows as WM_MENURBUTTONUP
  1287. Wm_menuselect: INTEGER is 287
  1288. -- Declared in Windows as WM_MENUSELECT
  1289. Wm_mouseactivate: INTEGER is 33
  1290. -- Declared in Windows as WM_MOUSEACTIVATE
  1291. Wm_mousefirst: INTEGER is 512
  1292. -- Declared in Windows as WM_MOUSEFIRST
  1293. Wm_mousehover: INTEGER is 673
  1294. -- Require Windows98, Windows NT 4.0 or later
  1295. -- Declared in Windows as WM_MOUSEHOVER
  1296. wm_mouselast: INTEGER
  1297. -- Declared in Windows as WM_MOUSELAST
  1298. Wm_mouseleave: INTEGER is 675
  1299. -- Require Windows98, Windows NT 4.0 or later
  1300. -- Declared in Windows as WM_MOUSELEAVE
  1301. Wm_mousemove: INTEGER is 512
  1302. -- Declared in Windows as WM_MOUSEMOVE
  1303. Wm_mousewheel: INTEGER is 522
  1304. -- Declared in Windows as WM_MOUSEWHEEL
  1305. Wm_move: INTEGER is 3
  1306. -- Declared in Windows as WM_MOVE
  1307. Wm_moving: INTEGER is 534
  1308. -- Declared in Windows as WM_MOVING
  1309. Wm_ncactivate: INTEGER is 134
  1310. -- Declared in Windows as WM_NCACTIVATE
  1311. Wm_nccalcsize: INTEGER is 131
  1312. -- Declared in Windows as WM_NCCALCSIZEOF
  1313. Wm_nccreate: INTEGER is 129
  1314. -- Declared in Windows as WM_NCCREATE
  1315. Wm_ncdestroy: INTEGER is 130
  1316. -- Declared in Windows as WM_NCDESTROY
  1317. Wm_nchittest: INTEGER is 132
  1318. -- Declared in Windows as WM_NCHITTEST
  1319. Wm_nclbuttondblclk: INTEGER is 163
  1320. -- Declared in Windows as WM_NCLBUTTONDBLCLK
  1321. Wm_nclbuttondown: INTEGER is 161
  1322. -- Declared in Windows as WM_NCLBUTTONDOWN
  1323. Wm_nclbuttonup: INTEGER is 162
  1324. -- Declared in Windows as WM_NCLBUTTONUP
  1325. Wm_ncmbuttondblclk: INTEGER is 169
  1326. -- Declared in Windows as WM_NCMBUTTONDBLCLK
  1327. Wm_ncmbuttondown: INTEGER is 167
  1328. -- Declared in Windows as WM_NCMBUTTONDOWN
  1329. Wm_ncmbuttonup: INTEGER is 168
  1330. -- Declared in Windows as WM_NCMBUTTONUP
  1331. Wm_ncmousehover: INTEGER is 672
  1332. -- Require Windows98, Windows NT 5.0 or later
  1333. -- Declared in Windows as WM_NCMOUSEHOVER
  1334. Wm_ncmouseleave: INTEGER is 674
  1335. -- Require Windows98, Windows NT 5.0 or later
  1336. -- Declared in Windows as WM_NCMOUSELEAVE
  1337. Wm_ncmousemove: INTEGER is 160
  1338. -- Declared in Windows as WM_NCMOUSEMOVE
  1339. Wm_ncpaint: INTEGER is 133
  1340. -- Declared in Windows as WM_NCPAINT
  1341. Wm_ncrbuttondblclk: INTEGER is 166
  1342. -- Declared in Windows as WM_NCRBUTTONDBLCLK
  1343. Wm_ncrbuttondown: INTEGER is 164
  1344. -- Declared in Windows as WM_NCRBUTTONDOWN
  1345. Wm_ncrbuttonup: INTEGER is 165
  1346. -- Declared in Windows as WM_NCRBUTTONUP
  1347. Wm_ncxbuttondblclk: INTEGER is 173
  1348. -- Declared in Windows as WM_NCXBUTTONDBLCLK
  1349. Wm_ncxbuttondown: INTEGER is 171
  1350. -- Declared in Windows as WM_NCXBUTTONDOWN
  1351. Wm_ncxbuttonup: INTEGER is 172
  1352. -- Declared in Windows as WM_NCXBUTTONUP
  1353. Wm_nextdlgctl: INTEGER is 40
  1354. -- Declared in Windows as WM_NEXTDLGCTL
  1355. Wm_nextmenu: INTEGER is 531
  1356. -- Declared in Windows as WM_NEXTMENU
  1357. Wm_notify: INTEGER is 78
  1358. -- Declared in Windows as WM_NOTIFY
  1359. Wm_notifyformat: INTEGER is 85
  1360. -- Declared in Windows as WM_NOTIFYFORMAT
  1361. Wm_null: INTEGER is 0
  1362. -- Declared in Windows as WM_NULL
  1363. Wm_paint: INTEGER is 15
  1364. -- Declared in Windows as WM_PAINT
  1365. Wm_paintclipboard: INTEGER is 777
  1366. -- Declared in Windows as WM_PAINTCLIPBOARD
  1367. Wm_painticon: INTEGER is 38
  1368. -- Declared in Windows as WM_PAINTICON
  1369. Wm_palettechanged: INTEGER is 785
  1370. -- Declared in Windows as WM_PALETTECHANGED
  1371. Wm_paletteischanging: INTEGER is 784
  1372. -- Declared in Windows as WM_PALETTEISCHANGING
  1373. Wm_parentnotify: INTEGER is 528
  1374. -- Declared in Windows as WM_PARENTNOTIFY
  1375. Wm_paste: INTEGER is 770
  1376. -- Declared in Windows as WM_PASTE
  1377. Wm_penwinfirst: INTEGER is 896
  1378. -- Declared in Windows as WM_PENWINFIRST
  1379. Wm_penwinlast: INTEGER is 911
  1380. -- Declared in Windows as WM_PENWINLAST
  1381. Wm_power: INTEGER is 72
  1382. -- Declared in Windows as WM_POWER
  1383. Wm_powerbroadcast: INTEGER is 536
  1384. -- Declared in Windows as WM_POWERBROADCAST
  1385. Wm_print: INTEGER is 791
  1386. -- Declared in Windows as WM_PRINT
  1387. Wm_printclient: INTEGER is 792
  1388. -- Declared in Windows as WM_PRINTCLIENT
  1389. Wm_querydragicon: INTEGER is 55
  1390. -- Declared in Windows as WM_QUERYDRAGICON
  1391. Wm_queryendsession: INTEGER is 17
  1392. -- Declared in Windows as WM_QUERYENDSESSION
  1393. Wm_querynewpalette: INTEGER is 783
  1394. -- Declared in Windows as WM_QUERYNEWPALETTE
  1395. Wm_queryopen: INTEGER is 19
  1396. -- Declared in Windows as WM_QUERYOPEN
  1397. Wm_queryuistate: INTEGER is 297
  1398. -- Declared in Windows as WM_QUERYUISTATE
  1399. Wm_queuesync: INTEGER is 35
  1400. -- Declared in Windows as WM_QUEUESYNC
  1401. Wm_quit: INTEGER is 18
  1402. -- Declared in Windows as WM_QUIT
  1403. Wm_rbuttondblclk: INTEGER is 518
  1404. -- Declared in Windows as WM_RBUTTONDBLCLK
  1405. Wm_rbuttondown: INTEGER is 516
  1406. -- Declared in Windows as WM_RBUTTONDOWN
  1407. Wm_rbuttonup: INTEGER is 517
  1408. -- Declared in Windows as WM_RBUTTONUP
  1409. Wm_renderallformats: INTEGER is 774
  1410. -- Declared in Windows as WM_RENDERALLFORMATS
  1411. Wm_renderformat: INTEGER is 773
  1412. -- Declared in Windows as WM_RENDERFORMAT
  1413. Wm_setcursor: INTEGER is 32
  1414. -- Declared in Windows as WM_SETCURSOR
  1415. Wm_setfocus: INTEGER is 7
  1416. -- Declared in Windows as WM_SETFOCUS
  1417. Wm_setfont: INTEGER is 48
  1418. -- Declared in Windows as WM_SETFONT
  1419. Wm_sethotkey: INTEGER is 50
  1420. -- Declared in Windows as WM_SETHOTKEY
  1421. Wm_seticon: INTEGER is 128
  1422. -- Declared in Windows as WM_SETICON
  1423. Wm_setredraw: INTEGER is 11
  1424. -- Declared in Windows as WM_SETREDRAW
  1425. Wm_settext: INTEGER is 12
  1426. -- Declared in Windows as WM_SETTEXT
  1427. Wm_settingchange: INTEGER is 26
  1428. -- Declared in Windows as WM_WININICHANGE
  1429. -- Was declared in WEL_WM_CONSTANTS as synonym of wm_wininichange.
  1430. Wm_showwindow: INTEGER is 24
  1431. -- Declared in Windows as WM_SHOWWINDOW
  1432. Wm_size: INTEGER is 5
  1433. -- Declared in Windows as WM_SIZEOF
  1434. Wm_sizeclipboard: INTEGER is 779
  1435. -- Declared in Windows as WM_SIZEOFCLIPBOARD
  1436. Wm_sizing: INTEGER is 532
  1437. -- Declared in Windows as WM_SIZING
  1438. Wm_spoolerstatus: INTEGER is 42
  1439. -- Declared in Windows as WM_SPOOLERSTATUS
  1440. Wm_stylechanged: INTEGER is 125
  1441. -- Declared in Windows as WM_STYLECHANGED
  1442. Wm_stylechanging: INTEGER is 124
  1443. -- Declared in Windows as WM_STYLECHANGING
  1444. Wm_syncpaint: INTEGER is 136
  1445. -- Declared in Windows as WM_SYNCPAINT
  1446. Wm_syschar: INTEGER is 262
  1447. -- Declared in Windows as WM_SYSCHAR
  1448. Wm_syscolorchange: INTEGER is 21
  1449. -- Declared in Windows as WM_SYSCOLORCHANGE
  1450. Wm_syscommand: INTEGER is 274
  1451. -- Declared in Windows as WM_SYSCOMMAND
  1452. Wm_sysdeadchar: INTEGER is 263
  1453. -- Declared in Windows as WM_SYSDEADCHAR
  1454. Wm_syskeydown: INTEGER is 260
  1455. -- Declared in Windows as WM_SYSKEYDOWN
  1456. Wm_syskeyup: INTEGER is 261
  1457. -- Declared in Windows as WM_SYSKEYUP
  1458. Wm_tcard: INTEGER is 82
  1459. -- Declared in Windows as WM_TCARD
  1460. Wm_timechange: INTEGER is 30
  1461. -- Declared in Windows as WM_TIMECHANGE
  1462. Wm_timer: INTEGER is 275
  1463. -- Declared in Windows as WM_TIMER
  1464. Wm_undo: INTEGER is 772
  1465. -- Declared in Windows as WM_UNDO
  1466. Wm_uninitmenupopup: INTEGER is 293
  1467. -- Declared in Windows as WM_UNINITMENUPOPUP
  1468. Wm_updateuistate: INTEGER is 296
  1469. -- Declared in Windows as WM_UPDATEUISTATE
  1470. Wm_user: INTEGER is 1024
  1471. -- Declared in Windows as WM_USER
  1472. Wm_userchanged: INTEGER is 84
  1473. -- Declared in Windows as WM_USERCHANGED
  1474. Wm_vkeytoitem: INTEGER is 46
  1475. -- Declared in Windows as WM_VKEYTOITEM
  1476. Wm_vscroll: INTEGER is 277
  1477. -- Declared in Windows as WM_VSCROLL
  1478. Wm_vscrollclipboard: INTEGER is 778
  1479. -- Declared in Windows as WM_VSCROLLCLIPBOARD
  1480. Wm_windowposchanged: INTEGER is 71
  1481. -- Declared in Windows as WM_WINDOWPOSCHANGED
  1482. Wm_windowposchanging: INTEGER is 70
  1483. -- Declared in Windows as WM_WINDOWPOSCHANGING
  1484. Wm_wininichange: INTEGER is 26
  1485. -- Declared in Windows as WM_WININICHANGE
  1486. -- Was declared in WEL_WM_CONSTANTS as synonym of wm_settingchange.
  1487. Wm_xbuttondblclk: INTEGER is 525
  1488. -- Declared in Windows as WM_XBUTTONDBLCLK
  1489. Wm_xbuttondown: INTEGER is 523
  1490. -- Declared in Windows as WM_XBUTTONDOWN
  1491. Wm_xbuttonup: INTEGER is 524
  1492. -- Declared in Windows as WM_XBUTTONUP
  1493. invariant
  1494. -- from ANY
  1495. reflexive_equality: standard_is_equal (Current)
  1496. reflexive_conformance: conforms_to (Current)
  1497. end -- class WEL_WM_CONSTANTS
  1498. WM Key down
  1499. Parameters
  1500. wParam
  1501. Specifies the virtual-key code of the nonsystem key.
  1502. lParam
  1503. Specifies the repeat count, scan code, extended-key flag, context code, previous key-state flag, and transition-state flag, as shown in the following table.
  1504. 0-15
  1505. Specifies the repeat count for the current message. The value is the number of times the keystroke is autorepeated as a result of the user holding down the key.
  1506. If the keystroke is held long enough, multiple messages are sent. However, the repeat count is not cumulative.
  1507. 16-23
  1508. Specifies the scan code. The value depends on the OEM.
  1509. 24
  1510. Specifies whether the key is an extended key, such as the right-hand ALT and CTRL keys that appear on an enhanced 101- or 102-key keyboard. The value is 1 if it is an extended key; otherwise, it is 0.
  1511. 25-28
  1512. Reserved; do not use.
  1513. 29
  1514. Specifies the context code. The value is always 0 for a WM_KEYDOWN message.
  1515. 30
  1516. Specifies the previous key state. The value is 1 if the key is down before the message is sent, or it is zero if the key is up.
  1517. 31
  1518. Specifies the transition state. The value is always zero for a WM_KEYDOWN message.
  1519. wm key up
  1520. wParam
  1521. Specifies the virtual-key code of the nonsystem key.
  1522. lParam
  1523. Specifies the repeat count, scan code, extended-key flag, context code, previous key-state flag, and transition-state flag, as shown in the following table. 0-15
  1524. Specifies the repeat count for the current message. The value is the number of times the keystroke is autorepeated as a result of the user holding down the key. The repeat count is always one for a WM_KEYUP message.
  1525. 16-23
  1526. Specifies the scan code. The value depends on the OEM.
  1527. 24
  1528. Specifies whether the key is an extended key, such as the right-hand ALT and CTRL keys that appear on an enhanced 101- or 102-key keyboard. The value is 1 if it is an extended key; otherwise, it is 0.
  1529. 25-28
  1530. Reserved; do not use.
  1531. 29
  1532. Specifies the context code. The value is always 0 for a WM_KEYUP message.
  1533. 30
  1534. Specifies the previous key state. The value is always 1 for a WM_KEYUP message.
  1535. 31
  1536. Specifies the transition state. The value is always 1 for a WM_KEYUP message.
  1537. indexing
  1538. description: "Virtual Key code (VK) constants."
  1539. status: "See notice at end of class."
  1540. date: "$Date: 2001/11/12 17:58:05 $"
  1541. revision: "$Revision: 1.3 $"
  1542. class interface
  1543. WEL_VK_CONSTANTS
  1544. feature -- Access
  1545. Vk_0: INTEGER is 48
  1546. Vk_1: INTEGER is 49
  1547. Vk_2: INTEGER is 50
  1548. Vk_3: INTEGER is 51
  1549. Vk_4: INTEGER is 52
  1550. Vk_5: INTEGER is 53
  1551. Vk_6: INTEGER is 54
  1552. Vk_7: INTEGER is 55
  1553. Vk_8: INTEGER is 56
  1554. Vk_9: INTEGER is 57
  1555. -- Vk_a thru Vk_z are the same as their ASCII equivalents: 'A' thru 'Z'.
  1556. Vk_a: INTEGER is 65
  1557. Vk_add: INTEGER is 107
  1558. -- Declared in Windows as VK_ADD
  1559. Vk_b: INTEGER is 66
  1560. Vk_back: INTEGER is 8
  1561. -- Declared in Windows as VK_BACK
  1562. Vk_c: INTEGER is 67
  1563. Vk_cancel: INTEGER is 3
  1564. -- Declared in Windows as VK_CANCEL
  1565. Vk_capital: INTEGER is 20
  1566. -- Declared in Windows as VK_CAPITAL
  1567. Vk_clear: INTEGER is 12
  1568. -- Declared in Windows as VK_CLEAR
  1569. Vk_control: INTEGER is 17
  1570. -- Declared in Windows as VK_CONTROL
  1571. Vk_d: INTEGER is 68
  1572. Vk_decimal: INTEGER is 110
  1573. -- Declared in Windows as VK_DECIMAL
  1574. Vk_delete: INTEGER is 46
  1575. -- Declared in Windows as VK_DELETE
  1576. Vk_divide: INTEGER is 111
  1577. -- Declared in Windows as VK_DIVIDE
  1578. Vk_down: INTEGER is 40
  1579. -- Declared in Windows as VK_DOWN
  1580. Vk_e: INTEGER is 69
  1581. Vk_end: INTEGER is 35
  1582. -- Declared in Windows as VK_END
  1583. Vk_escape: INTEGER is 27
  1584. -- Declared in Windows as VK_ESCAPE
  1585. Vk_execute: INTEGER is 43
  1586. -- Declared in Windows as VK_EXECUTE
  1587. Vk_f: INTEGER is 70
  1588. Vk_f1: INTEGER is 112
  1589. -- Declared in Windows as VK_F1
  1590. Vk_f10: INTEGER is 121
  1591. -- Declared in Windows as VK_F10
  1592. Vk_f11: INTEGER is 122
  1593. -- Declared in Windows as VK_F11
  1594. Vk_f12: INTEGER is 123
  1595. -- Declared in Windows as VK_F12
  1596. Vk_f13: INTEGER is 124
  1597. -- Declared in Windows as VK_F13
  1598. Vk_f14: INTEGER is 125
  1599. -- Declared in Windows as VK_F14
  1600. Vk_f15: INTEGER is 126
  1601. -- Declared in Windows as VK_F15
  1602. Vk_f16: INTEGER is 127
  1603. -- Declared in Windows as VK_F16
  1604. Vk_f17: INTEGER is 128
  1605. -- Declared in Windows as VK_F17
  1606. Vk_f18: INTEGER is 129
  1607. -- Declared in Windows as VK_F18
  1608. Vk_f19: INTEGER is 130
  1609. -- Declared in Windows as VK_F19
  1610. Vk_f2: INTEGER is 113
  1611. -- Declared in Windows as VK_F2
  1612. Vk_f20: INTEGER is 131
  1613. -- Declared in Windows as VK_F20
  1614. Vk_f21: INTEGER is 132
  1615. -- Declared in Windows as VK_F21
  1616. Vk_f22: INTEGER is 133
  1617. -- Declared in Windows as VK_F22
  1618. Vk_f23: INTEGER is 134
  1619. -- Declared in Windows as VK_F23
  1620. Vk_f24: INTEGER is 135
  1621. -- Declared in Windows as VK_F24
  1622. Vk_f3: INTEGER is 114
  1623. -- Declared in Windows as VK_F3
  1624. Vk_f4: INTEGER is 115
  1625. -- Declared in Windows as VK_F4
  1626. Vk_f5: INTEGER is 116
  1627. -- Declared in Windows as VK_F5
  1628. Vk_f6: INTEGER is 117
  1629. -- Declared in Windows as VK_F6
  1630. Vk_f7: INTEGER is 118
  1631. -- Declared in Windows as VK_F7
  1632. Vk_f8: INTEGER is 119
  1633. -- Declared in Windows as VK_F8
  1634. Vk_f9: INTEGER is 120
  1635. -- Declared in Windows as VK_F9
  1636. Vk_g: INTEGER is 71
  1637. Vk_h: INTEGER is 72
  1638. Vk_help: INTEGER is 47
  1639. -- Declared in Windows as VK_HELP
  1640. Vk_home: INTEGER is 36
  1641. -- Declared in Windows as VK_HOME
  1642. Vk_i: INTEGER is 73
  1643. Vk_insert: INTEGER is 45
  1644. -- Declared in Windows as VK_INSERT
  1645. Vk_j: INTEGER is 74
  1646. Vk_k: INTEGER is 75
  1647. Vk_l: INTEGER is 76
  1648. Vk_lbutton: INTEGER is 1
  1649. -- Declared in Windows as VK_LBUTTON
  1650. Vk_lcontrol: INTEGER is 162
  1651. -- Declared in Windows as VK_LCONTROL
  1652. Vk_left: INTEGER is 37
  1653. -- Declared in Windows as VK_LEFT
  1654. Vk_lmenu: INTEGER is 164
  1655. -- Declared in Windows as VK_LMENU
  1656. Vk_lshift: INTEGER is 160
  1657. -- Declared in Windows as VK_LSHIFT
  1658. Vk_m: INTEGER is 77
  1659. Vk_mbutton: INTEGER is 4
  1660. -- Declared in Windows as VK_MBUTTON
  1661. Vk_menu: INTEGER is 18
  1662. -- Declared in Windows as VK_MENU
  1663. Vk_multiply: INTEGER is 106
  1664. -- Declared in Windows as VK_MULTIPLY
  1665. Vk_n: INTEGER is 78
  1666. Vk_next: INTEGER is 34
  1667. -- Declared in Windows as VK_NEXT
  1668. Vk_numlock: INTEGER is 144
  1669. -- Declared in Windows as VK_NUMLOCK
  1670. Vk_numpad0: INTEGER is 96
  1671. -- Declared in Windows as VK_NUMPAD0
  1672. Vk_numpad1: INTEGER is 97
  1673. -- Declared in Windows as VK_NUMPAD1
  1674. Vk_numpad2: INTEGER is 98
  1675. -- Declared in Windows as VK_NUMPAD2
  1676. Vk_numpad3: INTEGER is 99
  1677. -- Declared in Windows as VK_NUMPAD3
  1678. Vk_numpad4: INTEGER is 100
  1679. -- Declared in Windows as VK_NUMPAD4
  1680. Vk_numpad5: INTEGER is 101
  1681. -- Declared in Windows as VK_NUMPAD5
  1682. Vk_numpad6: INTEGER is 102
  1683. -- Declared in Windows as VK_NUMPAD6
  1684. Vk_numpad7: INTEGER is 103
  1685. -- Declared in Windows as VK_NUMPAD7
  1686. Vk_numpad8: INTEGER is 104
  1687. -- Declared in Windows as VK_NUMPAD8
  1688. Vk_numpad9: INTEGER is 105
  1689. -- Declared in Windows as VK_NUMPAD9
  1690. Vk_o: INTEGER is 79
  1691. Vk_p: INTEGER is 80
  1692. Vk_pause: INTEGER is 19
  1693. -- Declared in Windows as VK_PAUSE
  1694. Vk_print: INTEGER is 42
  1695. -- Declared in Windows as VK_PRINT
  1696. Vk_prior: INTEGER is 33
  1697. -- Declared in Windows as VK_PRIOR
  1698. Vk_q: INTEGER is 81
  1699. Vk_r: INTEGER is 82
  1700. Vk_rbutton: INTEGER is 2
  1701. -- Declared in Windows as VK_RBUTTON
  1702. Vk_rcontrol: INTEGER is 163
  1703. -- Declared in Windows as VK_RCONTROL
  1704. Vk_return: INTEGER is 13
  1705. -- Declared in Windows as VK_RETURN
  1706. Vk_right: INTEGER is 39
  1707. -- Declared in Windows as VK_RIGHT
  1708. Vk_rmenu: INTEGER is 165
  1709. -- Declared in Windows as VK_RMENU
  1710. -- Vk_0 thru Vk_9 are the same as their ASCII equivalents: '0' thru '9'.
  1711. Vk_rshift: INTEGER is 161
  1712. -- Declared in Windows as VK_RSHIFT
  1713. Vk_s: INTEGER is 83
  1714. Vk_scroll: INTEGER is 145
  1715. -- Declared in Windows as VK_SCROLL
  1716. Vk_select: INTEGER is 41
  1717. -- Declared in Windows as VK_SELECT
  1718. Vk_separator: INTEGER is 108
  1719. -- Declared in Windows as VK_SEPARATOR
  1720. Vk_shift: INTEGER is 16
  1721. -- Declared in Windows as VK_SHIFT
  1722. Vk_snapshot: INTEGER is 44nn
  1723. -- Declared in Windows as VK_SNAPSHOT
  1724. Vk_space: INTEGER is 32
  1725. -- Declared in Windows as VK_SPACE
  1726. Vk_subtract: INTEGER is 109
  1727. -- Declared in Windows as VK_SUBTRACT
  1728. Vk_t: INTEGER is 84
  1729. Vk_tab: INTEGER is 9
  1730. -- Declared in Windows as VK_TAB
  1731. Vk_u: INTEGER is 85
  1732. Vk_up: INTEGER is 38
  1733. -- Declared in Windows as VK_UP
  1734. Vk_v: INTEGER is 86
  1735. Vk_w: INTEGER is 87
  1736. Vk_x: INTEGER is 88
  1737. Vk_y: INTEGER is 89
  1738. Vk_z: INTEGER is 90
  1739. invariant
  1740. Sm_cmetrics: INTEGER is 76
  1741. Sm_cxborder: INTEGER is 5
  1742. Sm_cxcursor: INTEGER is 13
  1743. Sm_cxdlgframe: INTEGER is 7
  1744. Sm_cxdoubleclk: INTEGER is 36
  1745. Sm_cxframe: INTEGER is 32
  1746. Sm_cxfullscreen: INTEGER is 16
  1747. Sm_cxhscroll: INTEGER is 21
  1748. Sm_cxhthumb: INTEGER is 10
  1749. Sm_cxicon: INTEGER is 11
  1750. Sm_cxiconspacing: INTEGER is 38
  1751. Sm_cxmaximized: INTEGER is 61
  1752. Sm_cxmin: INTEGER is 28
  1753. Sm_cxmintrack: INTEGER is 34
  1754. Sm_cxscreen: INTEGER is 0
  1755. Sm_cxsize: INTEGER is 30
  1756. Sm_cxvscroll: INTEGER is 2
  1757. Sm_cyborder: INTEGER is 6
  1758. Sm_cycaption: INTEGER is 4
  1759. Sm_cycursor: INTEGER is 14
  1760. Sm_cydlgframe: INTEGER is 8
  1761. Sm_cydoubleclk: INTEGER is 37
  1762. Sm_cyframe: INTEGER is 33
  1763. Sm_cyfullscreen: INTEGER is 17
  1764. Sm_cyhscroll: INTEGER is 3
  1765. Sm_cyicon: INTEGER is 12
  1766. Sm_cyiconspacing: INTEGER is 39
  1767. Sm_cykanjiwindow: INTEGER is 18
  1768. Sm_cymaximized: INTEGER is 62
  1769. Sm_cymenu: INTEGER is 15
  1770. Sm_cymin: INTEGER is 29
  1771. Sm_cymintrack: INTEGER is 35
  1772. Sm_cyscreen: INTEGER is 1
  1773. Sm_cysize: INTEGER is 31
  1774. Sm_cyvscroll: INTEGER is 20
  1775. Sm_cyvthumb: INTEGER is 9
  1776. Sm_dbcsenabled: INTEGER is 42
  1777. Sm_debug: INTEGER is 22
  1778. Sm_menudropalignment: INTEGER is 40
  1779. Sm_mousepresent: INTEGER is 19
  1780. Sm_penwindows: INTEGER is 41
  1781. Sm_reserved1: INTEGER is 24
  1782. Sm_reserved2: INTEGER is 25
  1783. Sm_reserved3: INTEGER is 26
  1784. Sm_reserved4: INTEGER is 27
  1785. Sm_swapbutton: INTEGER is 23
  1786. indexing
  1787. description: "Window style (WS) constants."
  1788. status: "See notice at end of class."
  1789. date: "$Date: 2001/11/12 17:58:06 $"
  1790. revision: "$Revision: 1.3 $"
  1791. class interface
  1792. WEL_WS_CONSTANTS
  1793. feature -- Miscellaneous
  1794. Cw_usedefault: INTEGER is -2147483648
  1795. -- Declared in Windows as CW_USEDEFAULT
  1796. feature -- Basic window types
  1797. Ws_child: INTEGER is 1073741824
  1798. -- Declared in Windows as WS_CHILD
  1799. Ws_overlapped: INTEGER is 0
  1800. -- Declared in Windows as WS_OVERLAPPED
  1801. -- Was declared in WEL_WS_CONSTANTS as synonym of ws_tiled.
  1802. Ws_popup: INTEGER is -2147483648
  1803. -- Declared in Windows as WS_POPUP
  1804. Ws_tiled: INTEGER is 0
  1805. -- Declared in Windows as WS_OVERLAPPED
  1806. -- Was declared in WEL_WS_CONSTANTS as synonym of ws_overlapped.
  1807. feature -- Clipping styles
  1808. Ws_clipchildren: INTEGER is 33554432
  1809. -- Declared in Windows as WS_CLIPCHILDREN
  1810. Ws_clipsiblings: INTEGER is 67108864
  1811. -- Declared in Windows as WS_CLIPSIBLINGS
  1812. feature -- Common window styles
  1813. Ws_childwindow: INTEGER is 1073741824
  1814. -- Declared in Windows as WS_CHILDWINDOW
  1815. Ws_overlappedwindow: INTEGER is 13565952
  1816. -- Declared in Windows as WS_OVERLAPPEDWINDOW
  1817. -- Was declared in WEL_WS_CONSTANTS as synonym of ws_tiledwindow.
  1818. Ws_popupwindow: INTEGER is -2138570752
  1819. -- Declared in Windows as WS_POPUPWINDOW
  1820. Ws_tiledwindow: INTEGER is 13565952
  1821. -- Declared in Windows as WS_OVERLAPPEDWINDOW
  1822. -- Was declared in WEL_WS_CONSTANTS as synonym of ws_overlappedwindow.
  1823. feature -- Control window styles
  1824. Ws_group: INTEGER is 131072
  1825. -- Declared in Windows as WS_GROUP
  1826. Ws_tabstop: INTEGER is 65536
  1827. -- Declared in Windows as WS_TABSTOP
  1828. feature -- Extended window styles
  1829. Ws_ex_acceptfiles: INTEGER is 16
  1830. -- Declared in Windows as WS_EX_ACCEPTFILES
  1831. Ws_ex_clientedge: INTEGER is 512
  1832. -- Declared in Windows as WS_EX_CLIENTEDGE
  1833. Ws_ex_contexthelp: INTEGER is 1024
  1834. -- Declared in Windows as WS_EX_CONTEXTHELP
  1835. Ws_ex_controlparent: INTEGER is 65536
  1836. -- Declared in Windows as WS_EX_CONTROLPARENT
  1837. Ws_ex_dlgmodalframe: INTEGER is 1
  1838. -- Declared in Windows as WS_EX_DLGMODALFRAME
  1839. Ws_ex_left: INTEGER is 0
  1840. -- Declared in Windows as WS_EX_LEFT
  1841. Ws_ex_leftscrollbar: INTEGER is 16384
  1842. -- Declared in Windows as WS_EX_LEFTSCROLLBAR
  1843. Ws_ex_ltrreading: INTEGER is 0
  1844. -- Declared in Windows as WS_EX_LTRREADING
  1845. Ws_ex_mdichild: INTEGER is 64
  1846. -- Declared in Windows as WS_EX_MDICHILD
  1847. Ws_ex_noparentnotify: INTEGER is 4
  1848. -- Declared in Windows as WS_EX_NOPARENTNOTIFY
  1849. Ws_ex_overlappedwindow: INTEGER is 768
  1850. -- Declared in Windows as WS_EX_OVERLAPPEDWINDOW
  1851. Ws_ex_palettewindow: INTEGER is 392
  1852. -- Declared in Windows as WS_EX_PALETTEWINDOW
  1853. Ws_ex_right: INTEGER is 4096
  1854. -- Declared in Windows as WS_EX_RIGHT
  1855. Ws_ex_rightscrollbar: INTEGER is 0
  1856. -- Declared in Windows as WS_EX_RIGHTSCROLLBAR
  1857. Ws_ex_rtlreading: INTEGER is 8192
  1858. -- Declared in Windows as WS_EX_RTLREADING
  1859. Ws_ex_staticedge: INTEGER is 131072
  1860. -- Declared in Windows as WS_EX_STATICEDGE
  1861. Ws_ex_toolwindow: INTEGER is 128
  1862. -- Declared in Windows as WS_EX_TOOLWINDOW
  1863. Ws_ex_topmost: INTEGER is 8
  1864. -- Declared in Windows as WS_EX_TOPMOST
  1865. Ws_ex_transparent: INTEGER is 32
  1866. -- Declared in Windows as WS_EX_TRANSPARENT
  1867. Ws_ex_windowedge: INTEGER is 256
  1868. -- Declared in Windows as WS_EX_WINDOWEDGE
  1869. feature -- Generic window states
  1870. Ws_disabled: INTEGER is 134217728
  1871. -- Declared in Windows as WS_DISABLED
  1872. Ws_visible: INTEGER is 268435456
  1873. -- Declared in Windows as WS_VISIBLE
  1874. feature -- Main window states
  1875. Ws_iconic: INTEGER is 536870912
  1876. -- Declared in Windows as WS_MINIMIZE
  1877. -- Was declared in WEL_WS_CONSTANTS as synonym of ws_minimize.
  1878. Ws_maximize: INTEGER is 16777216
  1879. -- Declared in Windows as WS_MAXIMIZE
  1880. Ws_minimize: INTEGER is 536870912
  1881. -- Declared in Windows as WS_MINIMIZE
  1882. -- Was declared in WEL_WS_CONSTANTS as synonym of ws_iconic.
  1883. feature -- Main window styles
  1884. Ws_border: INTEGER is 8388608
  1885. -- Declared in Windows as WS_BORDER
  1886. Ws_caption: INTEGER is 12582912
  1887. -- Declared in Windows as WS_CAPTION
  1888. Ws_dlgframe: INTEGER is 4194304
  1889. -- Declared in Windows as WS_DLGFRAME
  1890. Ws_hscroll: INTEGER is 1048576
  1891. -- Declared in Windows as WS_HSCROLL
  1892. Ws_maximizebox: INTEGER is 65536
  1893. -- Declared in Windows as WS_MAXIMIZEBOX
  1894. Ws_minimizebox: INTEGER is 131072
  1895. -- Declared in Windows as WS_MINIMIZEBOX
  1896. Ws_sizebox: INTEGER is 262144
  1897. -- Declared in Windows as WS_THICKFRAME
  1898. -- Was declared in WEL_WS_CONSTANTS as synonym of ws_thickframe.
  1899. Ws_sysmenu: INTEGER is 524288
  1900. -- Declared in Windows as WS_SYSMENU
  1901. Ws_thickframe: INTEGER is 262144
  1902. -- Declared in Windows as WS_THICKFRAME
  1903. -- Was declared in WEL_WS_CONSTANTS as synonym of ws_sizebox.
  1904. Ws_vscroll: INTEGER is 2097152
  1905. -- Declared in Windows as WS_VSCROLL
  1906. invariant
  1907. -- from ANY
  1908. reflexive_equality: standard_is_equal (Current)
  1909. reflexive_conformance: conforms_to (Current)
  1910. end -- class WEL_WS_CONSTANTS
  1911. indexing
  1912. description: "Size (SIZEOF) constants."
  1913. status: "See notice at end of class."
  1914. date: "$Date: 2001/11/12 17:58:04 $"
  1915. revision: "$Revision: 1.3 $"
  1916. class interface
  1917. WEL_SIZEOF_CONSTANTS
  1918. feature -- Access
  1919. Size_maxhide: INTEGER is 4
  1920. -- Declared in Windows as SIZEOF_MAXHIDE
  1921. Size_maximized: INTEGER is 2
  1922. -- Declared in Windows as SIZEOF_MAXIMIZED
  1923. Size_maxshow: INTEGER is 3
  1924. -- Declared in Windows as SIZEOF_MAXSHOW
  1925. Size_minimized: INTEGER is 1
  1926. -- Declared in Windows as SIZEOF_MINIMIZED
  1927. Size_restored: INTEGER is 0
  1928. -- Declared in Windows as SIZEOF_RESTORED
  1929. invariant
  1930. -- from ANY
  1931. reflexive_equality: standard_is_equal (Current)
  1932. reflexive_conformance: conforms_to (Current)
  1933. end -- class WEL_SIZEOF_CONSTANTS
  1934. SetPriorityClass
  1935. The SetPriorityClass function sets the priority class for the specified process. This value together with the priority value of each thread of the process determines each thread's base priority level.
  1936. BOOLSetPriorityClass(HANDLEhProcess, DWORDdwPriorityClass);
  1937. Parameters
  1938. hProcess
  1939. [in] Handle to the process. The handle must have the PROCESS_SET_INFORMATION access right. For more information, see Process Security and Access Rights.
  1940. dwPriorityClass
  1941. [in] Priority class for the process. This parameter can be one of the following values. Priority
  1942. Meaning
  1943. ABOVE_NORMAL_PRIORITY_CLASS
  1944. Process that has priority above NORMAL_PRIORITY_CLASS but below HIGH_PRIORITY_CLASS.
  1945. Windows NT and Windows Me/98/95: This value is not supported.
  1946. BELOW_NORMAL_PRIORITY_CLASS
  1947. Process that has priority above IDLE_PRIORITY_CLASS but below NORMAL_PRIORITY_CLASS.
  1948. Windows NT and Windows Me/98/95: This value is not supported.
  1949. HIGH_PRIORITY_CLASS
  1950. Process that performs time-critical tasks that must be executed immediately. The threads of the process preempt the threads of normal or idle priority class processes. An example is the Task List, which must respond quickly when called by the user, regardless of the load on the operating system. Use extreme care when using the high-priority class, because a high-priority class application can use nearly all available CPU time.
  1951. IDLE_PRIORITY_CLASS
  1952. Process whose threads run only when the system is idle. The threads of the process are preempted by the threads of any process running in a higher priority class. An example is a screen saver. The idle-priority class is inherited by child processes.
  1953. NORMAL_PRIORITY_CLASS
  1954. Process with no special scheduling needs.
  1955. REALTIME_PRIORITY_CLASS
  1956. Process that has the highest possible priority. The threads of the process preempt the threads of all other processes, including operating system processes performing important tasks. For example, a real-time process that executes for more than a very brief interval can cause disk caches not to flush or cause the mouse to be unresponsive.
  1957. Return Values
  1958. If the function succeeds, the return value is nonzero.
  1959. If the function fails, the return value is zero. To get extended error information, call GetLastError.
  1960. Remarks
  1961. Every thread has a base priority level determined by the thread's priority value and the priority class of its process. The system uses the base priority level of all executable threads to determine which thread gets the next slice of CPU time. The SetThreadPriority function enables setting the base priority level of a thread relative to the priority class of its process. For more information, see Scheduling Priorities.
  1962. Requirements
  1963. Client: Included in Windows XP, Windows 2000 Professional, Windows NT Workstation, Windows Me, Windows 98, and Windows 95.
  1964. Server: Included in Windows Server 2003, Windows 2000 Server, and Windows NT Server.
  1965. Header: Declared in Winbase.h; include Windows.h.
  1966. Library: Use Kernel32.lib.
  1967. See Also
  1968. CreateProcess, CreateThread, GetPriorityClass, GetThreadPriority, Process and Thread Functions, Processes and Threads Overview, SetThreadPriority
  1969. Normal_Priority_Class : constant := 16#00000020#;
  1970. Idle_Priority_Class : constant := 16#00000040#;
  1971. High_Priority_Class : constant := 16#00000080#;
  1972. Realtime_Priority_Class : constant := 16#00000100#; hex numbers !
  1973. ' Flags returned by LocalFlags (in addition to LMEM_DISCARDABLE)
  1974. Const LMEM_DISCARDED = &H4000
  1975. Const LMEM_LOCKCOUNT = &HFF
  1976. ' dwCreationFlag values
  1977. Const DEBUG_PROCESS = &H1
  1978. Const DEBUG_ONLY_THIS_PROCESS = &H2
  1979. Const CREATE_SUSPENDED = &H4
  1980. Const DETACHED_PROCESS = &H8
  1981. Const CREATE_NEW_CONSOLE = &H10
  1982. Const NORMAL_PRIORITY_CLASS = &H20
  1983. Const IDLE_PRIORITY_CLASS = &H40
  1984. Const HIGH_PRIORITY_CLASS = &H80
  1985. Const REALTIME_PRIORITY_CLASS = &H100
  1986. *)