MWMAIN.LST 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432
  1. Listing:
  2. 1 (*# check(stack=>off,
  3. 2 index=>off,
  4. 3 range=>off,
  5. 4 overflow=>off,
  6. 5 nil_ptr=>off) *)
  7. 6 IMPLEMENTATION MODULE MWMain;
  8. 7
  9. 8 IMPORT Windows;
  10. 9
  11. 10 CONST
  12. 11 (* String table constants *)
  13. 12 IDSNAME = 100;
  14. 13 IDSABOUT = 200;
  15. 14 IDSTITLE = 300;
  16. 15
  17. 16 (* About Dialog box resource id *)
  18. 17 ABOUTBOX = 1;
  19. 18
  20. 19 VAR
  21. 20 szAppName: ARRAY [0..9] OF CHAR;
  22. ***** ^ not supported yet
  23. ***** ^ not supported yet
  24. 21 szAbout: ARRAY [0..9] OF CHAR;
  25. ***** ^ not supported yet
  26. ***** ^ not supported yet
  27. 22 szMessage: ARRAY [0..25] OF CHAR;
  28. ***** ^ not supported yet
  29. ***** ^ not supported yet
  30. 23 MessageLength: CARDINAL;
  31. 24
  32. 25 hInst: Windows.HANDLE;
  33. ***** ^ not supported yet
  34. 26 lpprocAbout: Windows.FARPROC;
  35. ***** ^ not supported yet
  36. 27
  37. 28 PROCEDURE MessagePaint(hdc: Windows.HDC);
  38. ***** ^ not supported yet
  39. 29
  40. 30 BEGIN
  41. 31 Windows.TextOut(hdc, 10, 10, szMessage, MessageLength );
  42. ***** ^ not supported yet
  43. ***** ^ not supported yet
  44. ***** ^ not supported yet
  45. ***** ^ not supported yet
  46. ***** ^ not supported yet
  47. 32 END MessagePaint;
  48. ***** ^ not supported yet
  49. 33
  50. 34
  51. 35 (* Procedures which make up the window class. *)
  52. 36 PROCEDURE WndProc(hWnd: Windows.HWND; message: CARDINAL; wParam: CARDINAL; lParam: LONGINT ): LONGINT;
  53. ***** ^ not supported yet
  54. 37
  55. 38 VAR
  56. 39 ps: Windows.PAINTSTRUCT;
  57. ***** ^ not supported yet
  58. 40 BEGIN
  59. 41 CASE message OF
  60. 42 | Windows.WM_SYSCOMMAND:
  61. ***** ^ not supported yet
  62. ***** ^ not supported yet
  63. 43 CASE wParam OF
  64. 44 | IDSABOUT:
  65. ***** ^ not supported yet
  66. 45 Windows.DialogBox( hInst, FarADDRESS(LONGCARD(ABOUTBOX)), hWnd, lpprocAbout );
  67. ***** ^ not supported yet
  68. ***** ^ not supported yet
  69. ***** ^ not supported yet
  70. ***** ^ undeclared identifier
  71. ***** ^ undeclared identifier
  72. ***** ^ not supported yet
  73. ***** ^ not supported yet
  74. ***** ^ not supported yet
  75. 46 ELSE
  76. 47 RETURN Windows.DefWindowProc( hWnd, message, wParam, lParam);
  77. ***** ^ not supported yet
  78. ***** ^ not supported yet
  79. ***** ^ not supported yet
  80. ***** ^ not supported yet
  81. 48 END;
  82. 49 | Windows.WM_DESTROY:
  83. ***** ^ not supported yet
  84. ***** ^ not supported yet
  85. 50 Windows.PostQuitMessage(0);
  86. ***** ^ not supported yet
  87. ***** ^ not supported yet
  88. ***** ^ not supported yet
  89. 51 | Windows.WM_PAINT:
  90. ***** ^ not supported yet
  91. ***** ^ not supported yet
  92. 52 Windows.BeginPaint(hWnd, ps);
  93. ***** ^ not supported yet
  94. ***** ^ not supported yet
  95. ***** ^ not supported yet
  96. ***** ^ not supported yet
  97. 53 MessagePaint(ps.hdc);
  98. ***** ^ not supported yet
  99. ***** ^ not supported yet
  100. ***** ^ not supported yet
  101. 54 Windows.EndPaint(hWnd, ps);
  102. ***** ^ not supported yet
  103. ***** ^ not supported yet
  104. ***** ^ not supported yet
  105. ***** ^ not supported yet
  106. 55 ELSE
  107. 56 RETURN Windows.DefWindowProc( hWnd, message, wParam, lParam);
  108. ***** ^ not supported yet
  109. ***** ^ not supported yet
  110. ***** ^ not supported yet
  111. ***** ^ not supported yet
  112. 57 END;
  113. 58 RETURN 0;
  114. 59 END WndProc;
  115. ***** ^ not supported yet
  116. 60
  117. 61 PROCEDURE About ( hDlg : Windows.HWND;
  118. ***** ^ not supported yet
  119. 62 message : CARDINAL;
  120. 63 wParam : WORD;
  121. ***** ^ undeclared identifier
  122. 64 lParam : LONGINT ) : Windows.BOOL ;
  123. ***** ^ not supported yet
  124. 65
  125. 66 BEGIN
  126. 67 IF message = Windows.WM_COMMAND THEN
  127. ***** ^ not supported yet
  128. ***** ^ not supported yet
  129. 68 Windows.EndDialog( hDlg, CARDINAL(TRUE) );
  130. ***** ^ not supported yet
  131. ***** ^ not supported yet
  132. ***** ^ not supported yet
  133. ***** ^ not supported yet
  134. 69 RETURN INTEGER(TRUE);
  135. ***** ^ not supported yet
  136. 70 ELSIF message = Windows.WM_INITDIALOG THEN
  137. ***** ^ not supported yet
  138. ***** ^ not supported yet
  139. 71 RETURN INTEGER(TRUE);
  140. ***** ^ not supported yet
  141. 72 ELSE
  142. 73 RETURN INTEGER(FALSE);
  143. ***** ^ not supported yet
  144. 74 END;
  145. 75 END About;
  146. ***** ^ not supported yet
  147. 76
  148. 77
  149. 78 (* This procedure called when the program is loaded for the first time *)
  150. 79
  151. 80 PROCEDURE DemoInit(hInstance: Windows.HANDLE): BOOLEAN;
  152. ***** ^ not supported yet
  153. 81
  154. 82 VAR
  155. 83 DemoClass: Windows.WNDCLASS;
  156. ***** ^ not supported yet
  157. 84 BEGIN
  158. 85 (* Load strings from resource *)
  159. 86 Windows.LoadString(hInstance, IDSNAME, szAppName, 10);
  160. ***** ^ not supported yet
  161. ***** ^ not supported yet
  162. ***** ^ not supported yet
  163. ***** ^ not supported yet
  164. ***** ^ not supported yet
  165. 87 Windows.LoadString(hInstance, IDSABOUT, szAbout, 10);
  166. ***** ^ not supported yet
  167. ***** ^ not supported yet
  168. ***** ^ not supported yet
  169. ***** ^ not supported yet
  170. ***** ^ not supported yet
  171. 88 MessageLength:=Windows.LoadString(hInstance, IDSTITLE, szMessage, 25);
  172. ***** ^ not supported yet
  173. ***** ^ not supported yet
  174. ***** ^ not supported yet
  175. ***** ^ not supported yet
  176. ***** ^ not supported yet
  177. 89
  178. 90 DemoClass.hCursor := Windows.LoadCursor(Windows.HANDLE(0), FarADDRESS(Windows.IDC_ARROW));
  179. ***** ^ not supported yet
  180. ***** ^ not supported yet
  181. ***** ^ not supported yet
  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. 91 DemoClass.hIcon := Windows.LoadIcon(hInstance, FarADR("wdemo"));
  190. ***** ^ not supported yet
  191. ***** ^ not supported yet
  192. ***** ^ not supported yet
  193. ***** ^ not supported yet
  194. ***** ^ not supported yet
  195. ***** ^ undeclared identifier
  196. ***** ^ not supported yet
  197. 92 DemoClass.lpszMenuName := FarNIL;
  198. ***** ^ not supported yet
  199. ***** ^ not supported yet
  200. ***** ^ undeclared identifier
  201. 93 DemoClass.lpszClassName := Windows.LPSTR(FarADR(szAppName));
  202. ***** ^ not supported yet
  203. ***** ^ not supported yet
  204. ***** ^ not supported yet
  205. ***** ^ not supported yet
  206. ***** ^ undeclared identifier
  207. ***** ^ not supported yet
  208. 94 DemoClass.hbrBackground := Windows.HBRUSH(Windows.GetStockObject(Windows.WHITE_BRUSH));
  209. ***** ^ not supported yet
  210. ***** ^ not supported yet
  211. ***** ^ not supported yet
  212. ***** ^ not supported yet
  213. ***** ^ not supported yet
  214. ***** ^ not supported yet
  215. ***** ^ not supported yet
  216. ***** ^ not supported yet
  217. 95 DemoClass.hInstance:=hInstance;
  218. ***** ^ not supported yet
  219. ***** ^ not supported yet
  220. ***** ^ not supported yet
  221. 96 DemoClass.style := Windows.CS_HREDRAW + Windows.CS_VREDRAW;
  222. ***** ^ not supported yet
  223. ***** ^ not supported yet
  224. ***** ^ not supported yet
  225. ***** ^ not supported yet
  226. ***** ^ not supported yet
  227. ***** ^ not supported yet
  228. 97 DemoClass.lpfnWndProc := FarADR(WndProc);
  229. ***** ^ not supported yet
  230. ***** ^ not supported yet
  231. ***** ^ undeclared identifier
  232. ***** ^ not supported yet
  233. 98 DemoClass.cbClsExtra := 0;
  234. ***** ^ not supported yet
  235. ***** ^ not supported yet
  236. 99 DemoClass.cbWndExtra := 0;
  237. ***** ^ not supported yet
  238. ***** ^ not supported yet
  239. 100
  240. 101 IF Windows.RegisterClass(DemoClass) = 0 THEN
  241. ***** ^ not supported yet
  242. ***** ^ not supported yet
  243. ***** ^ not supported yet
  244. 102 RETURN FALSE; (* Initialization failed. *)
  245. 103 END;
  246. 104 RETURN TRUE; (* Success *)
  247. 105 END DemoInit;
  248. ***** ^ not supported yet
  249. 106
  250. 107
  251. 108 PROCEDURE WinMain(hInstance: Windows.HANDLE; hPrevInstance: Windows.HANDLE; lpszCmdLine: Windows.LPSTR; cmdShow: INTEGER): Windows.BOOL;
  252. ***** ^ not supported yet
  253. ***** ^ not supported yet
  254. ***** ^ not supported yet
  255. ***** ^ not supported yet
  256. 109
  257. 110 VAR
  258. 111 msg: Windows.MSG;
  259. ***** ^ not supported yet
  260. 112 hWnd: Windows.HWND;
  261. ***** ^ not supported yet
  262. 113 hMenu: Windows.HMENU;
  263. ***** ^ not supported yet
  264. 114 BEGIN
  265. 115 IF hPrevInstance = Windows.HANDLE(0) THEN
  266. ***** ^ not supported yet
  267. ***** ^ not supported yet
  268. ***** ^ not supported yet
  269. ***** ^ not supported yet
  270. 116 (* Call initialization procedure if this is the first instance *)
  271. 117 IF NOT DemoInit(hInstance) THEN
  272. ***** ^ not supported yet
  273. ***** ^ not supported yet
  274. 118 RETURN INTEGER(FALSE);
  275. ***** ^ not supported yet
  276. 119 END;
  277. 120 ELSE
  278. 121 (* Copy data from previous instance *)
  279. 122 Windows.GetInstanceData(hPrevInstance, NearADR(szAppName), 10);
  280. ***** ^ not supported yet
  281. ***** ^ not supported yet
  282. ***** ^ not supported yet
  283. ***** ^ undeclared identifier
  284. ***** ^ not supported yet
  285. ***** ^ not supported yet
  286. 123 Windows.GetInstanceData(hPrevInstance, NearADR(szAbout), 10);
  287. ***** ^ not supported yet
  288. ***** ^ not supported yet
  289. ***** ^ not supported yet
  290. ***** ^ undeclared identifier
  291. ***** ^ not supported yet
  292. ***** ^ not supported yet
  293. 124 Windows.GetInstanceData(hPrevInstance, NearADR(szMessage), 25);
  294. ***** ^ not supported yet
  295. ***** ^ not supported yet
  296. ***** ^ not supported yet
  297. ***** ^ undeclared identifier
  298. ***** ^ not supported yet
  299. ***** ^ not supported yet
  300. 125 Windows.GetInstanceData(hPrevInstance, NearADR(MessageLength),SIZE(CARDINAL));
  301. ***** ^ not supported yet
  302. ***** ^ not supported yet
  303. ***** ^ not supported yet
  304. ***** ^ undeclared identifier
  305. ***** ^ not supported yet
  306. ***** ^ undeclared identifier
  307. ***** ^ not supported yet
  308. 126 END;
  309. 127
  310. 128 hWnd := Windows.CreateWindow(FarADR(szAppName),
  311. ***** ^ not supported yet
  312. ***** ^ not supported yet
  313. ***** ^ not supported yet
  314. ***** ^ undeclared identifier
  315. ***** ^ not supported yet
  316. 129 szMessage,
  317. ***** ^ not supported yet
  318. 130 Windows.WS_TILEDWINDOW ,
  319. ***** ^ not supported yet
  320. ***** ^ not supported yet
  321. 131 Windows.CW_USEDEFAULT,
  322. ***** ^ not supported yet
  323. ***** ^ not supported yet
  324. 132 Windows.CW_USEDEFAULT,
  325. ***** ^ not supported yet
  326. ***** ^ not supported yet
  327. 133 Windows.CW_USEDEFAULT,
  328. ***** ^ not supported yet
  329. ***** ^ not supported yet
  330. 134 Windows.CW_USEDEFAULT,
  331. ***** ^ not supported yet
  332. ***** ^ not supported yet
  333. 135 Windows.HWND(0), (* no parent *)
  334. ***** ^ not supported yet
  335. ***** ^ not supported yet
  336. ***** ^ not supported yet
  337. 136 Windows.HMENU(0), (* use class menu *)
  338. ***** ^ not supported yet
  339. ***** ^ not supported yet
  340. ***** ^ not supported yet
  341. 137 hInstance, (* handle to window instance *)
  342. ***** ^ not supported yet
  343. 138 FarNIL (* no params to pass on *)
  344. ***** ^ undeclared identifier
  345. 139 );
  346. 140
  347. 141 (* Save instance handle for DialogBox *)
  348. 142 hInst := hInstance;
  349. ***** ^ not supported yet
  350. ***** ^ not supported yet
  351. 143 lpprocAbout := Windows.MakeProcInstance( Windows.FARPROC(FarADR(About)), hInstance );
  352. ***** ^ not supported yet
  353. ***** ^ not supported yet
  354. ***** ^ not supported yet
  355. ***** ^ not supported yet
  356. ***** ^ not supported yet
  357. ***** ^ undeclared identifier
  358. ***** ^ not supported yet
  359. ***** ^ not supported yet
  360. 144
  361. 145 (* Insert About *)
  362. 146 hMenu:= Windows.GetSystemMenu(hWnd, Windows.False);
  363. ***** ^ not supported yet
  364. ***** ^ not supported yet
  365. ***** ^ not supported yet
  366. ***** ^ not supported yet
  367. ***** ^ not supported yet
  368. ***** ^ not supported yet
  369. 147 Windows.ChangeMenu(hMenu, 0, FarNIL, 999, Windows.MF_APPEND + Windows.MF_SEPARATOR);
  370. ***** ^ not supported yet
  371. ***** ^ not supported yet
  372. ***** ^ not supported yet
  373. ***** ^ undeclared identifier
  374. ***** ^ not supported yet
  375. ***** ^ not supported yet
  376. ***** ^ not supported yet
  377. ***** ^ not supported yet
  378. 148 Windows.ChangeMenu(hMenu, 0, FarADR(szAbout), IDSABOUT, Windows.MF_APPEND + Windows.MF_STRING);
  379. ***** ^ not supported yet
  380. ***** ^ not supported yet
  381. ***** ^ not supported yet
  382. ***** ^ undeclared identifier
  383. ***** ^ not supported yet
  384. ***** ^ not supported yet
  385. ***** ^ not supported yet
  386. ***** ^ not supported yet
  387. ***** ^ not supported yet
  388. 149
  389. 150 (* Make window visible according to the way the app is activated *)
  390. 151 Windows.ShowWindow(hWnd, cmdShow);
  391. ***** ^ not supported yet
  392. ***** ^ not supported yet
  393. ***** ^ not supported yet
  394. ***** ^ not supported yet
  395. 152 Windows.UpdateWindow(hWnd);
  396. ***** ^ not supported yet
  397. ***** ^ not supported yet
  398. ***** ^ not supported yet
  399. 153
  400. 154 (* Polling messages from event queue *)
  401. 155 WHILE (Windows.GetMessage(msg, Windows.HWND(0), 0, 0)) # 0 DO
  402. ***** ^ not supported yet
  403. ***** ^ not supported yet
  404. ***** ^ not supported yet
  405. ***** ^ not supported yet
  406. ***** ^ not supported yet
  407. ***** ^ not supported yet
  408. ***** ^ not supported yet
  409. 156 Windows.TranslateMessage(msg);
  410. ***** ^ not supported yet
  411. ***** ^ not supported yet
  412. ***** ^ not supported yet
  413. 157 Windows.DispatchMessage(msg);
  414. ***** ^ not supported yet
  415. ***** ^ not supported yet
  416. ***** ^ not supported yet
  417. 158 END;
  418. 159 RETURN msg.wParam;
  419. ***** ^ not supported yet
  420. ***** ^ not supported yet
  421. 160 END WinMain;
  422. ***** ^ not supported yet
  423. 161
  424. 162
  425. 163
  426. 164 END MWMain.
  427. ***** ^ not supported yet
  428. 262 errors