National Instruments 321645c-01 Welding System User Manual


 
Chapter 2 Function Reference Config_DAQ_Event_Message
NI-DAQ FRM for PC Compatibles 2-82
©
National Instruments Corporation
default:
// handle other usual messages...
return DefWindowProc (hWnd, uMsgId, wParam, lParam);
}
}
Callback Functions
To enable the callback function, you need to provide the address of the callback routine in
callbackAddr. Therefore, you must write your application in a programming language that
supports function pointers, such as C or Assembly.
If you are using LabWindows/CVI, your callback function is called by means of messaging.
No special precautions or prototypes are required.
Callback Functions in Windows 95 and Windows NT
Callbacks are easy and safe to use in Windows 95 and Windows NT. Your callback function
is called in the foreground and in the context of your process. You can access your global data,
make system calls, or call NI-DAQ from your callback function. However, succeeding events
will not be handled until your callback has returned. The time delay between the event and
notification (also known as latency) is highly variable and depends largely on how loaded
your system is. Latency always will be less with a callback than a Windows message because
you avoid the latency of the Windows messaging system.
Latency is less deterministic with packet-based buses, such as the Universal Serial Bus
(USB).
Your callback function should use standard C calling conventions. Do not use the
CALLBACK
function type. Here is a sample prototype:
void myCallback (HWND hwnd, UINT message, WPARAM wparam, LPARAM
lparam)