Thursday, April 10, 2008

Threading in .Net - Unable to get the window handle for the 'xxxxxx' control. Windowless ActiveX controls are not supported

We currently have this requirement to create a server which listens at a particular port and does some process. To be able to server multiple requests and be able to perfom efficiently, I decided to use threads. One of the step in this process was to send fax (I used pronexus - VBFax). This has .net controls that can be used. But sadly, you require a form where it can be placed and cannot be created on the fly (more on pronexus later i.e if I ever get to discussing it :-) ) .. so when the server starts a new thread for each request and calls the form using
dim MyForm as form = new FormWithPronexusControls
it gives the error
Unable to get the window handle for the 'VBVFrame' control. Windowless ActiveX controls are not supported

Now I searched left and right trying to find solutions and some solutions mentioned about this been a inherent problem with VS 2005. I even contacted pronexus support who are yet to get back with a solution. By the way, this works fine in VS2003. Some said about creating a custom control with a panel and adding my controls within it. I tried and it did not work. I saw another aticle about DEP (http://blogs.msdn.com/ed_maurer/archive/2007/12/14/nxcompat-and-the-c-compiler.aspx). I did not try it. But as I was reading it, I do not not why, but I thought of running the binary directly instead of running the debug version (i.e using VS2005 IDE). When I ran the exe directly, it suddenly started working.

So for now, it seems to be working and I will update this post if I get it working completely.

No comments:

Post a Comment