none
dll RRS feed

  • Question

  • I have a dll created by vb6, when I tried to add it as a reference to the VSTO project I got the below screenshot any advice?


    joseph fares

    Friday, April 26, 2013 6:51 AM

Answers

  • Hi Joe

    See this discussion. It appears that, depending on your dll, there are different solutions to the problem.

    http://social.msdn.microsoft.com/Forums/en-US/Vsexpressvcs/thread/c194f361-afcb-47ac-81e9-8be60cbc25a0

    Since this is a VB6 DLL are you using Windows 32-bit? I'm not sure a vb6 DLL can even be registered on Windows 64-bit...


    Cindy Meister, VSTO/Word MVP, my blog

    Friday, April 26, 2013 4:06 PM
    Moderator
  • Hi Cindy,
     
    It's not necessary to manually create a PIA, if a reference is added to the VB6 dll in the VS project a PIA is automatically created. I would sign and strong name the DLL before adding it as a reference, and also register it using regsvr32.
     
    That's about all I've ever had to do to add a reference to a VB6 dll to my .NET projects, VSTO or shared addin.
     
    As far as using the dll references, I have one VB6 dll called ButtonImageLoader.dll. It has a public class ButtonLoader. In C#, my code to load an instance of the dll class is this:
       
    ButtonImageLoader.ButtonLoader loader = new ButtonImageLoader.ButtonLoader();
     
    I can then call functions in the class like this:
     

    int pushImageReturn = loader.PushImageFileToClipboard(imageFilePath, oleColor, logFilePath);

    ButtonLoader is the name of a class in the VB6 project, with a Public Function PushImageFileToClipboard().
     
    The class is set for MultiUse Instancing, and is set as Persistable == NotPersistable, and MTSTransactionMode == NotAnMTSObject. The DLL project is set to compile as an ActiveX DLL, with apartment threading, unattended execution, upgrade ActiveX controls, and Retained in memory.
     
    --
    Ken Slovak
    [MVP-Outlook]
    http://www.slovaktech.com
    Author: Professional Programming Outlook 2007
    "Cindy Meister MVP" <=?utf-8?B?Q2luZHkgTWVpc3RlciBNVlA=?=> wrote in message news:960723af-22b3-4723-bc8f-56f08c939c54...

    Hi Joseph

    Well, you don't really give us a lot of information (version of Windows, for example). It also appears that the issue isn't so much VSTO as a question of accessing a VB6 DLL from within the .NET Framework, which means (as you've seen) that not a lot of people here have experience with this scenario...

    I guess we need to take a step back and ask you if you've actually installed this VB6 application on your development machine and confirmed that it functions correctly, outside of trying to use it in the .NET Framework? Can you reference it from a VBA project, for example?

    In earlier versions of Windows the necessary runtimes for classic VB applications were included with Windows. This isn't the case in more recent versions (although I can't tell you which ones, as I was never a VB6 programmer, only a "dabbler"). It's possible that the support structures for a VB6 dll aren't present on the machine. But you'd have to pursue this in another forum. I don't think there are any forums for this on MSDN, either, as the VB6 technology has been deprecated for quite some time... You might try asking in the "Where is the forum for..." forum.


    Cindy Meister, VSTO/Word MVP, my blog


    Ken Slovak MVP - Outlook
    Wednesday, May 1, 2013 2:08 PM
  • It looks like the NNTP bridge isn't posting messages again, here's what I had posted:

    Hi Cindy,
     
    It's not necessary to manually create a PIA, if a reference is added to the VB6 dll in the VS project a PIA is automatically created. I would sign and strong name the DLL before adding it as a reference, and also register it using regsvr32.
     
    That's about all I've ever had to do to add a reference to a VB6 dll to my .NET projects, VSTO or shared addin.
     
    As far as using the dll references, I have one VB6 dll called ButtonImageLoader.dll. It has a public class ButtonLoader. In C#, my code to load an instance of the dll class is this:
       
    ButtonImageLoader.ButtonLoader loader = new ButtonImageLoader.ButtonLoader();
     
    I can then call functions in the class like this:
     

    int

    pushImageReturn = loader.PushImageFileToClipboard(imageFilePath, oleColor, logFilePath);
    ButtonLoader is the name of a class in the VB6 project, with a Public Function PushImageFileToClipboard().
     
    The class is set for MultiUse Instancing, and is set as Persistable == NotPersistable, and MTSTransactionMode == NotAnMTSObject. The DLL project is set to compile as an ActiveX DLL, with apartment threading, unattended execution, upgrade ActiveX controls, and Retained in memory.
     

    Ken Slovak MVP - Outlook

    Wednesday, May 1, 2013 8:26 PM
  • Hi Ken

    <<It's not necessary to manually create a PIA, if a reference is added to the VB6 dll in the VS project a PIA is automatically created. I would sign and strong name the DLL before adding it as a reference, and also register it using regsvr32.>>

    Well, it's an IA, not a PIA, but yes, normally that ought to be enough. No idea, though, why nothing seems to work for the OP...


    Cindy Meister, VSTO/Word MVP, my blog

    Thursday, May 2, 2013 5:27 AM
    Moderator

