i've been struggling with this one for a couple of months now on a fairly
large project. couldn't find anything remotely connected to this
show-stopper.
here is a sample repro of the problem:
http://www.unicontsoft.com/upload/VBIDEBug.zip
open the project group Group1 and try to run in the IDE. can anyone confirm
this is not compiling?
i'm using VB6 SP5 on a win2k3 server here but it's been consistently not
working on win2k machines too.
description of the problem:
an activex control project is referenced by a standard exe. a single class
(public not-creatable by default) is exposing an event Click and a method
DoSomething. a form in the exe is consuming an instance of Class1 and
sinking its events (Private WithEvents m_oSink As Class1). everything
compiles ok in the IDE until an usercontrol is added to the activex control
project that exposes a public property strongly-typed as Class1 (Property
Get Prop() As Class1). from this point on a mysterious "Object does not
source automation events" compile error prevents further debugging. strage
thing is binary compilation seems to pass with no problems.
resolution:
first one: open the activex control project file (Project2.vbp) in a text
editor and reorder source files (!!!) -- it's been a real pain adding new
modules to my hefty project file because the bug could have crept anytime.
second one: expose IDispatch (Property Get Prop() As Object) property of the
usercontrol instead of the strongly-typed Class1. this will require certain
modification if friend methods/props are used on this property anywhere in
the activex control project.
this seems to be another flaw of the activex controls wrapper VB is
automagically creating behind the scenes. if anyone with access to SP6 beta
program cares to submit it as a bug request i'll be glad to help.
HTH,
</wqw>
p.s. i'd care to contrive a repro project of another ax control wrapper bug
i noticed when passing byte arrays in/out a usercontrol -- if anyone cares
to include me on the beta program for the SP6 :-))
Before:
Public Event UpdateDir(ByVal sCurrentDir As String)
Private WithEvents foCurrentFolder As cFolderEntry
After:
Private WithEvents foCurrentFolder As cFolderEntry
Public Event UpdateDir(ByVal sCurrentDir As String)
Hope that helps someone. Oh, and mine was strange because this was only
a problem when compiling from the command line. But if i compile from
the IDE, it was ok.