The ActiveX saga

One of the first projects to be tackled was the ActiveX control. The C++ program Jonathan originally developed used a 16-bit driver to talk to the CEMonitor (the power line modem connected to the PC).
This meant it could only run on a Win 3.x machine, or a Win95 machine. It also meant we had to develop using a no longer supported version of VC++. However, Intellon also offered an ActiveX control. This would get rid of the legacy Win16 code and allow any software developed to be run on both Win95 and WinNT. ActiveX controls are supposed be able to be used with any of Microsoft's languages such as VC++, VB, and VJ++.
This did not turn out t0 be true in this case. After figuring out how to use an ActiveX control in VC++ I tried to reimplement Jonathan's program using Win32. The control would import ok, and it would let me use most of the methods from the control, but not all of them! It was missing the hook for receiving data.
Luckily the source code for the ActiveX control is also available. The control was written in Visual Basic. After going through the source, a found that a parameter to one of the functions in the control was what was causing the problem. All of the data types that were used were integers and strings. This parameter was an array of bytes. After removing this parameter (it was a timestamp that wasn't needed) the missing function showed up in VC++.
After figuring out how to deal with the way the ActiveX control passed strings around using BSTRs I was able to re-implement a scaled down version Jonathan's original program in VC++ using Win32.
The next step was to retrieve camera data from the rhino using the new program. I put in all of the logic to grab images, and display them but it did not work. After a lot of debugging I found that the raw data was not being sent through the ActiveX control properly. In the VB source code for the control I found that it was using a string to pass around an array of bytes. This is the conventional way of handling this type of data in VB, but there was a problem in using it with the ActiveX control.
I found the control handled normal ASCII characters, but the image data was binary. What was happening was VB would load the sting properly, but in being transferred as the ActiveX string, it was being interpreted as a UNICODE string. So the binary data was being corrupted. I found out that VB stores it's strings as UNICODE so there was no way to get around that, and there are no functions in VC++ to uninterpret the string. This meant that the ActiveX control was worthless except in VB. As a result most of the programs have be developed in VB.

Other projects that have dealt with the ActiveX problems are Java and Unix C versions of the ActiveX control.


Back to main page