beautypg.com

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

Page 245

background image

10E. C Languages

II. SOFTWARE GUIDES - 10. Driver488/W31

II-230

Personal488 User’s Manual, Rev. 3.0

}

break; /* End of WM_COMMAND

*/

default:
if (Message==WM_IEEE488EVENT) {

strcpy(textstr,"SRQ event detected\r\n");
SetDlgItemText(hWndDlg, 201, (LPSTR)textstr);

/* Clear the SRQ condition

*/

SPoll(adc);

/* Reset the buffer pointer of the ADC488

*/

Output(adc, “B0X”);
/* Get 100 readings from the ADC488

*/

for (i=0;i<100;i++) {

Enter(adc,response);
strcat(textstr, response);
strcat(textstr, “\r\n”);

}
SetDlgItemText(hWndDlg, 201, (LPSTR)textstr);
}
return FALSE;
}
return TRUE;
} /* End of EX3DLGMsgProc

*/

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

*/

/* nCwRegisterClasses Function

*/

/*

*/

/* The following function registers all the classes of all the

*/

/* windows associated with this application. The function returns

*/

/* an error code if unsuccessful, otherwise it returns 0.

*/

/*

*/

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

int nCwRegisterClasses(void)
{
WNDCLASS wndclass; /* struct to define a window class

*/

memset(&wndclass, 0x00, sizeof(WNDCLASS));
/* load WNDCLASS with window’s characteristics

*/

wndclass.style = CS_HREDRAW | CS_VREDRAW | CS_BYTEALIGNWINDOW;
wndclass.lpfnWndProc = WndProc;
/* Extra storage for Class and Window objects

*/

wndclass.cbClsExtra = 0;
wndclass.cbWndExtra = 0;
wndclass.hInstance = hInst;
wndclass.hIcon = LoadIcon(hInst, “EXAMPLE3");
wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
/* Create brush for erasing background

*/

wndclass.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
wndclass.lpszMenuName = szAppName; /* Menu Name is App Name

*/

wndclass.lpszClassName = szAppName; /* Class Name is App Name

*/

if (!RegisterClass(&wndclass))
return -1;

return(0);
} /* End of nCwRegisterClasses

*/

/*******************************************************************/
/* cwCenter Function

*/

/*

*/

/* centers a window based on the client area of its parent

*/

/*

*/

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

void cwCenter(hWnd, top)
HWND hWnd;