Win32.Display.Mod 81 KB

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