Listing: 1 (*# check(stack=>off, 2 index=>off, 3 range=>off, 4 overflow=>off, 5 nil_ptr=>off) *) 6 IMPLEMENTATION MODULE MWMain; 7 8 IMPORT Windows; 9 10 CONST 11 (* String table constants *) 12 IDSNAME = 100; 13 IDSABOUT = 200; 14 IDSTITLE = 300; 15 16 (* About Dialog box resource id *) 17 ABOUTBOX = 1; 18 19 VAR 20 szAppName: ARRAY [0..9] OF CHAR; ***** ^ not supported yet ***** ^ not supported yet 21 szAbout: ARRAY [0..9] OF CHAR; ***** ^ not supported yet ***** ^ not supported yet 22 szMessage: ARRAY [0..25] OF CHAR; ***** ^ not supported yet ***** ^ not supported yet 23 MessageLength: CARDINAL; 24 25 hInst: Windows.HANDLE; ***** ^ not supported yet 26 lpprocAbout: Windows.FARPROC; ***** ^ not supported yet 27 28 PROCEDURE MessagePaint(hdc: Windows.HDC); ***** ^ not supported yet 29 30 BEGIN 31 Windows.TextOut(hdc, 10, 10, szMessage, MessageLength ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 32 END MessagePaint; ***** ^ not supported yet 33 34 35 (* Procedures which make up the window class. *) 36 PROCEDURE WndProc(hWnd: Windows.HWND; message: CARDINAL; wParam: CARDINAL; lParam: LONGINT ): LONGINT; ***** ^ not supported yet 37 38 VAR 39 ps: Windows.PAINTSTRUCT; ***** ^ not supported yet 40 BEGIN 41 CASE message OF 42 | Windows.WM_SYSCOMMAND: ***** ^ not supported yet ***** ^ not supported yet 43 CASE wParam OF 44 | IDSABOUT: ***** ^ not supported yet 45 Windows.DialogBox( hInst, FarADDRESS(LONGCARD(ABOUTBOX)), hWnd, lpprocAbout ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 46 ELSE 47 RETURN Windows.DefWindowProc( hWnd, message, wParam, lParam); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 48 END; 49 | Windows.WM_DESTROY: ***** ^ not supported yet ***** ^ not supported yet 50 Windows.PostQuitMessage(0); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 51 | Windows.WM_PAINT: ***** ^ not supported yet ***** ^ not supported yet 52 Windows.BeginPaint(hWnd, ps); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 53 MessagePaint(ps.hdc); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 54 Windows.EndPaint(hWnd, ps); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 55 ELSE 56 RETURN Windows.DefWindowProc( hWnd, message, wParam, lParam); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 57 END; 58 RETURN 0; 59 END WndProc; ***** ^ not supported yet 60 61 PROCEDURE About ( hDlg : Windows.HWND; ***** ^ not supported yet 62 message : CARDINAL; 63 wParam : WORD; ***** ^ undeclared identifier 64 lParam : LONGINT ) : Windows.BOOL ; ***** ^ not supported yet 65 66 BEGIN 67 IF message = Windows.WM_COMMAND THEN ***** ^ not supported yet ***** ^ not supported yet 68 Windows.EndDialog( hDlg, CARDINAL(TRUE) ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 69 RETURN INTEGER(TRUE); ***** ^ not supported yet 70 ELSIF message = Windows.WM_INITDIALOG THEN ***** ^ not supported yet ***** ^ not supported yet 71 RETURN INTEGER(TRUE); ***** ^ not supported yet 72 ELSE 73 RETURN INTEGER(FALSE); ***** ^ not supported yet 74 END; 75 END About; ***** ^ not supported yet 76 77 78 (* This procedure called when the program is loaded for the first time *) 79 80 PROCEDURE DemoInit(hInstance: Windows.HANDLE): BOOLEAN; ***** ^ not supported yet 81 82 VAR 83 DemoClass: Windows.WNDCLASS; ***** ^ not supported yet 84 BEGIN 85 (* Load strings from resource *) 86 Windows.LoadString(hInstance, IDSNAME, szAppName, 10); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 87 Windows.LoadString(hInstance, IDSABOUT, szAbout, 10); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 88 MessageLength:=Windows.LoadString(hInstance, IDSTITLE, szMessage, 25); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 89 90 DemoClass.hCursor := Windows.LoadCursor(Windows.HANDLE(0), FarADDRESS(Windows.IDC_ARROW)); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ not supported yet 91 DemoClass.hIcon := Windows.LoadIcon(hInstance, FarADR("wdemo")); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet 92 DemoClass.lpszMenuName := FarNIL; ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier 93 DemoClass.lpszClassName := Windows.LPSTR(FarADR(szAppName)); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet 94 DemoClass.hbrBackground := Windows.HBRUSH(Windows.GetStockObject(Windows.WHITE_BRUSH)); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 95 DemoClass.hInstance:=hInstance; ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 96 DemoClass.style := Windows.CS_HREDRAW + Windows.CS_VREDRAW; ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 97 DemoClass.lpfnWndProc := FarADR(WndProc); ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet 98 DemoClass.cbClsExtra := 0; ***** ^ not supported yet ***** ^ not supported yet 99 DemoClass.cbWndExtra := 0; ***** ^ not supported yet ***** ^ not supported yet 100 101 IF Windows.RegisterClass(DemoClass) = 0 THEN ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 102 RETURN FALSE; (* Initialization failed. *) 103 END; 104 RETURN TRUE; (* Success *) 105 END DemoInit; ***** ^ not supported yet 106 107 108 PROCEDURE WinMain(hInstance: Windows.HANDLE; hPrevInstance: Windows.HANDLE; lpszCmdLine: Windows.LPSTR; cmdShow: INTEGER): Windows.BOOL; ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 109 110 VAR 111 msg: Windows.MSG; ***** ^ not supported yet 112 hWnd: Windows.HWND; ***** ^ not supported yet 113 hMenu: Windows.HMENU; ***** ^ not supported yet 114 BEGIN 115 IF hPrevInstance = Windows.HANDLE(0) THEN ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 116 (* Call initialization procedure if this is the first instance *) 117 IF NOT DemoInit(hInstance) THEN ***** ^ not supported yet ***** ^ not supported yet 118 RETURN INTEGER(FALSE); ***** ^ not supported yet 119 END; 120 ELSE 121 (* Copy data from previous instance *) 122 Windows.GetInstanceData(hPrevInstance, NearADR(szAppName), 10); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ not supported yet 123 Windows.GetInstanceData(hPrevInstance, NearADR(szAbout), 10); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ not supported yet 124 Windows.GetInstanceData(hPrevInstance, NearADR(szMessage), 25); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ not supported yet 125 Windows.GetInstanceData(hPrevInstance, NearADR(MessageLength),SIZE(CARDINAL)); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet 126 END; 127 128 hWnd := Windows.CreateWindow(FarADR(szAppName), ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet 129 szMessage, ***** ^ not supported yet 130 Windows.WS_TILEDWINDOW , ***** ^ not supported yet ***** ^ not supported yet 131 Windows.CW_USEDEFAULT, ***** ^ not supported yet ***** ^ not supported yet 132 Windows.CW_USEDEFAULT, ***** ^ not supported yet ***** ^ not supported yet 133 Windows.CW_USEDEFAULT, ***** ^ not supported yet ***** ^ not supported yet 134 Windows.CW_USEDEFAULT, ***** ^ not supported yet ***** ^ not supported yet 135 Windows.HWND(0), (* no parent *) ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 136 Windows.HMENU(0), (* use class menu *) ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 137 hInstance, (* handle to window instance *) ***** ^ not supported yet 138 FarNIL (* no params to pass on *) ***** ^ undeclared identifier 139 ); 140 141 (* Save instance handle for DialogBox *) 142 hInst := hInstance; ***** ^ not supported yet ***** ^ not supported yet 143 lpprocAbout := Windows.MakeProcInstance( Windows.FARPROC(FarADR(About)), hInstance ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ not supported yet 144 145 (* Insert About *) 146 hMenu:= Windows.GetSystemMenu(hWnd, Windows.False); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 147 Windows.ChangeMenu(hMenu, 0, FarNIL, 999, Windows.MF_APPEND + Windows.MF_SEPARATOR); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 148 Windows.ChangeMenu(hMenu, 0, FarADR(szAbout), IDSABOUT, Windows.MF_APPEND + Windows.MF_STRING); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 149 150 (* Make window visible according to the way the app is activated *) 151 Windows.ShowWindow(hWnd, cmdShow); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 152 Windows.UpdateWindow(hWnd); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 153 154 (* Polling messages from event queue *) 155 WHILE (Windows.GetMessage(msg, Windows.HWND(0), 0, 0)) # 0 DO ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 156 Windows.TranslateMessage(msg); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 157 Windows.DispatchMessage(msg); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 158 END; 159 RETURN msg.wParam; ***** ^ not supported yet ***** ^ not supported yet 160 END WinMain; ***** ^ not supported yet 161 162 163 164 END MWMain. ***** ^ not supported yet 262 errors