home *** CD-ROM | disk | FTP | other *** search
- /*Filename: CALC.C */
- /*"CALC" Generated by WindowsMAKER */
- /*Author: Bill G. */
-
- #include <WINDOWS.H>
- #include "CALC.H"
-
-
- HANDLE hInst; /* Handle to instance. */
- HWND MainhWnd; /* Handle to main window.*/
-
- int PASCAL WinMain(hInstance, hPrevInstance, lpCmdLine, nCmdShow)
- HANDLE hInstance; /* current instance */
- HANDLE hPrevInstance; /* previous instance */
- LPSTR lpCmdLine; /* command line */
- int nCmdShow; /* show-window type (open/icon) */
- {
- MSG msg; /* message */
-
- hInst = hInstance; /* Saves the current instance */
-
-
- lpCmdLine; /* Long pointer to command line. */
-
- if (!hPrevInstance) /* Is there an other instance of the task */
- {
- if (!BLDInitClass(hInstance))
- return FALSE; /* Exits if unable to initialize */
- }
-
- MainhWnd = BLDInitMainWindow(hInstance);
- if (!MainhWnd) /* Check if the window is created */
- return FALSE;
-
- ShowWindow(MainhWnd, nCmdShow); /* Show the window */
- UpdateWindow(MainhWnd); /* Send WM_PAINT message to window */
-
-
-
- while (GetMessage(&msg, /* message structure */
- 0, /* handle of window receiving the message */
- 0, /* lowest message to examine */
- 0)) /* highest message to examine */
- {
- TranslateMessage(&msg); /* Translates character keys */
- DispatchMessage(&msg); /* Dispatches message to window */
- }
- return(msg.wParam); /* Returns the value from PostQuitMessage */
- }
-
-
-
- long FAR PASCAL CALCWndProc(hWnd, message, wParam, lParam)
- HWND hWnd; /* window handle */
- unsigned message; /* type of message */
- WORD wParam; /* additional information */
- LONG lParam; /* additional information */
- {
-
- switch (message)
- {
-
- case WM_COMMAND: /* command from application menu */
- switch(wParam)
- {
- default:
- return BLD_WM_COMMANDMsg(hWnd,message,wParam,lParam);
- }
- break;
- case WM_CHAR:
- return BLD_WM_CHARMsg(hWnd,message,wParam,lParam);
- break;
- case WM_DESTROY: /* window being destroyed */
- PostQuitMessage(0);
- break;
- default:
- /* Pass on message for default processing */
- return(DefWindowProc(hWnd, message, wParam, lParam));
- }
- return FALSE; /* Returns FALSE if processed by this WndProc*/
- }
-
-
-
- BOOL BLDInitClass(hInstance)
- HANDLE hInstance;
- {
- WNDCLASS WndClass;
-
- WndClass.style = 0;
- WndClass.lpfnWndProc = CALCWndProc;
- WndClass.cbClsExtra = 0;
- WndClass.cbWndExtra = 0;
- WndClass.hInstance = hInstance;
- WndClass.hIcon = LoadIcon(hInstance,"CALC");
- WndClass.hCursor = LoadCursor(NULL,IDC_ARROW);
- WndClass.hbrBackground = CreateSolidBrush(GetSysColor(COLOR_WINDOW));
- WndClass.lpszMenuName = NULL;
- WndClass.lpszClassName = "CALC";
-
- BLD_MainClassClsInit(&WndClass);
-
- return RegisterClass(&WndClass);
- }
-
-
-
- HWND BLDInitMainWindow(hInstance)
- HANDLE hInstance;
- {
- HWND hWnd; /* window handle */
- int coordinate[4]; /* Coordinates of main window */
- DWORD WndStyle; /* Style for main window */
- PSTR pInfo; /* Points to Info sent at WM_CREATE */
-
- /* Initial value of main window parameters */
- WndStyle =WS_OVERLAPPED|WS_THICKFRAME|WS_SYSMENU|WS_MINIMIZEBOX|WS_MAXIMIZEBOX;
- pInfo =NULL;
- coordinate[0]=CW_USEDEFAULT;
- coordinate[1]=0;
- coordinate[2]=CW_USEDEFAULT;
- coordinate[3]=0;
-
- hWnd=BLD_MainWindowWndInit(&WndStyle,&coordinate[0],&pInfo);
- if (hWnd)
- return hWnd;
-
- hWnd = CreateWindow("CALC", /* WndClass registered earlier */
- "All the Child Windows/Controls in CALCDLG.DLG will be put in this Window", /* window title in title bar */
- WndStyle, /* window style */
- coordinate[0], /* x position */
- coordinate[1], /* y position */
- coordinate[2], /* width */
- coordinate[3], /* height */
- 0, /* parent handle */
- 0, /* menu or child ID */
- hInstance, /* instance */
- (LPSTR)pInfo); /* additional info */
-
- return hWnd;
- }
-
-
-
-