home *** CD-ROM | disk | FTP | other *** search
- /*****************************
- * Windows Support File for
- * Mult.C
- ******************************/
-
- #include <windows.h>
- #include "multwin.h"
- #include "multdlg.h"
-
- extern NEAR PASCAL main(HWND);
- long FAR PASCAL WndProc (HWND, WORD, WORD, LONG);
- BOOL FAR PASCAL AboutDlgProc (HWND, WORD, WORD, LONG);
-
- HANDLE hInst;
- FARPROC lpitAbout;
-
- #pragma argsused
-
- int PASCAL WinMain(HANDLE hInstance, HANDLE hPrevInstance,
- LPSTR lpszCmdLine, int nCmdShow)
-
- {
- static char szAppName[] = "MULT";
- HWND hwnd;
- MSG msg;
- WNDCLASS wndclass;
-
- if (!hPrevInstance)
- {
- wndclass.style = CS_HREDRAW | CS_VREDRAW;
- wndclass.lpfnWndProc = WndProc;
- wndclass.cbClsExtra = 0;
- wndclass.cbWndExtra = 0;
- wndclass.hInstance = hInstance;
- wndclass.hIcon = LoadIcon(hInstance, "multico");
- wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
- wndclass.hbrBackground = GetStockObject(WHITE_BRUSH);
- wndclass.lpszMenuName = "MENU_RESOURCE";
- wndclass.lpszClassName = szAppName;
-
- RegisterClass(&wndclass);
- }
-
- hInst = hInstance;
-
- hwnd = CreateWindow(szAppName, /* Class */
- "11 Bit Multiplexor", /* Title */
- WS_OVERLAPPEDWINDOW, /* Style */
- CW_USEDEFAULT, CW_USEDEFAULT, /* x, y */
- 240,180, /* xsize, ysize */
- NULL, /* parent */
- NULL, /* class menu */
- hInstance, /* creator */
- NULL); /* Params */
-
-
- ShowWindow(hwnd, nCmdShow);
- UpdateWindow(hwnd);
-
- lpitAbout = MakeProcInstance((FARPROC)AboutDlgProc, hInst);
-
- while (GetMessage(&msg, NULL,0,0))
- {
- TranslateMessage(&msg);
- DispatchMessage(&msg);
- }
- return msg.wParam;
- }
-
-
- long FAR PASCAL WndProc (HWND hwnd, WORD message, WORD wParam, LONG lParam)
-
- {
- HANDLE hMenu, hSysMenu;
- static int cRun = 0;
-
- switch (message)
-
- {
-
-
- case WM_COMMAND:
- hMenu = GetMenu(hwnd);
- hSysMenu = GetSystemMenu(hwnd, 0);
- switch (wParam)
- {
- case IDM_EXIT:
- DestroyWindow(hwnd);
- break;
-
- case IDM_RUN:
- /* EnableMenuItem(hMenu, IDM_RUN, MF_GRAYED);
- */
- EnableMenuItem(hMenu, IDM_EXIT, MF_GRAYED);
- EnableMenuItem(hSysMenu, SC_CLOSE, MF_GRAYED);
- DrawMenuBar(hwnd);
- cRun ++;
- if (!main(hwnd))
- {
- cRun --;
- MessageBeep(0);
- MessageBox(hwnd,"Could not run Multiplexor!", "Multiplexor", MB_OK);
- }
- cRun --;
- /* EnableMenuItem(hMenu, IDM_RUN, MF_ENABLED);
- */
- if (!cRun)
- {
- EnableMenuItem(hMenu, IDM_EXIT, MF_ENABLED);
- EnableMenuItem(hSysMenu, SC_CLOSE, MF_ENABLED);
- }
- DrawMenuBar(hwnd);
- break;
-
- case IDM_ABOUT:
- DialogBox(hInst,
- MAKEINTRESOURCE(IDD_ABOUT),
- hwnd,
- lpitAbout);
- break;
- }
- break;
-
- case WM_DESTROY:
- PostQuitMessage(0);
- break;
-
- default:
- return DefWindowProc(hwnd,message,wParam,lParam);
- }
- return 0L;
- }
-
- #pragma argsused
-
- BOOL FAR PASCAL AboutDlgProc (HWND hdlg, WORD message, WORD wParam, LONG lParam)
- {
- switch (message)
- {
- case WM_COMMAND:
- EndDialog(hdlg, TRUE);
- return TRUE;
- default:
- return FALSE;
- }
- }
-