DLL expertise required!

Hi everyone.

I have a problem I have been working on for about a week now, I came across it before.
Now bear with me as I might not have the correct terminology.

This is it.

I have an exe called RR5 which calls a DLL called RRCalc.

Now RRProjection is a ActiveX class, and is a collection of RRDataItem. It is used in RR5.

I also have a ActiveX DLL called RRCalc, which is passed a object of RRDataItem, among other properties and does some calculation, and then returns a RRDataItem.

The problem is that RR5 calls RRCalc, passes all the required properties, and then returns the RRDataItem.

It seems to work when I run the group of project, but when I compile everything and run it in its executable,
it comes up with

Error 429: ActiveX component cant create object.

Can any one help?


Who is Participating?
Vin32Connect With a Mentor Commented:
Hi kaiser18au,

Yes I mean a method there. The reason is very simple -- if you do this, you won't have to change your front end (the calling program).

And when I said change version no, I meant increment it.

Hope that solves your problem.
have you registered the ActiveX DLL

eg. run the following

"regsvr32 RRCalc.dll"
kaiser18auAuthor Commented:
Yes it has been registered, both RRCalc and the RRProjection.
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

Try this to see what "object" it thinks it can't create. This will help you pin down the problem at least...

Use this code to wrap your calls to CreateObject.  It will return the name of the object that could not be created.

Public Function fCreateObject(sID as String) as Object

On Error Goto ErrHhandler
Set fCreateObject = VBA.CreateObject(sID)
Exit Function

Err.Raise Err.Number, "fCreateObject", Err.Description & ": '" & sID & "'"
End Function
Also try this....

Try running it with one compiled the othe in VB, and swap - this should help pinpoint where the problem lies.
have you made references to the CALLED file (EXE or DLL) in Project->refrences of the CALLER project ?
besides - try to declare the CALLED object:
Private XY as SomeObject.clsSomeClass
 and when needed use :
Set XY=New SomeObject.SomeClass
XY.GO(passing params)
i would suggest a couple of things here:
1) go to project properties for the ActiveX DLL, go to the Compile tab, and set compatibility to None (do not select project/binary). Now compile and run again. it should work. if it still doesn't then go to (2).
2) put some output in each of the functions of the DLL saying that the function has been called. this would test whether the instance of the DLL is getting created or not. (Keep in No Compatibilty mode).

The compatibility decides the creation of GUID's for an ActiveX object.

Hope the info helps.
kaiser18auAuthor Commented:
Ok What about I tell you what I am trying to do, and maybe someone can suggest a work around for me.

I have the program RR5, and it does some heavy calculations. These calculations change very often, and every month I have to ship out a new copy to keep up with the changes.

I want to break up the component to DLL with no compatability so that I can upload the calculation components to my web site and people can down load just the calculation component.

The program with breaking it up is that the calcuations uses a class (RRProjections which is a collection of RRDataItem classes)

Is there anyway to do what I want to do?


in this case i would create a C written DLL that can be replaced when needed.
the declaration of that DLL in your VB application will be just as any API declaration and usage.
i've done that many times.
one thing i have not done is passing collections or class objects to C DLL as a parameter. i only use to pass common and regular variabels.
As far as i understand, your RRCalc DLL is the only one that is changing. If that is so, you could try the following:

keep one function in the dll which always has the same name and same parameters: this should always be the first one to be called.
this dll may call other functions/procedures with various parameters.
now you put all the calculations in the dll, change the calculations whenever you want, go to project properties and change the version number, and recompile it with no compatibilty.
now you just have to run
regsvr32 -u "path of DLL"
to uninstall the previous version.
then again run
regsvr32 "path of new DLL"
to install the new version .
that should do it.

if it doesn't work the first time, you could also try compiling with a new name for the class in the dll being called.
that helps sometimes -- it's got something to do with the creation of GUID's (once again!).

good luck.
kaiser18auAuthor Commented:
Hello Vin32

What you describe is exactly it. Only RRCalc changes.

You said in your comment that I have to change the version number, so what should i change it to?

The compatibilty is incorrect on the compiled versions.

Recompile in reverse order.

Also, make sure you have MDAC installed on the pc/workstation you are placing the activex components on.  Seems to fix this as well, if your compatibilty is set up correct.

kaiser18auAuthor Commented:
Tommy Boy, I have tried compiling in reverse order, but to no avail.

And AnswerTheMan, I cant write the program in C as I am not good enough to program in C for the DLL.

And Vin32
You said to keep one function with the same name and same parameters. Do you mean a method.

Is this problem common, and is it solvable most of the times?


kaiser18auAuthor Commented:

So you think what i am trying to do is achievable?
Changing the version number wont help.  Did you install MDAC?
kaiser18auAuthor Commented:
Hi Everyone,
I got it working.

It was a work around that I could live with.

I put the class RRProjection inside RRCalc, and set the compatibility to "Binary Compatability". But it took your expert comments for me to think of this work around. Thanks guys

I decided to give the pointes to Vin32 as his comments and suggestions had help pointed me into the right direction.

Thanks Again.


Told you it was a compatibilty problem

Thanks kaiser.
I am happy that your problem is ultimately solved.

All Courses

From novice to tech pro — start learning today.