All replies

  • Hi Joe

    Did you use tlbImp.exe to create a set of IAs (Interop Assemblies) for your COM DLL? .NET Code can't communicate directly with COM DLLs, a "translator" (IA) is required. The tool tlbImp.exe can do this for you, then you reference the IAs in your project, not the original DLL.


    Cindy Meister, VSTO/Word MVP, my blog

    Friday, April 26, 2013 6:58 AM
    Moderator
  • As far as I know, when you use the add reference by using "add reference" dialog of VS into VSTO project, the VS will convert the COM dll to Interop Assembly and the VSTO project will reference the Intserop Assembly(with interop.XXX). So I think this issue isn't because of IA which Cindy said.

    I suggest that you should register the dll into your OS, you should note the version information, For the steps which lead to register a dll, you can refer to the below thread:

    How do I register a DLL on Windows 7 64-bit?


    If my post is helpful,please help to vote as helpful, if my post solve your question, please help to make it as answer. my sample

    Friday, April 26, 2013 8:52 AM
  • hi cindy, thanks for your reply but could you help me with the steps to do this? many thanks

    joseph fares

    Friday, April 26, 2013 3:28 PM
  • hi thanks for your help i tried what you said but it didnt work any other advice?

    to be more specific i got this error:


    joseph fares


    • Edited by jfares Friday, April 26, 2013 3:37 PM
    Friday, April 26, 2013 3:29 PM
  • Hi Joe

    See this discussion. It appears that, depending on your dll, there are different solutions to the problem.

    http://social.msdn.microsoft.com/Forums/en-US/Vsexpressvcs/thread/c194f361-afcb-47ac-81e9-8be60cbc25a0

    Since this is a VB6 DLL are you using Windows 32-bit? I'm not sure a vb6 DLL can even be registered on Windows 64-bit...


    Cindy Meister, VSTO/Word MVP, my blog

    Friday, April 26, 2013 4:06 PM
    Moderator
  • Hi 

    you can see the below discussion, it appear that.

    using vb6 dll in .net desktop application on 64 bit windows 7

    VB6 Application running on Windows 7 64-bit

    Now  the VB6 has no longer been supported. But or more information about Visual Basic 6 supportability, visit the following MSDN webpage:

    Support Statement for Visual Basic 6.0 on Windows Vista, Windows Server 2008, Windows 7, and Windows 8

     this article said that 

    Visual Basic 6.0 runtime files are 32-bit. These files ship in 64-bit Windows Operating Systems referenced in the table below. 32-bit VB6 applications and components are supported in the WOW emulation environment only. 32-bit components must also be hosted in 32-bit application processes.

    The Visual Basic 6.0 IDE has never been offered in a native 64-bit version, nor has the 32-bit IDE been supported on 64-bit Windows. VB6 development on 64-bit Windows or any native architecture other than 32-bit is not and will not be supported.



    If my post is helpful,please help to vote as helpful, if my post solve your question, please help to make it as answer. my sample

    Friday, April 26, 2013 5:10 PM
  • hi cindy,

    I am using Windows 32-bit.

    but still cant find a way to work this out


    joseph fares

    Monday, April 29, 2013 8:37 AM
  • Hi Joseph

    Well, you don't really give us a lot of information (version of Windows, for example). It also appears that the issue isn't so much VSTO as a question of accessing a VB6 DLL from within the .NET Framework, which means (as you've seen) that not a lot of people here have experience with this scenario...

    I guess we need to take a step back and ask you if you've actually installed this VB6 application on your development machine and confirmed that it functions correctly, outside of trying to use it in the .NET Framework? Can you reference it from a VBA project, for example?

    In earlier versions of Windows the necessary runtimes for classic VB applications were included with Windows. This isn't the case in more recent versions (although I can't tell you which ones, as I was never a VB6 programmer, only a "dabbler"). It's possible that the support structures for a VB6 dll aren't present on the machine. But you'd have to pursue this in another forum. I don't think there are any forums for this on MSDN, either, as the VB6 technology has been deprecated for quite some time... You might try asking in the "Where is the forum for..." forum.


    Cindy Meister, VSTO/Word MVP, my blog

    Wednesday, May 1, 2013 4:51 AM
    Moderator
  • Hi Cindy,
     
    It's not necessary to manually create a PIA, if a reference is added to the VB6 dll in the VS project a PIA is automatically created. I would sign and strong name the DLL before adding it as a reference, and also register it using regsvr32.
     
    That's about all I've ever had to do to add a reference to a VB6 dll to my .NET projects, VSTO or shared addin.
     
    As far as using the dll references, I have one VB6 dll called ButtonImageLoader.dll. It has a public class ButtonLoader. In C#, my code to load an instance of the dll class is this:
       
    ButtonImageLoader.ButtonLoader loader = new ButtonImageLoader.ButtonLoader();
     
    I can then call functions in the class like this:
     

    int pushImageReturn = loader.PushImageFileToClipboard(imageFilePath, oleColor, logFilePath);

    ButtonLoader is the name of a class in the VB6 project, with a Public Function PushImageFileToClipboard().
     
    The class is set for MultiUse Instancing, and is set as Persistable == NotPersistable, and MTSTransactionMode == NotAnMTSObject. The DLL project is set to compile as an ActiveX DLL, with apartment threading, unattended execution, upgrade ActiveX controls, and Retained in memory.
     
    --
    Ken Slovak
    [MVP-Outlook]
    http://www.slovaktech.com
    Author: Professional Programming Outlook 2007
    "Cindy Meister MVP" <=?utf-8?B?Q2luZHkgTWVpc3RlciBNVlA=?=> wrote in message news:960723af-22b3-4723-bc8f-56f08c939c54...

    Hi Joseph

    Well, you don't really give us a lot of information (version of Windows, for example). It also appears that the issue isn't so much VSTO as a question of accessing a VB6 DLL from within the .NET Framework, which means (as you've seen) that not a lot of people here have experience with this scenario...

    I guess we need to take a step back and ask you if you've actually installed this VB6 application on your development machine and confirmed that it functions correctly, outside of trying to use it in the .NET Framework? Can you reference it from a VBA project, for example?

    In earlier versions of Windows the necessary runtimes for classic VB applications were included with Windows. This isn't the case in more recent versions (although I can't tell you which ones, as I was never a VB6 programmer, only a "dabbler"). It's possible that the support structures for a VB6 dll aren't present on the machine. But you'd have to pursue this in another forum. I don't think there are any forums for this on MSDN, either, as the VB6 technology has been deprecated for quite some time... You might try asking in the "Where is the forum for..." forum.


    Cindy Meister, VSTO/Word MVP, my blog


    Ken Slovak MVP - Outlook
    Wednesday, May 1, 2013 2:08 PM
  • It looks like the NNTP bridge isn't posting messages again, here's what I had posted:

    Hi Cindy,
     
    It's not necessary to manually create a PIA, if a reference is added to the VB6 dll in the VS project a PIA is automatically created. I would sign and strong name the DLL before adding it as a reference, and also register it using regsvr32.
     
    That's about all I've ever had to do to add a reference to a VB6 dll to my .NET projects, VSTO or shared addin.
     
    As far as using the dll references, I have one VB6 dll called ButtonImageLoader.dll. It has a public class ButtonLoader. In C#, my code to load an instance of the dll class is this:
       
    ButtonImageLoader.ButtonLoader loader = new ButtonImageLoader.ButtonLoader();
     
    I can then call functions in the class like this:
     

    int

    pushImageReturn = loader.PushImageFileToClipboard(imageFilePath, oleColor, logFilePath);
    ButtonLoader is the name of a class in the VB6 project, with a Public Function PushImageFileToClipboard().
     
    The class is set for MultiUse Instancing, and is set as Persistable == NotPersistable, and MTSTransactionMode == NotAnMTSObject. The DLL project is set to compile as an ActiveX DLL, with apartment threading, unattended execution, upgrade ActiveX controls, and Retained in memory.
     

    Ken Slovak MVP - Outlook

    Wednesday, May 1, 2013 8:26 PM
  • Hi Ken

    <<It's not necessary to manually create a PIA, if a reference is added to the VB6 dll in the VS project a PIA is automatically created. I would sign and strong name the DLL before adding it as a reference, and also register it using regsvr32.>>

    Well, it's an IA, not a PIA, but yes, normally that ought to be enough. No idea, though, why nothing seems to work for the OP...


    Cindy Meister, VSTO/Word MVP, my blog

    Thursday, May 2, 2013 5:27 AM
    Moderator