
10E. C Languages II. SOFTWARE GUIDES - 10. Driver488/W31
II-220 Personal488 User’s Manual, Rev. 3.0
/* 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 in the 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 EX2DLGMsgProc(HWND hWndDlg, WORD Message, WORD wParam,
LONG lParam)
{
DevHandleT ieee, adc, devhandle; /* handles for the IEEE devices */
IeeeStatusT substat; /* structure for the Driver488/W31 Status*/
chartextstr[2048],response[64];
/* strings for Driver488/W31 responses */
double sum, voltage; /* variables for ADC488 responses */
int i, hundred[100]; /* general counter and data buffer */
TermT noterm; /* structure for disabling terminators */
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 or create the 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:
/* Create the device ADC by copying the default device WAVE */
switch (devhandle=OpenName(“WAVE”)) {
case -2:
MessageBox(hWndDlg, (LPSTR)"WAVE device already open",
NULL, MB_OK);
EndDialog(hWndDlg, TRUE);
return TRUE;
case -1:
MessageBox(hWndDlg, (LPSTR)"Cannot open WAVE device",
NULL, MB_OK);
EndDialog(hWndDlg, TRUE);
return TRUE;
default:
break;
}
Comentarios a estos manuales