National Instruments 321645c-01 Welding System User Manual


 
Chapter 2 Function Reference Config_DAQ_Event_Message
©
National Instruments Corporation 2-81 NI-DAQ FRM for PC Compatibles
Event notification is done through the Windows API function PostMessage and/or a
callback function that you define.
When any trigger event happens, NI-DAQ calls PostMessage as follows:
int PostMessage (HWND handle, UINT message, WPARAM wParam,
LPARAM lParam)
handle and message are the same handle and message as previously defined. The least
significant byte of wParam is the device and the second least significant byte of wParam
is a boolean flag, doneFlag, indicating whether the DAQ process has ended.
doneFlag = 0: Asynchronous operation is still running.
doneFlag = 1: Asynchronous operation has stopped.
lParam contains the number of the scan in which DAQEvent occurred.
The following is an example
WindowProc
routine, written in C:
LRESULT CALLBACK WindowProc(HWND hWnd, UINT uMsgId, WPARAM wParam, LPARAM
lParam)
{
static unsigned long int uNIDAQeventCount = 0;
short DAQeventDevice;
short doneFlag;
long scansDone;
switch (uMsgId)
{
case WM_PAINT:
//..handle this message...
break;
case WM_DESTROY:
//..handle this message...
break;
case WM_NIDAQ_MSG:
//**************************************
//put your NI-DAQ Message handling here!
//**************************************
// increment static counter
uNIDAQeventCount++;
DAQeventDevice = (wParam & 0x00FF);
doneFlag = (wParam & 0xFF00) >> 8;
scansDone = lParam;
//..handle this message...
return 0;
break;