Writing ActiveX DLL in VB 2005

M

Michael Powe

Hello,

I have an application that exposes a VB 6 ActiveX API. I can write
DLLs that plug into the application and add functionality to the
application. I write these DLLs by implementing an interface.

I have been doing this in VB 6. On initial review, it appears that it
should be possible to do it in VB 2005. I have actually successfully
implemented the interface and compiled a DLL. However, my application
fails to initialize the DLL.

I added a simple "on error goto" in order to try to get an error
written to the event log, but it does not fire.

Despite quite a bit of time spent googling, I can't get a clear
picture of what actually is necessary to get the COM API to interact
successfully with my "interop" code. In fact, I'm not even sure I'm
proceeding in the correct manner.

I implemented the interface in a class library, using a simple method
that just writes a log entry. I checked the box to make the class
library COM-visible. I strong-named the DLL. I compiled and copied
all the resulting files from the bin/Release directory to the
designated "plugins" directory of my application. I made the
necessary configuration modification to the application for it to
recognize the plugin.

I registered the DLL with regasm.

I also tried adding the DLL itself to the GAC. This failed with an
"unidentified error" using the gacutil.

All I'm getting from my application is "failed to initialize the
plugin."

I would appreciate some guidance as to how to achieve my goal, if it
even is possible. To restate: I want to write an ActiveX DLL in VB
2005 (using Express Edition) that will plug into my COM-based
application running on WinXP Pro.

Thanks for any help.

mp
 
C

Cor Ligthert [MVP]

Michael,

Did you set a reference to it using Project->Path->Com and select the dll?

Cor
 
H

Herfried K. Wagner [MVP]

Michael Powe said:
I have an application that exposes a VB 6 ActiveX API. I can write
DLLs that plug into the application and add functionality to the
application. I write these DLLs by implementing an interface.

I have been doing this in VB 6. On initial review, it appears that it
should be possible to do it in VB 2005. I have actually successfully
implemented the interface and compiled a DLL. However, my application
fails to initialize the DLL.

I added a simple "on error goto" in order to try to get an error
written to the event log, but it does not fire.

Despite quite a bit of time spent googling, I can't get a clear
picture of what actually is necessary to get the COM API to interact
successfully with my "interop" code. In fact, I'm not even sure I'm
proceeding in the correct manner.

I implemented the interface in a class library, using a simple method
that just writes a log entry. I checked the box to make the class
library COM-visible. I strong-named the DLL. I compiled and copied
all the resulting files from the bin/Release directory to the
designated "plugins" directory of my application. I made the
necessary configuration modification to the application for it to
recognize the plugin.

I registered the DLL with regasm.

Did you reference the DLL file or the TLB file from within your VB6
application?
 
M

Michel Posseth [MCP]

Michael

first of all i set all the attribute flags myself and do not rely on the IDE
doing this for me as my experience is that this sometimes goes wrong


but to get back to your problem a COM class must have a default constructor
without parameters

public sub new()
mybase.new
end sub

you probably forgot that ,, if you did you can see the interface but can`t
start it from VB6


regards

Michel Posseth [MCP]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top