A
AgizAluber
Guest
At my job, my task is to create an ActiveX control that uses Twain for ImageAquisition.
As I searched for the best solution on the internet, I found this great example. I was a bit concerned at first that it might not work when I saw the date (10 years old) when the article was published, but nevertheless I downloaded the code and opened the project in Visual Studio 2010 Ultimate. While opening, the project was of course converted to a newer version by Visual Studio. Then I ran the project and it worked - I was able to scan and save pictures succesfully with my CanoScan 3200F, which is Twain compatible of course.
Then I created a blank ActiveX wrapper class, registered my newely made ActiveX component (with all the steps neccesary for an ActiveX control to run in Internet Explorer - read the steps in this article) and tried it in Internet Explorer 8 and it worked properly.
In the next step I simply included all the neccesary code from the correctly-working Twain example mentioned before (the one from 2002). Saved, rebuilt the project, registered my ActiveX component and again tested it in IE8. The component succesfully started and succesfully ran my Twain WindowsForm Application, but here is where the problem starts...
When clicked the "Scan" button (in the Twain GUI), which sends a message caught by the "bool IMessageFilter.PreFilterMessage(ref Message m)" method, the scan would not start. I discovered that the reason for that is simply because no message is ever caught by the PreFilterMessage method! And yes, if you are asking yourself if I used the AddMessageFilter() method, the answer is YES!
So, My question is, why the same method catches the messages when running directly from an Windows Form app, but when IE8 calls the same code, using ActiveXObject (in JavaScript), the scan button in the before mentioned Twain GUI does not send any message?
Does it have something to do with who the parent process is?
I am really lost here and would really apreciate your help. I can even give you both the projects I am testing on, but please, somene help me. :/
Thank you so much.
Continue reading...
As I searched for the best solution on the internet, I found this great example. I was a bit concerned at first that it might not work when I saw the date (10 years old) when the article was published, but nevertheless I downloaded the code and opened the project in Visual Studio 2010 Ultimate. While opening, the project was of course converted to a newer version by Visual Studio. Then I ran the project and it worked - I was able to scan and save pictures succesfully with my CanoScan 3200F, which is Twain compatible of course.
Then I created a blank ActiveX wrapper class, registered my newely made ActiveX component (with all the steps neccesary for an ActiveX control to run in Internet Explorer - read the steps in this article) and tried it in Internet Explorer 8 and it worked properly.
In the next step I simply included all the neccesary code from the correctly-working Twain example mentioned before (the one from 2002). Saved, rebuilt the project, registered my ActiveX component and again tested it in IE8. The component succesfully started and succesfully ran my Twain WindowsForm Application, but here is where the problem starts...
When clicked the "Scan" button (in the Twain GUI), which sends a message caught by the "bool IMessageFilter.PreFilterMessage(ref Message m)" method, the scan would not start. I discovered that the reason for that is simply because no message is ever caught by the PreFilterMessage method! And yes, if you are asking yourself if I used the AddMessageFilter() method, the answer is YES!
So, My question is, why the same method catches the messages when running directly from an Windows Form app, but when IE8 calls the same code, using ActiveXObject (in JavaScript), the scan button in the before mentioned Twain GUI does not send any message?
Does it have something to do with who the parent process is?
I am really lost here and would really apreciate your help. I can even give you both the projects I am testing on, but please, somene help me. :/
Thank you so much.
Continue reading...