beautypg.com

Measurement Computing Personal488 rev.3.0 For DOS & Windows 3.Xi User Manual

Page 242

background image

II. SOFTWARE GUIDES - 10. Driver488/W31

10E. C Languages

Personal488 User’s Manual, Rev. 3.0

II-227

/* Do clean up before exiting from the application

*/

CwUnRegisterClasses();
return msg.wParam;
} /* End of WinMain

*/

/*******************************************************************/
/*

*/

/* Main Window Procedure

*/

/* This procedure provides service routines for the Windows

*/

/* events(messages) that Windows sends to the window, as well as

*/

/* the user initiated events (messages) that are generated when

*/

/* the user selects the action bar and pulldown menu controls or

*/

/* the corresponding keyboard accelerators.

*/

/*******************************************************************/

LONG FAR PASCAL WndProc(HWND hWnd, WORD Message, WORD wParam, LONG
lParam)
{
HMENU hMenu=0;

/* handle for the menu

*/

HBITMAP hBitmap=0; /* handle for bitmaps

*/

HDC hDC;

/* handle for the display device

*/

PAINTSTRUCT ps;

/* holds PAINT information

*/

int nRc=0;

/* return code

*/

HWND hDriver;

switch (Message) {
case WM_COMMAND:

/* The Windows messages for action bar and pulldown menu items */
/* are processed here.

*/

switch (wParam) {
case IDM_F_GO:

/* Place User Code to respond to the

*/

/* Menu Item Named “&Go” here.

*/

{

FARPROC

lpfnEX3DLGMsgProc;

lpfnEX3DLGMsgProc = MakeProcInstance((FARPROC)EX3DLGMsgProc,
hInst);

nRc = DialogBox(hInst, MAKEINTRESOURCE(200), hWnd,

lpfnEX3DLGMsgProc);
FreeProcInstance(lpfnEX3DLGMsgProc);
}
break;
case IDM_F_QUIT:
/* Place User Code to respond to the

*/

/* Menu Item Named “&Quit” here.

*/

SendMessage(hWnd, WM_CLOSE, 0, 0L);
break;
default:
return DefWindowProc(hWnd, Message, wParam, lParam);
}
break; /* End of WM_COMMAND

*/

case WM_CREATE:
break; /* End of WM_CREATE

*/

case WM_MOVE: /* code for moving the window

*/

break;
case WM_SIZE: /* code for sizing client area

*/

break; /* End of WM_SIZE

*/

case WM_PAINT: /* code for the window’s client area

*/

/* Obtain a handle to the device context

*/

/* BeginPaint will sends WM_ERASEBKGND if appropriate

*/

memset(&ps, 0x00, sizeof(PAINTSTRUCT));
hDC = BeginPaint(hWnd, &ps);

/* Included in case the background is not a pure color

*/

SetBkMode(hDC, TRANSPARENT);