reference (.dll) vs. componen t(.oca) 
Author Message
 reference (.dll) vs. componen t(.oca)

I have an ActiveX control ("Control Type Library 1.0")  that
can be dragged onto a VB form and/or it can be declared and
used in my code without dragging it onto the form.  The
control defines an object, ExObject.

If I press:   Project : Components   and then select
"Control Type Library 1.0" and hit 'Apply', I get the icon
on my control pallette.  I can now drag this icon onto my
form.  I get a variable named ExObject1 in my program
that works great.

If I then press:   Project : References   and select "Control
Type Library 1.0", then I can declare a variable in my code:

dim WithEvents Exam as CONTROLLib.ExObject

this variable, Exam, works great.

Because of the nature of this ActiveX control, it is not unusual to
have both styles of declaration in the same VB project.

I don't like having to say "CONTROLLib.ExObject".  Instead,
I'd like to type just "ExObject", like this:

dim WithEvents Example as ExObject

If first define the object with "Project : Components", then
ExObject is defined in my project, but the above dim statement
will not work [why is this?].  If I add a "Project : References"
definition at this point, the dim statement still won't work, unless I
qualify it with CONTROLLib.

When I look at my "Project : References" list, I see two adjacent,
checked entries:

      Control Type Library 1.0        -> .oca
      Control Type Library 1.0        -> .dll

The first entry,  pointing to an .oca file, was created by VB when
I did "Project : Components".  So "ExObject" in the dim statement
is resolved by the first (.oca) entry.  For some reason this gets an
error at runtime [anyone know why?].  To fix the problem requires
that these two entries be reordered in my  Project : References  list.

Explaining all this to users of my control is really complicated.

Is there a standard way to declare ActiveX controls so that the
entries created by VB in response to "Project : Components" do
not interfere with objects made accessible with "Project : References"?

Sam Quiring



Sun, 20 Feb 2005 08:28:56 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. What changes my OCX reference to and OCA reference

2. help : OCX/OCA/ missing reference

3. Class of control was not a loaded control class - Reference Replaced with unknown .OCA file

4. oca references

5. Type mismatch vs. OCA files

6. MSComctlLib.ocx vs MSComctlLib.oca?

7. referencing dll vs adding a class

8. Project References Vs Binary References

9. Saving OCA og DLL's

10. DLLs With LFNs and OCA 8.3 Filename Clash

11. Custom Control: FM20.DLL, FM20.OCA but no FM20.HLP

12. Gif89.dll/Gif89.oca anyone have these for VB4

 

 
Powered by phpBB® Forum Software