>>Well, Larry's point was essentially the same one I was making. When I was writing Obj2Bmp I wanted it to work with both VFP 5.0 and 6.0. However, since it utilized the TreeView and the ImageList, and the versions of the controls (including ProgIDs) were different. The solution was to simply subclass the controls, determining which one to instantiate at run-time. I don't know if there are licensing issues with those controls or not, but in this instance, it really didn't matter since the application was designed to be used in design mode.
>
>I gotcha. I'm gonna have to think thru some of this. According to the Help, to subclass most ActiveX controls in code you would do something like:
>DEFINE CLASS MySubClass AS olecontrol
> OleClass = "MyActiveXControl.ProgId"
>* Other code
>ENDDEFINE
>
>I have tried this but must be missing something cause when I try the above code in a PRG and try to AddObject() referencing it, the Insert ActiveX Control dialog pops up. As a test I tried doing a
>THISFORM.ADDOBJECT( "MyControl", "olecontrol" )
>in a form's Init which also popped up the dialog. But the code I'm using is essentially like that in the Help. :-|
Try this
DEFINE CLASS MySubClass AS OLECONTROL
ENDDEFINE
SET PROCEDURE TO ActiveX.prg ADDITIVE
ThisForm.AddObject("MyObjName", "MySubClass", "ProgID")
In the above "ProgID" is to be replaced with the ProgId of the control being sub-classed.
George
Ubi caritas et amor, deus ibi est