PMJP.LST 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778
  1. Listing:
  2. 1 (*-------------------------------------------------------------------------*
  3. 2 * *
  4. 3 * PMJP.MOD - Presentation manager demo *
  5. 4 * *
  6. 5 * COPYRIGHT (C) 1989..1992 Clarion Software Corporation. *
  7. 6 * All Rights Reserved *
  8. 7 * *
  9. 8 *--------------------------------------------------------------------------*)
  10. 9
  11. 10 MODULE PMJP;
  12. 11
  13. 12 (* Simple demonstation of a PM Application using Win and Gpi calls *)
  14. 13
  15. 14 (* This application can be used as the basis of a shell for your own
  16. 15 application
  17. 16 *)
  18. 17 (*# call(same_ds => off) *)
  19. 18 (*# data(heap_size=> 3000) *)
  20. 19
  21. 20
  22. 21 IMPORT OS2DEF,Win,Gpi,Dos,Lib,SYSTEM;
  23. 22 FROM OS2DEF IMPORT HDC,HRGN,HAB,HPS,HBITMAP,HWND,HMODULE,HSEM,
  24. ***** ^ duplicate identifier
  25. 23 POINTL,RECTL,PID,TID,LSET,NULL,
  26. 24 COLOR,NullVar,NullStr,BOOL ;
  27. 25
  28. 26 CONST
  29. 27 WindowId = 255;
  30. 28
  31. 29 VAR
  32. 30 Hab : HAB;
  33. 31 Hps : HPS;
  34. 32 BackColor : COLOR;
  35. 33 ForeColor : COLOR;
  36. 34 ChangeBack: BOOLEAN;
  37. 35
  38. 36
  39. 37
  40. 38
  41. 39 (*-------------------- Error reporting procedure ---------------------*)
  42. 40 PROCEDURE Error;
  43. 41 VAR
  44. 42 errinf : Win.PERRINFO;
  45. ***** ^ not supported yet
  46. 43 (*# save,
  47. 44 data(near_ptr=>off) *)
  48. 45 emsg : POINTER TO ARRAY[0..255] OF CHAR;
  49. ***** ^ not supported yet
  50. ***** ^ not supported yet
  51. 46 (*# restore *)
  52. 47 mbid : Win.MBID;
  53. ***** ^ not supported yet
  54. 48 win : HWND;
  55. 49 BEGIN
  56. 50 errinf := Win.GetErrorInfo(Hab);
  57. ***** ^ not supported yet
  58. ***** ^ not supported yet
  59. ***** ^ not supported yet
  60. ***** ^ not supported yet
  61. 51 IF errinf=FarNIL THEN RETURN END;
  62. ***** ^ not supported yet
  63. ***** ^ undeclared identifier
  64. 52 emsg := [SYSTEM.Seg(errinf^):CARDINAL([SYSTEM.Seg(errinf^):errinf^.Msg]^)];
  65. ***** ^ not supported yet
  66. ***** ^ not supported yet
  67. ***** ^ not supported yet
  68. ***** ^ not supported yet
  69. ***** ^ not supported yet
  70. ***** ^ not supported yet
  71. ***** ^ not supported yet
  72. ***** ^ not supported yet
  73. ***** ^ not supported yet
  74. ***** ^ not supported yet
  75. 53 win := Win.QueryActiveWindow(Win.HWND_DESKTOP,B_FALSE);
  76. ***** ^ not supported yet
  77. ***** ^ not supported yet
  78. ***** ^ not supported yet
  79. ***** ^ not supported yet
  80. ***** ^ not supported yet
  81. ***** ^ undeclared identifier
  82. 54 mbid := Win.MessageBox(Win.HWND_DESKTOP,win,emsg^,'Error Returned',0,
  83. ***** ^ not supported yet
  84. ***** ^ not supported yet
  85. ***** ^ not supported yet
  86. ***** ^ not supported yet
  87. ***** ^ not supported yet
  88. ***** ^ not supported yet
  89. ***** ^ not supported yet
  90. ***** ^ not supported yet
  91. 55 Win.MB_ICONHAND+Win.MB_CANCEL+Win.MB_MOVEABLE);
  92. ***** ^ not supported yet
  93. ***** ^ not supported yet
  94. ***** ^ not supported yet
  95. ***** ^ not supported yet
  96. ***** ^ not supported yet
  97. ***** ^ not supported yet
  98. 56 IF Win.FreeErrorInfo(errinf^) THEN END;
  99. ***** ^ not supported yet
  100. ***** ^ not supported yet
  101. ***** ^ not supported yet
  102. 57 END Error;
  103. ***** ^ not supported yet
  104. 58
  105. 59 (*-------------------- JP drawing ---------------------------------------*)
  106. 60
  107. 61 PROCEDURE DrawTitle;
  108. 62 (* Creates font and displays message *)
  109. 63 CONST
  110. 64 Title1 = 'TopSpeed Modula-2 Demonstration Program';
  111. ***** ^ not supported yet
  112. 65 Title2 = 'Mouse button 1 cycles Foreground';
  113. ***** ^ not supported yet
  114. 66 Title3 = 'Mouse button 2 cycles Background';
  115. ***** ^ not supported yet
  116. 67 Title4 = 'F3 exits program';
  117. ***** ^ not supported yet
  118. 68 VAR
  119. 69 pt : POINTL;
  120. 70 b : Gpi.SIZEF;
  121. ***** ^ not supported yet
  122. 71 BEGIN
  123. 72 pt.x := 1; pt.y := 1;
  124. ***** ^ not supported yet
  125. ***** ^ not supported yet
  126. ***** ^ not supported yet
  127. ***** ^ not supported yet
  128. 73 IF NOT Gpi.SetCharShear(Hps,pt) THEN Error END;
  129. ***** ^ not supported yet
  130. ***** ^ not supported yet
  131. ***** ^ not supported yet
  132. ***** ^ not supported yet
  133. ***** ^ not supported yet
  134. 74 pt.x := 20; pt.y := 220;
  135. ***** ^ not supported yet
  136. ***** ^ not supported yet
  137. ***** ^ not supported yet
  138. ***** ^ not supported yet
  139. 75 IF Gpi.CharStringAt(Hps,pt,SIZE(Title1),Title1)<0 THEN Error END;
  140. ***** ^ not supported yet
  141. ***** ^ not supported yet
  142. ***** ^ not supported yet
  143. ***** ^ not supported yet
  144. ***** ^ undeclared identifier
  145. ***** ^ not supported yet
  146. ***** ^ not supported yet
  147. ***** ^ not supported yet
  148. 76 pt.x := 20; pt.y := 200;
  149. ***** ^ not supported yet
  150. ***** ^ not supported yet
  151. ***** ^ not supported yet
  152. ***** ^ not supported yet
  153. 77 IF Gpi.CharStringAt(Hps,pt,SIZE(Title2),Title2)<0 THEN Error END;
  154. ***** ^ not supported yet
  155. ***** ^ not supported yet
  156. ***** ^ not supported yet
  157. ***** ^ not supported yet
  158. ***** ^ undeclared identifier
  159. ***** ^ not supported yet
  160. ***** ^ not supported yet
  161. ***** ^ not supported yet
  162. 78 pt.x := 20; pt.y := 190;
  163. ***** ^ not supported yet
  164. ***** ^ not supported yet
  165. ***** ^ not supported yet
  166. ***** ^ not supported yet
  167. 79 IF Gpi.CharStringAt(Hps,pt,SIZE(Title3),Title3)<0 THEN Error END;
  168. ***** ^ not supported yet
  169. ***** ^ not supported yet
  170. ***** ^ not supported yet
  171. ***** ^ not supported yet
  172. ***** ^ undeclared identifier
  173. ***** ^ not supported yet
  174. ***** ^ not supported yet
  175. ***** ^ not supported yet
  176. 80 pt.x := 20; pt.y := 180;
  177. ***** ^ not supported yet
  178. ***** ^ not supported yet
  179. ***** ^ not supported yet
  180. ***** ^ not supported yet
  181. 81 IF Gpi.CharStringAt(Hps,pt,SIZE(Title4),Title4)<0 THEN Error END;
  182. ***** ^ not supported yet
  183. ***** ^ not supported yet
  184. ***** ^ not supported yet
  185. ***** ^ not supported yet
  186. ***** ^ undeclared identifier
  187. ***** ^ not supported yet
  188. ***** ^ not supported yet
  189. ***** ^ not supported yet
  190. 82 END DrawTitle;
  191. ***** ^ not supported yet
  192. 83
  193. 84 PROCEDURE DrawJp;
  194. 85 TYPE
  195. 86 Shade = (normal,light,dark);
  196. 87 A10 = ARRAY[0..9] OF CARDINAL;
  197. ***** ^ not supported yet
  198. ***** ^ not supported yet
  199. 88 A6 = ARRAY[0..5] OF CARDINAL;
  200. ***** ^ not supported yet
  201. ***** ^ not supported yet
  202. 89 A4 = ARRAY[0..3] OF CARDINAL;
  203. ***** ^ not supported yet
  204. ***** ^ not supported yet
  205. 90 A3 = ARRAY[0..2] OF CARDINAL;
  206. ***** ^ not supported yet
  207. ***** ^ not supported yet
  208. 91 CONST
  209. 92 Lx = A6(0,30,60,52,30,10);
  210. ***** ^ not supported yet
  211. 93 Ly = A6(50,40,53,57,48,55);
  212. ***** ^ not supported yet
  213. 94 Jx = A10(0, 30,30,0,0, 10,10,20,20,0);
  214. ***** ^ not supported yet
  215. 95 Jy = A10(50,40,0,10,25,21,15,12,33,40);
  216. ***** ^ not supported yet
  217. 96 Px = A6(60,30,30,40,40,60);
  218. ***** ^ not supported yet
  219. 97 Py = A6(53,40,0,5,15,25);
  220. ***** ^ not supported yet
  221. 98 P1x = A4(10,10,20,20);
  222. ***** ^ not supported yet
  223. 99 P1y = A4(15,21,26,20);
  224. ***** ^ not supported yet
  225. 100 P2x = A3(40,50,40);
  226. ***** ^ not supported yet
  227. 101 P2y = A3(25,30,35);
  228. ***** ^ not supported yet
  229. 102 P3x = A4(0, 10,20,10);
  230. ***** ^ not supported yet
  231. 103 P3y = A4(25,21,26,30);
  232. ***** ^ not supported yet
  233. 104 P4x = A3(10,20,20);
  234. ***** ^ not supported yet
  235. 105 P4y = A3(15,20,12);
  236. ***** ^ not supported yet
  237. 106 P5x = A3(50,50,40);
  238. ***** ^ not supported yet
  239. 107 P5y = A3(40,30,35);
  240. ***** ^ not supported yet
  241. 108
  242. 109 PROCEDURE Xlat(x,y:CARDINAL;VAR xo,yo:CARDINAL);
  243. 110 BEGIN
  244. 111 xo := x*3+80; yo := y*3;
  245. 112 END Xlat;
  246. ***** ^ not supported yet
  247. 113
  248. 114
  249. 115 PROCEDURE Polygon(xa,ya :ARRAY OF CARDINAL;
  250. ***** ^ not supported yet
  251. 116 c:Shade);
  252. 117 VAR
  253. 118 xt,yt: A10;
  254. ***** ^ not supported yet
  255. 119 i,n : CARDINAL;
  256. 120 pt : POINTL;
  257. 121 BEGIN
  258. 122 n := HIGH(xa)+1;
  259. ***** ^ undeclared identifier
  260. ***** ^ not supported yet
  261. 123 FOR i := 0 TO n-1 DO Xlat(xa[i],ya[i],xt[i],yt[i]); END;
  262. ***** ^ not supported yet
  263. ***** ^ not supported yet
  264. ***** ^ not supported yet
  265. ***** ^ not supported yet
  266. ***** ^ not supported yet
  267. ***** ^ not supported yet
  268. ***** ^ not supported yet
  269. ***** ^ not supported yet
  270. ***** ^ not supported yet
  271. 124 pt.x := LONGINT(xt[0]);
  272. ***** ^ not supported yet
  273. ***** ^ not supported yet
  274. ***** ^ not supported yet
  275. ***** ^ not supported yet
  276. 125 pt.y := LONGINT(yt[0]);
  277. ***** ^ not supported yet
  278. ***** ^ not supported yet
  279. ***** ^ not supported yet
  280. ***** ^ not supported yet
  281. 126 IF NOT Gpi.Move(Hps,pt) THEN Error END;
  282. ***** ^ not supported yet
  283. ***** ^ not supported yet
  284. ***** ^ not supported yet
  285. ***** ^ not supported yet
  286. ***** ^ not supported yet
  287. 127 CASE c OF
  288. ***** ^ not supported yet
  289. 128 | normal : IF NOT Gpi.SetPattern(Hps,Gpi.PATSYM_DENSE4) THEN Error END;
  290. ***** ^ not supported yet
  291. ***** ^ not supported yet
  292. ***** ^ not supported yet
  293. ***** ^ not supported yet
  294. ***** ^ not supported yet
  295. ***** ^ not supported yet
  296. ***** ^ not supported yet
  297. 129 | dark : IF NOT Gpi.SetPattern(Hps,Gpi.PATSYM_DENSE2) THEN Error END;
  298. ***** ^ not supported yet
  299. ***** ^ not supported yet
  300. ***** ^ not supported yet
  301. ***** ^ not supported yet
  302. ***** ^ not supported yet
  303. ***** ^ not supported yet
  304. ***** ^ not supported yet
  305. 130 | light : IF NOT Gpi.SetPattern(Hps,Gpi.PATSYM_DENSE6) THEN Error END;
  306. ***** ^ not supported yet
  307. ***** ^ not supported yet
  308. ***** ^ not supported yet
  309. ***** ^ not supported yet
  310. ***** ^ not supported yet
  311. ***** ^ not supported yet
  312. ***** ^ not supported yet
  313. 131 END;
  314. 132 IF NOT Gpi.SetBackMix(Hps,Gpi.BM_OVERPAINT) THEN Error END;
  315. ***** ^ not supported yet
  316. ***** ^ not supported yet
  317. ***** ^ not supported yet
  318. ***** ^ not supported yet
  319. ***** ^ not supported yet
  320. ***** ^ not supported yet
  321. 133 IF NOT Gpi.BeginArea(Hps,Gpi.BA_BOUNDARY) THEN Error END;
  322. ***** ^ not supported yet
  323. ***** ^ not supported yet
  324. ***** ^ not supported yet
  325. ***** ^ not supported yet
  326. ***** ^ not supported yet
  327. ***** ^ not supported yet
  328. 134 FOR i := 1 TO n-1 DO
  329. 135 pt.x := LONGINT(xt[i]);
  330. ***** ^ not supported yet
  331. ***** ^ not supported yet
  332. ***** ^ not supported yet
  333. ***** ^ not supported yet
  334. 136 pt.y := LONGINT(yt[i]);
  335. ***** ^ not supported yet
  336. ***** ^ not supported yet
  337. ***** ^ not supported yet
  338. ***** ^ not supported yet
  339. 137 IF Gpi.Line(Hps,pt)<0 THEN Error END;
  340. ***** ^ not supported yet
  341. ***** ^ not supported yet
  342. ***** ^ not supported yet
  343. ***** ^ not supported yet
  344. ***** ^ not supported yet
  345. 138 END ;
  346. 139 IF Gpi.EndArea(Hps)<0 THEN Error END;
  347. ***** ^ not supported yet
  348. ***** ^ not supported yet
  349. ***** ^ not supported yet
  350. ***** ^ not supported yet
  351. 140 END Polygon;
  352. ***** ^ not supported yet
  353. 141
  354. 142 BEGIN
  355. 143 Polygon(Lx,Ly,dark);
  356. ***** ^ not supported yet
  357. ***** ^ not supported yet
  358. 144 Polygon(Jx,Jy,light);
  359. ***** ^ not supported yet
  360. ***** ^ not supported yet
  361. 145 Polygon(Px,Py,normal);
  362. ***** ^ not supported yet
  363. ***** ^ not supported yet
  364. 146 Polygon(P1x,P1y,normal);
  365. ***** ^ not supported yet
  366. ***** ^ not supported yet
  367. 147 Polygon(P2x,P2y,dark);
  368. ***** ^ not supported yet
  369. ***** ^ not supported yet
  370. 148 Polygon(P3x,P3y,dark);
  371. ***** ^ not supported yet
  372. ***** ^ not supported yet
  373. 149 Polygon(P4x,P4y,dark);
  374. ***** ^ not supported yet
  375. ***** ^ not supported yet
  376. 150 Polygon(P5x,P5y,light);
  377. ***** ^ not supported yet
  378. ***** ^ not supported yet
  379. 151 END DrawJp;
  380. ***** ^ not supported yet
  381. 152
  382. 153
  383. 154
  384. 155 (*-------------------- Start of window procedure ---------------------*)
  385. 156 (*# save,
  386. 157 call(near_call=>off, reg_param=>(), reg_saved=>(di,si,ds,es,st1,st2)) *)
  387. 158 PROCEDURE WindowProc(hwnd : HWND;msg:CARDINAL;mp1,mp2:Win.MPARAM):Win.MRESULT;
  388. ***** ^ not supported yet
  389. ***** ^ not supported yet
  390. 159 VAR
  391. 160 rc : RECTL;
  392. 161 pt : POINTL;
  393. 162 r : CARDINAL;
  394. 163 hr : Gpi.HITSRET;
  395. ***** ^ not supported yet
  396. 164 cm : Win.CHARMSG;
  397. ***** ^ not supported yet
  398. 165 BEGIN
  399. 166 CASE msg OF
  400. 167 | Win.WM_PAINT:
  401. ***** ^ not supported yet
  402. ***** ^ not supported yet
  403. 168
  404. 169 (*----------------------------------------------------------------*)
  405. 170 (* Window contents are drawn here in WM_PAINT processing. *)
  406. 171 (*----------------------------------------------------------------*)
  407. 172
  408. 173 (* Obtain a cached micro PS *)
  409. 174 Hps := Win.BeginPaint( hwnd, HPS(NULL), rc );
  410. ***** ^ not supported yet
  411. ***** ^ not supported yet
  412. ***** ^ not supported yet
  413. ***** ^ not supported yet
  414. ***** ^ not supported yet
  415. ***** ^ not supported yet
  416. ***** ^ not supported yet
  417. 175
  418. 176 IF ChangeBack THEN
  419. 177 IF NOT Win.FillRect( Hps, rc, BackColor ) THEN (* Fill invalid rectangle *)
  420. ***** ^ not supported yet
  421. ***** ^ not supported yet
  422. ***** ^ not supported yet
  423. ***** ^ not supported yet
  424. ***** ^ not supported yet
  425. 178 Error;
  426. ***** ^ not supported yet
  427. 179 END ;
  428. 180 END ;
  429. 181 ChangeBack := TRUE ;
  430. 182
  431. 183 IF NOT Gpi.SetColor( Hps, Gpi.CLR_RED) THEN (* Set color of the text *)
  432. ***** ^ not supported yet
  433. ***** ^ not supported yet
  434. ***** ^ not supported yet
  435. ***** ^ not supported yet
  436. ***** ^ not supported yet
  437. 184 Error;
  438. ***** ^ not supported yet
  439. 185 END;
  440. 186 DrawTitle;
  441. ***** ^ not supported yet
  442. 187
  443. 188 IF NOT Gpi.SetColor( Hps, ForeColor) THEN (* Set color of the Block *)
  444. ***** ^ not supported yet
  445. ***** ^ not supported yet
  446. ***** ^ not supported yet
  447. ***** ^ not supported yet
  448. 189 Error;
  449. ***** ^ not supported yet
  450. 190 END;
  451. 191
  452. 192 DrawJp;
  453. ***** ^ not supported yet
  454. 193
  455. 194
  456. 195 IF NOT Win.EndPaint( Hps ) THEN (* Drawing is complete *)
  457. ***** ^ not supported yet
  458. ***** ^ not supported yet
  459. ***** ^ not supported yet
  460. 196 Error;
  461. ***** ^ not supported yet
  462. 197 END;
  463. 198
  464. 199 | Win.WM_BUTTON1DOWN:
  465. ***** ^ not supported yet
  466. ***** ^ not supported yet
  467. 200
  468. 201 (*---------------------------------------------------------------*)
  469. 202 (* Mouse button 1 has been clicked, so first ensure we have the *)
  470. 203 (* input focus and then cycle the foreground color and cause the *)
  471. 204 (* the window to be redrawn. *)
  472. 205 (*---------------------------------------------------------------*)
  473. 206
  474. 207 IF NOT Win.SetFocus( Win.HWND_DESKTOP, hwnd ) THEN
  475. ***** ^ not supported yet
  476. ***** ^ not supported yet
  477. ***** ^ not supported yet
  478. ***** ^ not supported yet
  479. ***** ^ not supported yet
  480. 208 Error;
  481. ***** ^ not supported yet
  482. 209 END;
  483. 210
  484. 211 REPEAT
  485. 212 IF ForeColor=15 THEN ForeColor := 1 ELSE INC(ForeColor) END;
  486. ***** ^ not supported yet
  487. ***** ^ not supported yet
  488. ***** ^ undeclared identifier
  489. ***** ^ not supported yet
  490. 213 UNTIL ForeColor<>BackColor;
  491. ***** ^ not supported yet
  492. ***** ^ not supported yet
  493. 214
  494. 215 ChangeBack := FALSE ;
  495. 216 IF NOT Win.InvalidateRect( hwnd, RECTL(NullVar), B_TRUE ) THEN
  496. ***** ^ not supported yet
  497. ***** ^ not supported yet
  498. ***** ^ not supported yet
  499. ***** ^ not supported yet
  500. ***** ^ not supported yet
  501. ***** ^ undeclared identifier
  502. 217 Error;
  503. ***** ^ not supported yet
  504. 218 END;
  505. 219
  506. 220 | Win.WM_BUTTON2DOWN:
  507. ***** ^ not supported yet
  508. ***** ^ not supported yet
  509. 221
  510. 222 (*---------------------------------------------------------------*)
  511. 223 (* Mouse button 2 has been clicked, so first ensure we have the *)
  512. 224 (* input focus and then cycle the background color and cause the *)
  513. 225 (* the window to be redrawn. *)
  514. 226 (*---------------------------------------------------------------*)
  515. 227
  516. 228 IF NOT Win.SetFocus( Win.HWND_DESKTOP, hwnd ) THEN
  517. ***** ^ not supported yet
  518. ***** ^ not supported yet
  519. ***** ^ not supported yet
  520. ***** ^ not supported yet
  521. ***** ^ not supported yet
  522. 229 Error;
  523. ***** ^ not supported yet
  524. 230 END;
  525. 231
  526. 232 REPEAT
  527. 233 IF BackColor=15 THEN BackColor := 1 ELSE INC(BackColor) END;
  528. ***** ^ not supported yet
  529. ***** ^ not supported yet
  530. ***** ^ undeclared identifier
  531. ***** ^ not supported yet
  532. 234 UNTIL ForeColor<>BackColor;
  533. ***** ^ not supported yet
  534. ***** ^ not supported yet
  535. 235 ChangeBack := TRUE;
  536. 236
  537. 237 IF NOT Win.InvalidateRect( hwnd, RECTL(NullVar), B_TRUE ) THEN
  538. ***** ^ not supported yet
  539. ***** ^ not supported yet
  540. ***** ^ not supported yet
  541. ***** ^ not supported yet
  542. ***** ^ not supported yet
  543. ***** ^ undeclared identifier
  544. 238 Error;
  545. ***** ^ not supported yet
  546. 239 END;
  547. 240
  548. 241 | Win.WM_CHAR:
  549. ***** ^ not supported yet
  550. ***** ^ not supported yet
  551. 242
  552. 243 (*----------------------------------------------------------------*)
  553. 244 (* Character input is processed here. *)
  554. 245 (* The first two bytes of message parameter 2 contain *)
  555. 246 (* the character code. *)
  556. 247 (*----------------------------------------------------------------*)
  557. 248
  558. 249 cm := Win.CHARMSG(mp2);
  559. ***** ^ not supported yet
  560. ***** ^ not supported yet
  561. ***** ^ not supported yet
  562. ***** ^ not supported yet
  563. 250 IF cm.vkey = Win.VK_F3 THEN (* If the key pressed is F3,*)
  564. ***** ^ not supported yet
  565. ***** ^ not supported yet
  566. ***** ^ not supported yet
  567. ***** ^ not supported yet
  568. 251 IF NOT Win.PostMsg( hwnd, Win.WM_QUIT, 0, 0 ) THEN
  569. ***** ^ not supported yet
  570. ***** ^ not supported yet
  571. ***** ^ not supported yet
  572. ***** ^ not supported yet
  573. ***** ^ not supported yet
  574. ***** ^ not supported yet
  575. 252 Error;
  576. ***** ^ not supported yet
  577. 253 END; (* post a quit message to *)
  578. 254 END; (* end the application. *)
  579. 255
  580. 256 | Win.WM_CLOSE:
  581. ***** ^ not supported yet
  582. ***** ^ not supported yet
  583. 257
  584. 258 (*----------------------------------------------------------------*)
  585. 259 (* This is the place to put your termination routines *)
  586. 260 (*----------------------------------------------------------------*)
  587. 261
  588. 262 IF NOT Win.PostMsg( hwnd, Win.WM_QUIT, 0, 0 ) THEN (* Cause termination *)
  589. ***** ^ not supported yet
  590. ***** ^ not supported yet
  591. ***** ^ not supported yet
  592. ***** ^ not supported yet
  593. ***** ^ not supported yet
  594. ***** ^ not supported yet
  595. 263 Error;
  596. ***** ^ not supported yet
  597. 264 END;
  598. 265
  599. 266 ELSE
  600. 267
  601. 268 (*----------------------------------------------------------------*)
  602. 269 (* Everything else comes here. This call MUST exist *)
  603. 270 (* in your window procedure. *)
  604. 271 (*----------------------------------------------------------------*)
  605. 272
  606. 273 RETURN Win.DefWindowProc( hwnd, msg, mp1, mp2 );
  607. ***** ^ not supported yet
  608. ***** ^ not supported yet
  609. ***** ^ not supported yet
  610. ***** ^ not supported yet
  611. ***** ^ not supported yet
  612. 274 END;
  613. 275 RETURN Win.MPARAM(FALSE);
  614. ***** ^ not supported yet
  615. ***** ^ not supported yet
  616. ***** ^ not supported yet
  617. 276
  618. 277 END WindowProc;
  619. ***** ^ not supported yet
  620. 278 (*# restore *)
  621. 279 (*--------------------- End of window procedure ----------------------*)
  622. 280
  623. 281 PROCEDURE Main;
  624. 282 VAR
  625. 283 hmq : Win.HMQ;
  626. ***** ^ not supported yet
  627. 284 qmsg : Win.QMSG;
  628. ***** ^ not supported yet
  629. 285 client : HWND;
  630. 286 frame : HWND;
  631. 287 createfl : LSET;
  632. 288 b : BOOLEAN;
  633. 289 r : Win.MRESULT;
  634. ***** ^ not supported yet
  635. 290
  636. 291 BEGIN
  637. 292 ForeColor := Gpi.CLR_BLUE;
  638. ***** ^ not supported yet
  639. ***** ^ not supported yet
  640. ***** ^ not supported yet
  641. 293 BackColor := Gpi.CLR_CYAN;
  642. ***** ^ not supported yet
  643. ***** ^ not supported yet
  644. ***** ^ not supported yet
  645. 294 ChangeBack := TRUE ;
  646. 295 Hab := Win.Initialize( NULL ); (* Initialize PM *)
  647. ***** ^ not supported yet
  648. ***** ^ not supported yet
  649. ***** ^ not supported yet
  650. ***** ^ not supported yet
  651. 296 hmq := Win.CreateMsgQueue( Hab, 0 ); (* Create a message queue *)
  652. ***** ^ not supported yet
  653. ***** ^ not supported yet
  654. ***** ^ not supported yet
  655. ***** ^ not supported yet
  656. ***** ^ not supported yet
  657. 297
  658. 298 IF NOT Win.RegisterClass( (* Register window class *)
  659. ***** ^ not supported yet
  660. ***** ^ not supported yet
  661. 299 Hab, (* Anchor block handle *)
  662. ***** ^ not supported yet
  663. 300 FarADR("MyWindow"), (* Window class name *)
  664. ***** ^ undeclared identifier
  665. ***** ^ not supported yet
  666. 301 WindowProc, (* Address of window procedure *)
  667. ***** ^ not supported yet
  668. 302 0, (* No special Class Style *)
  669. 303 0 (* No extra window words *)
  670. 304 ) THEN Error END;
  671. ***** ^ not supported yet
  672. ***** ^ not supported yet
  673. 305
  674. 306 createfl := Win.FCF_TITLEBAR; (* Set Frame Control Flag *)
  675. ***** ^ not supported yet
  676. ***** ^ not supported yet
  677. ***** ^ not supported yet
  678. 307
  679. 308 frame := Win.CreateStdWindow(
  680. ***** ^ not supported yet
  681. ***** ^ not supported yet
  682. ***** ^ not supported yet
  683. 309 Win.HWND_DESKTOP, (* Desktop window is parent *)
  684. ***** ^ not supported yet
  685. ***** ^ not supported yet
  686. 310 Win.FS_TASKLIST, (* Class Style *)
  687. ***** ^ not supported yet
  688. ***** ^ not supported yet
  689. 311 createfl, (* Frame control flag *)
  690. ***** ^ not supported yet
  691. 312 FarADR("MyWindow"), (* Client window class name *)
  692. ***** ^ undeclared identifier
  693. ***** ^ not supported yet
  694. 313 ', TopSpeed Demo', (* Title *)
  695. ***** ^ not supported yet
  696. 314 0, (* No special class style *)
  697. 315 NULL, (* Resource is in .EXE file *)
  698. ***** ^ not supported yet
  699. 316 WindowId, (* Frame window identifier *)
  700. 317 client (* Client window handle *)
  701. ***** ^ not supported yet
  702. 318 );
  703. 319
  704. 320 IF NOT Win.SetWindowPos( frame, (* Set the size and position of *)
  705. ***** ^ not supported yet
  706. ***** ^ not supported yet
  707. ***** ^ not supported yet
  708. 321 Win.HWND_TOP, (* the window before showing. *)
  709. ***** ^ not supported yet
  710. ***** ^ not supported yet
  711. 322 100, 60, 350, 260,
  712. 323 Win.SWP_SIZE+Win.SWP_MOVE+Win.SWP_ACTIVATE+Win.SWP_SHOW
  713. ***** ^ not supported yet
  714. ***** ^ not supported yet
  715. ***** ^ not supported yet
  716. ***** ^ not supported yet
  717. ***** ^ not supported yet
  718. ***** ^ not supported yet
  719. ***** ^ not supported yet
  720. ***** ^ not supported yet
  721. 324 ) THEN Error END;
  722. ***** ^ not supported yet
  723. 325
  724. 326 (*----------------------------------------------------------------------*)
  725. 327 (* Get and dispatch messages from the application message queue *)
  726. 328 (* until WinGetMsg returns FALSE, indicating a WM_QUIT message. *)
  727. 329 (*----------------------------------------------------------------------*)
  728. 330 WHILE( Win.GetMsg( Hab, qmsg, HWND(NULL), 0, 0 ) ) DO
  729. ***** ^ not supported yet
  730. ***** ^ not supported yet
  731. ***** ^ not supported yet
  732. ***** ^ not supported yet
  733. ***** ^ not supported yet
  734. ***** ^ not supported yet
  735. ***** ^ not supported yet
  736. 331 r := Win.DispatchMsg( Hab, qmsg );
  737. ***** ^ not supported yet
  738. ***** ^ not supported yet
  739. ***** ^ not supported yet
  740. ***** ^ not supported yet
  741. ***** ^ not supported yet
  742. 332 END;
  743. 333
  744. 334 IF NOT Win.DestroyWindow( frame ) THEN (* Tidy up... *)
  745. ***** ^ not supported yet
  746. ***** ^ not supported yet
  747. ***** ^ not supported yet
  748. 335 Error;
  749. ***** ^ not supported yet
  750. 336 END;
  751. 337 IF NOT Win.DestroyMsgQueue( hmq ) THEN (* and *)
  752. ***** ^ not supported yet
  753. ***** ^ not supported yet
  754. ***** ^ not supported yet
  755. 338 Error;
  756. ***** ^ not supported yet
  757. 339 END;
  758. 340 IF NOT Win.Terminate( Hab ) THEN (* terminate the application *)
  759. ***** ^ not supported yet
  760. ***** ^ not supported yet
  761. ***** ^ not supported yet
  762. 341 Error;
  763. ***** ^ not supported yet
  764. 342 END;
  765. 343
  766. 344 END Main;
  767. ***** ^ not supported yet
  768. 345 (*---------------------- End of main procedure -----------------------*)
  769. 346
  770. 347 BEGIN
  771. 348 Main;
  772. ***** ^ not supported yet
  773. 349 END PMJP.
  774. 423 errors