Public WithEvents X as OCX - breaks Binary Compatibility 
Author Message
 Public WithEvents X as OCX - breaks Binary Compatibility

Does anyone know anything about the problems described below?

I am trying to create an VB 6.0 ActiveX DLL in which I have a set of
class modules defined with the following declaration:

Public WithEvents ControlObject as XXXXX

XXXXX is a VB 6.0 control type - either an intrinsic VB control
(TextBox, etc.) or an ActiveX (.OCX) control (MaskEdBox, DTPicker,
etc.)

This declaration works with no problem for intrinsic VB controls.

However, for classes that use this declaration for ActiveX controls,
it works - but with the following quirks:

1) Any EXE that references these classes in the DLL must be compiled
on the same PC as was the DLL (or we get a Run-time error '13' - Type
mismatch - whenever the ControlObject property is assigned).

2) When XXXXX is a ListView control, recompiling the DLL without
changing any code whatsoever causes the DLL to break binary
compatibility (when the DLL project is set to binary compatible mode)
after every recompile.

These problems go away if I compile these classes into the EXE rather
than into a DLL - but I would prefer to use a DLL if at all possible!

Any information or suggestions would be much appreciated!!  Thanks.



Sat, 18 Sep 2004 23:01:25 GMT  
 Public WithEvents X as OCX - breaks Binary Compatibility

Quote:

>> Does anyone know anything about the problems described below?

>> I am trying to create an VB 6.0 ActiveX DLL in which I have a set of
>> class modules defined with the following declaration:

>> Any information or suggestions would be much appreciated!!  Thanks.

Don't make the variable Public. Make it Private and create a Property
Get/Set to access it:

Private WithEvents m_oControlObject as XXXXX

Public Property Get ControlObject As Object
    Set ControlObject = m_oControlObject
End Property

Public Property Set ControlObject(NewObj As Object)
    Set m_oControlObject = NewObj
End Property

--
Eduardo A. Morcillo (MS MVP VB)
http://www.domaindlx.com/e_morcillo



Sun, 19 Sep 2004 01:41:02 GMT  
 Public WithEvents X as OCX - breaks Binary Compatibility
We're part of the way there!!  Eduardo - your suggestion took care of
problem number 2) (thank you)!!

Number 1) is STILL a problem (i.e. the DLL and the EXE that uses it
still have to be compiled on the same machine in order to work
together).

If anyone has an idea on 1), please post it.  Thank you .....

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



Sun, 19 Sep 2004 05:41:30 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Public WithEvents X as OCX - breaks Binary Compatibility

2. Public WithEvents X as OCX - breaks Binary Compatibility

3. Public WithEvents X as OCX - breaks Binary Compatibility

4. public VB.Label breaks binary compatibility?

5. BUG: Enumerated Type Parameters Break Binary Compatibility

6. Binary compatibility suddenly breaks after each build

7. Binary compatibility suddenly breaks after each build

8. VB6 & VB5 - Binary Compatibility Broken

9. Recompiling Breaks Binary Compatibility

10. ADO 2.1 > 2.5 Break binary compatibility

11. Use of Optional Parameters breaks binary compatibility?

12. Binary Compatibility Broken

 

 
Powered by phpBB® Forum Software