Windows.Display.Mod 81 KB

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