beautypg.com

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

Page 234

background image

II. SOFTWARE GUIDES - 10. Driver488/W31

10E. C Languages

Personal488 User’s Manual, Rev. 3.0

II-219

{
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

lpfnEX2DLGMsgProc;

lpfnEX2DLGMsgProc = MakeProcInstance((FAPROC)EX2DLGMsgProc,

hInst);

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

FreeProcInstance(lpfnEX2DLGMsgProc);

}

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);

/* Inform Windows painting is complete

*/

EndPaint(hWnd,

&ps);

break; /* End of WM_PAINT

*/

case WM_CLOSE: /* close the window

*/

/* Destroy child windows, modeless dialogs, then,this window */

hDriver=FindWindow((LPSTR)"Driver488/W31

Loader",

(LPSTR)"Driver488/W31");

SendMessage(hDriver, WM_DESTROY, 0, 0L);
DestroyWindow(hWnd);

if (hWnd == hWndMain)

PostQuitMessage(0); /* Quit the application

*/

break;
default:

/* For any message for which you don’t specifically provide */

/* a service routine, you should return the message to

*/