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 7401823
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T04:34:41+00:00 2026-05-29T04:34:41+00:00

I am developing ATL project. Some interfaces contain arguments to pass the various pointers.

  • 0

I am developing ATL project. Some interfaces contain arguments to pass the various pointers. Here is my IDL file:

import "oaidl.idl";
import "ocidl.idl";
[
    object,
    uuid(618E64F5-676B-4A13-A513-DE3D4097294A),
    dual,
    nonextensible,
    helpstring("IMyObject Interface"),
    pointer_default(unique)
]
interface IMyObject : IDispatch{
    [id(1), helpstring("method Make")] HRESULT Make(DWORD type, LPVOID settings);
    [id(2), helpstring("method Deserialize")] HRESULT Deserialize(LPVOID dataPtr, DWORD dataSize);
};
[
    uuid(E57065B4-498F-4347-9ACC-A2C86A771720),
    version(1.0),
    helpstring("TestComVoid 1.0 Type Library")
]
library TestComVoidLib
{
    importlib("stdole2.tlb");
    [
        uuid(1DC2528B-EA49-4F89-BB56-B1D667379644),
        helpstring("MyObject Class")
    ]
    coclass MyObject
    {
        [default] interface IMyObject;
    };
};

The first method of IMyObject constructs an object based on the type and the corresponding structure. The second method constructs an object based on binary data.

But I get error MIDL2139 : type of the parameter cannot derive from void or void *

In addition, I want to make a C# wrapper with IntPtr arguments to pass pointers. (“Add reference”->COM->”TestComVoid 1.0 Type Library”)

I tried to use INT_PTR instead of LPVOID, then I get int instead of IntPtr.
I tried to use DWORD_PTR instead of LPVOID, then I get uint instead of IntPtr.
I tried to use VARIANT instead of LPVOID, then I get Object instead of IntPtr.

How to correctly pass pointers to these cases?

  • 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-29T04:34:42+00:00Added an answer on May 29, 2026 at 4:34 am

    I found the solution. It need use a local attribute for those methods. Here it is:

    [
        object,
        uuid(618E64F5-676B-4A13-A513-DE3D4097294A),
        dual,
        nonextensible,
        helpstring("IMyObject Interface"),
        pointer_default(unique)
    ]
    interface IMyObject : IDispatch{
        [id(1), helpstring("method Make"), local] HRESULT Make(DWORD type, LPVOID settings);
        [id(2), helpstring("method Deserialize"), local] HRESULT Deserialize(LPVOID dataPtr, DWORD dataSize);
    };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Developing a project of mine I realize I have a need for some level
I'm developing a small ATL DLL file in Windows/Visual Studio IDE, and I'm relatively
Developing a series of POCOs on my project, and just realized that some of
Developing search utility to search a file entire computer system, works fine on windows
developing an application in Access. The access file will be located on a db
After developing in VS.NET for many years, I'm starting to do some Xcode development
When developing Flex projects, Eclipse gives warnings about the default index.html file generated by
When developing WebForms web site, I start my project once, Cassini loads and stays
Developing a module for drupal and I need to pass/modify variables within functions. I
After developing mini project with WCF duplex (Chat Service | Sms Service), I got

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.