beautypg.com

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

Page 243

background image

10E. C Languages

II. SOFTWARE GUIDES - 10. Driver488/W31

II-228

Personal488 User’s Manual, Rev. 3.0

/* 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 Windows

*/

/* for default message processing.

*/

return DefWindowProc(hWnd, Message, wParam, lParam);
}
return 0L;
} /* End of WndProc

*/

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

*/

/* Dialog Window Procedure

*/

/*

*/

/* This procedure is associated with the dialog box that is

*/

/* included inthe function name of the procedure. It provides the */
/* service routines for the events (messages) that occur because

*/

/* the end user operates one of the dialog box’s buttons, entry

*/

/* fields, or controls.

*/

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

BOOL FAR PASCAL EX3DLGMsgProc(HWND hWndDlg, WORD Message, WORD wParam,
LONG lParam)
{
double sum, voltage;
int i, hundred[100];
TermT noterm;

switch(Message) {
case WM_INITDIALOG:
cwCenter(hWndDlg, 0);
/* initialize working variables

*/

/* open Driver488/W31

*/

if ((ieee=OpenName(“IEEE”))<0) {

MessageBox(hWndDlg, (LPSTR)"Cannot initialize IEEE system", NULL,

MB_OK);
EndDialog(hWndDlg,

TRUE);

return TRUE;

}

/* open device named ADC

*/

Error(ieee, OFF);
switch (adc=OpenName(“ADC”)) {
case -2:

MessageBox(hWndDlg, (LPSTR)"ADC device already open", NULL,

MB_OK);

EndDialog(hWndDlg,

TRUE);

return

TRUE;

case -1:
switch (devhandle=OpenName(“WAVE”)) {

case -2:

MessageBox(hWndDlg, (LPSTR)"WAVE device already open", NULL, MB_OK);
EndDialog(hWndDlg, TRUE);