Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 504447
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T06:29:52+00:00 2026-05-13T06:29:52+00:00

I have an issue with a third-party COM+ DLL meant to be used from

  • 0

I have an issue with a third-party COM+ DLL meant to be used from VB6, where it has a function to set a Callback for a hardware event. However, I’m using VB.NET, and AddressOf now returns a reference type instead of an integral type, which means that the setCallback function on the COM+ DLL apparently can’t be used.

Is there a way around this problem (I don’t have VB6 available to develop some sort of wrapper with), or will I have to find a different 3rd-party DLL in order to get this to work? For reference, I’m trying to access the LCD on a Logitech G15(v2) keyboard.

For Reference, here is the setCallback function and the callback’s prototype itself:

Public Sub setCallback(funcAddr As Integer)
Public Sub LCDbuttonPress(ByVal butStates As Integer)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T06:29:53+00:00Added an answer on May 13, 2026 at 6:29 am

    I think if you declare your setCallback function like this:

    Public Sub setCallback([MarshalAs(UnmanagedType.FunctionPtr)]funcAddr as function)
    

    I’m not a VB guy, so I don’t know the exact syntax. But the basic idea here is that in VB.Net you declare the prototype as taking a delegate, even a delegate of the correct type. But then you use the MarshalAs attribute to tell the marshalling code to treat it as a function pointer (actually a Integer) on the other side. I do this in C# to pass callbacks to C++ code and it works just fine.

    For instance this in C#

    public delegate int MyProgress(double dPercentComplete);
    ...
    int WaitWithProgress([MarshalAs(UnmanagedType.FunctionPtr)]MyProgress pfn);
    

    Shows up on the C++ side of the house as this

    HRESULT __stdcall WaitWithProgress (long pfn, int * pRetVal);
    

    Note the comments. The actual solution to this problem turned out to be Marshal.GetFunctionPointerForDelegate() And be careful to read the docs on this. If you use this method, it becomes your responsibility to make sure that the delegate isn’t garbage collected before you setCallback(NULL)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have built ASP.NET app. I need to utilize a third party COM object
We have an issue using the PEAR libraries on Windows from PHP . Pear
I have an issue with using AWK to simply remove a field from a
I have a third party application that requires a 'POP 3 connection string'. I'd
I have just ported several of our home-made Outlook COM-addins from Delphi 2007 to
I have a third party encryption library, which may create a MessageBox if key
I have an issue that is driving me a bit nuts: Using a UserProfileManager
We have an issue related to a Java application running under a (rather old)
We have an issue on our page whereby the first time a button posts
I have some issue with a Perl script. It modifies the content of a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.