User`s manual
Application Hints 77
PCIS-DASK
Interrupt Event Message Programming Hints
Through user-defined callbacks and Windows Message
queue
Example code fragment:
card = Register_Card(PCI_7230, card_number);
//INT1 event notification is through window message
DIO_INT1_EventMessage (card, INT1_EXT_SIGNAL, hWnd,
WM_INT, NULL);
//INT2 event notification is through a callback
function
DIO_INT2_EventMessage (card, INT2_EXT_SIGNAL, hWnd,
NULL, (void *) cbfn);
….
//window message handling function
long PASCAL MainWndProc(hWnd, message, wParam,
lParam)
{
switch(message) {
….
case WM_INT: //interrupt event occurring message
….
break;
….
case WM_DESTROY:
//Disable interrupts
DIO_INT1_EventMessage (card, INT1_DISABLE, hMainW
n
NULL, NULL);
DIO_INT2_EventMessage (card, INT2_DISABLE, hMainWn
d
NULL, NULL);
//Release card
if (card >= 0) Release_Card(card);
PostQuitMessage(0);
break;
….
}
}
….
//call back function
LRESULT CALLBACK cbfn()
{
….
}