"Automation Error" when compiling application using private UserControl.
I have been having a weird problem. I am writing an ActiveX EXE server that
serves both as a VB5 AddIn and a stand-alone executable. Believing in the
reuse of GUI as well as code, I naturally used a private UserControl to
implement the majority of the functionality, and put simple delegation code
onto a form and an UserDocument in order to cope with its two uses.
Now, everything was working alright, and for the first main version, it was
working and compiling quite nicely. Later on, after a few enhancements, I
decided to another build, and during the build, I suddenly got an error
message "Automation Error". From experience, I have found that getting
these type of error messages during a build means that there is some dodgy
code in the UserControl_Initialize or UserControl_Terminate events, which is
executed due to the UserControl for some reason being actually instantiated
during compilation. Well, I had deliberately moved a whole lot of code from
the UserControl_Initialize event to a procedure called Init - called from
the UserControl_ReadProperties and UserControl_InitProperties event
procedures - just for this reason. After some debugging, it looked as if
both the Initialize and Terminate events were working OK. During debugging,
I was getting (with ObjPtr(Me))
----> AUTOMATION ERROR
At which point, it told me that it couldn't load a temporary file, and would
ask me whether I wanted to continue. Saying yes at this point would cause
the same error to occur again:
----> AUTOMATION ERROR
(Obviously the Form, then the UserDocument).
If you subsequently tried to open the Form or the UserDocument, the
UserControl there would be an error message - the same one! - and then the
UserControl would have turned into a picture box.
Bizarrely, if you <didn't> open the Form or UserDocument again, you could
try to compile the project again - but this time it would work! But if you
ran the executable, then you would get an error:
"Run-time error '363':"
"ActiveX control 'PVResourceStringsViewer.XStrings' not referenced in this
project. Use Project/Components... to add a reference."
All this seemed to be a problem with CLSIDs, so I decided to remove Binary
Compatibility - and surprise! - the thing compiled:
Unfortunately, I cannot subsequently, whatever I do, compile with Binary
Can anybody help me?
Mark Alexander Bertenshaw
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL