User`s guide

5 Acquiring Image Data
5-16
The PostThreadMessage() function accepts these parameters:
BOOL PostThreadMessage( DWORD idThread,
UINT Msg,
WPARAM wParam,
LPARAM lParam
);
The following table describes how to set these parameters for an adaptor. For more
information about sending thread messages, see the documentation at the Microsoft
Developer Network Web site (msdn.microsoft.com).
Parameter Description
idThread Identifier of the thread to which the message is to be posted, returned
by CreateThread().
Msg Message to be posted. Microsoft defines a range of values for user
messages, beginning with the value WM_USER.
wParam Additional message-specific information
lParam Additional message-specific information
Example: Initiating Acquisition
This example illustrates a simple startCapture() function. This function takes no
arguments and returns a Boolean value indicating whether the video input object is in
start state.
1
Replace the stub implementation in the MyDeviceAdaptor.cpp file with this code
and then rebuild your adaptor.
bool MyDeviceAdaptor::startCapture(){
// Check if device is already acquiring frames.
if (isAcquiring())
return false;
// Send start message to acquisition thread
PostThreadMessage(_acquireThreadID, WM_USER, 0, 0);
return true;
}
2
Start the MATLAB software and run your adaptor to verify that your acquisition
thread gets the start message from startCapture().