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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T21:24:24+00:00 2026-05-17T21:24:24+00:00

I have a COM DLL (say, xyz.dll) coded in VC++. I want to create

  • 0

I have a COM DLL (say, xyz.dll) coded in VC++. I want to create a calling EXE application (calling.exe) which will call the functions of the COM DLL (xyz.dll).

I followed the steps in the link http://www.codeproject.com/kb/DLL/XDllPt1.aspx.
But I am not able to connect the DLL and EXE and hence not able to call the functions of the COM DLL. I am totally new to COM and VC++ programming. Can anyone kindly help me with.

I am using Visual Studio 2005.

These are the exact steps I followed——–

STEP 1: Created a solution having the DLL project (xyz.dll) project and a caller application Project (calling.exe) of template MFC Application (Dialog based). Made this calling.exe as the startup project..

STEP 2: Went to the properties by right clicking on the calling.exe Project in solution explorer. Configuration properties –> C/C++ –> General–> Additional Include Directives and added the path to the DLL Project..

Step 3: Again Right Click on the calling.exe application Project went to Properties–> Configuration properties –> Linker –> Input –> Additional Dependencies and added the path to the .Lib file for the built DLL Project.

STEP 4: Right click on calling.exe application Project, Properties –> Common Properties –> References –> Added reference to the DLL.

STEP 5: Copied the xyz.dll file to the application project directory.

STEP 6: My DLL has many header files and its corresponding source files. So, Added all the header files present in the DLL Project to my calling.exe application program. Within the OnInitDialog() function present in one of the .CPP program of the calling.exe application, I called the functions of DLL.

Just the statements

Cx objname;
objname.func();

Here Cx is the name of the class in the DLL.

I did not do any changes with the configuration settings of the EXISTING DLL project because it is The DLL which is already prepared by an expert and I am writing just the calling applaction to call the functions present in this DLL.

THANKS IN ADVANCE.

  • 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-17T21:24:24+00:00Added an answer on May 17, 2026 at 9:24 pm

    The instructions you’ve followed are for calling functions in an ordinary DLL, not a COM DLL. To access a COM DLL you need to go through COM.

    You don’t link to the DLL’s lib file or include any headers, and you don’t need to move the DLL.

    First, make sure the DLL is registered by running regsvr32 on it.

    regsvr32 "c:\..\..\xyz.dll" ; insert the correct path
    

    Then add an #import directive to your project’s stdafx.h, containing the path to the DLL.

    #import "c:\..\..\xyz.dll" // insert the correct path
    

    Right click stdafx.cpp in the file view and choose compile.
    This will generate the wrapper “smart pointer” classes you need to access your DLL.
    The smart pointer classes have the same names as the interfaces in your DLL, but with “Ptr” on the end.

    Look at the file with a .tlh extension and the same name as your DLL in your Debug directory. It begins with a C++ namespace declaration.
    This is the namespace in which the objects you are going to create from the DLL reside.

    Say the namespace is XYZ and you want to instantiate a Cx object, which exposes the Ix interface.
    You would do:

    try {
        XYZ::IxPtr obj;
        obj.CreateInstance(__uuidof(XYZ::Cx));
        obj->func();
    } catch (_com_error e) {
        printf("Error: %S\n", e.Description());
        printf("Error: %S\n", e.ErrorMessage());
    }
    

    You can then continue to use it just like an ordinary pointer.
    You don’t delete it when you have finished with it though, it will be destroyed automatically when it goes out of scope.

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

Sidebar

Related Questions

I have .NET 3.5 web application which uses some COM dll created in VB6.
I have a .NET COM DLL that I want to unregister. I do: regasm.exe
I want to create a COM dll that will take any Word file and
I have a win32 COM dll. I want to register this dll for different
I have an application written in PHP that uses a COM dll written in
I have a C++ dll which implements several COM interfaces, that I'm trying to
We have a COM dll written in delphi in our bin folder that call
I have a VB6 COM DLL. I want to use it from C++. I
I have a VB6 application that uses a COM DLL. The DLL is written
Lets say we have this scenario a setup that deploys a .net com dll

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.