Wednesday 18 September 2013

Developing Twain ActiveX control in C++ MFC

Developing Twain ActiveX control in C++ MFC

I am developing TWAIN ActiveX control in MFC. I followed the steps that
comes in the specification of twain as follows: 1 - Load Twain 2 - Open
Data Source Manager 3 - Select Data Source 4 - Open Data Source 5 -
Negotiate capabilities with the data source 6 - Request the Acquisition of
Data from the Source 7 - Recognize that the Data Transfer is Ready
after I enable the Data Source User interface via MSG_ENABLEDS I enter a
while loop like this:
while(GetMessage(&msg, NULL, 0, 0))
{
// Forward the message to twain proc MSG_PROCESSEVENT
// then check the return message from twain
// to know if the transfer ready or not
}
I made this loop cause in MFC ActiveX control there is no Message Loop
the problem is when I close the application I got an exception
I need to know the best way to forward messages to twain via MSG_PROCESSEVENT
is it via SetWindowsHookEx , message loop, or worker thread thanks

No comments:

Post a Comment