Non visual OCXs

Started by Jose Roca, July 14, 2004, 06:46:49 AM

Previous topic - Next topic

Jose Roca

Hi Paul,

There is a way you can add support for non visual OCXs like the ones that come with Visual Studio, like MSINET (Microsoft Transfer Control), MSWINSCK (Microsoft Winsock Control), etc.

1.- Create an icon for non visual OCXs that doesn't need to be resizable and will be invisible when the program is executed. More or less like you do with the timer control.

2.- Properties: The same as visual OCXs, but without window style, width and height.

That's all. The rest will be the same as with Visual OCXs, i.e. you will create the control with CreateWindowEx(0, "AtlAxWin71", ....), get the IUnknown of the control with AtlAxGetControl, convert it to a dispatch variant, etc.

I have just discovered that ATL can be used to initialize any object, not just visual OCXs. It can even open an Ado connection if you use "ADODB.Connection" as the name of the class in CreateWindowEx. Cool :)

Another question is that you can create templates like with the custom controls to allow to set properties like in Visual Basic and generate code to set them (OBJECT LET <objectname>.<propertyname> = <value entered by the user>). This applies both to visual and non visual OCXs.

Haakon Birkeland