Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

bug report: "Object does not source automation events" compile error in VB IDE

29 views
Skip to first unread message

Vlad Vissoultchev

unread,
Jan 27, 2004, 7:59:34 PM1/27/04
to
hi group,

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 :-))


lardcanoe

unread,
Jan 7, 2005, 11:54:00 AM1/7/05
to

When I got that error, my solution was to have the Public Event FooBar
be the last thing defined in the module/class. I had some other
variable declarations after my Public Events and by moving the
variables above that, it got rid of the problem.

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.

0 new messages