Writing ActiveX DLL in VB 2005

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Michael Powe

    #1

    Writing ActiveX DLL in VB 2005

    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
    "unidentifi ed 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

    --
    'cat' is not recognized as an internal or external command,
    operable program or batch file.
  • Cor Ligthert [MVP]

    #2
    Re: Writing ActiveX DLL in VB 2005

    Michael,

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

    Cor

    "Michael Powe" <michael+gnus@t rollope.org> schreef in bericht
    news:ur71747o7. fsf@trollope.or g...[color=blue]
    > 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
    > "unidentifi ed 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
    >
    > --
    > 'cat' is not recognized as an internal or external command,
    > operable program or batch file.[/color]


    Comment

    • Herfried K. Wagner [MVP]

      #3
      Re: Writing ActiveX DLL in VB 2005

      "Michael Powe" <michael+gnus@t rollope.org> schrieb:[color=blue]
      > 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.[/color]

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

      --
      M S Herfried K. Wagner
      M V P <URL:http://dotnet.mvps.org/>
      V B <URL:http://classicvb.org/petition/>

      Comment

      • Michel Posseth  [MCP]

        #4
        Re: Writing ActiveX DLL in VB 2005


        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]


        "Michael Powe" <michael+gnus@t rollope.org> schreef in bericht
        news:ur71747o7. fsf@trollope.or g...[color=blue]
        > 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
        > "unidentifi ed 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
        >
        > --
        > 'cat' is not recognized as an internal or external command,
        > operable program or batch file.[/color]


        Comment

        Working...