
5 Acquiring Image Data
5-12
return true;
// Create the image acquistion thread.
_acquireThread = CreateThread(NULL,
0,
acquireThread,
this,
0,
&_acquireThreadID);
if (_acquireThread == NULL) {
closeDevice();
return false;
}
// Wait for thread to create message queue.
while(PostThreadMessage(_acquireThreadID,WM_USER+1,0,0) == 0)
Sleep(1);
return true;
}
2
To be able to compile and link your adaptor, you must create a stub implementation
of your acquireThread() function and add it to your adaptor. You can fill in
the complete implementation later — see “Implementing the Acquisition Thread
Function” on page 5-18.
DWORD WINAPI MyDeviceAdaptor::acquireThread(void* param) {
MSG msg;
while (GetMessage(&msg,NULL,0,0) > 0) {
switch (msg.message) {
case WM_USER:
// The frame acquisition loop code goes here.
imaqkit::adaptorWarn(''in acquire thread function \n'');
} // end switch
} // end while
return 0;
} // end acquireThread
3
Add declarations of the acquireThread() function, the acquireThread variable,
and the acquireThreadID variable as private data members of your adaptor class
header file. In this example, MyDeviceAdaptor.h.
Commentaires sur ces manuels