Registred DLL


I'm using VC60. How can I open registred DLL? DLL developed using VB.
Dumpbin shows (with "/exports"):
          1    0 00044B0A DllCanUnloadNow
          2    1 00044ADE DllGetClassObject
          3    2 00044AF4 DllRegisterServer
          4    3 00044AC8 DllUnregisterServer
CLSID is {0x3A62424F,0xE9D5,0x11D3,{0x9C,0x5A,0x00,0x20,0x18,0x8C,0xA3,0x65}}
How can I open this dll, get object and work with this object (call methods)?

Who is Participating?
Those exported functions are not used in our programs.They are called by system and tools.

After it gets registered.

To use it ,basically the process is as follows:

1) Call OleInitialize() or CoInitialize() from your program.

2) Use CoCreateInstance() to get the object's IUnknown interface. You'd specify the CLSID and IID.You can get from friendly name by using ) Use CLSIDFromProgID().

3) Then you can quiry interface you want by calling QueryInterface() function through IUnknown pointer or get it directly from 2)

4) Now,you can call functions you want throught interface pointers.

Hope helpful.

Free to ask.


mahnoAuthor Commented:
Adjusted points from 50 to 100
mahnoAuthor Commented:
Thanks Wyn,

Can U please clearify for me

In my Registry I have key:
(default) SomeName.clSomeName

(defoult) {3A62424F-E9D5-11D3-9C5A-0020188CA365}

In my program:

  HRESULT hResult;
  CLSID clsid = {0x3A62424F,0xE9D5,0x11D3,{0x9C,0x5A,0x00,0x20,0x18,0x8C,0xA3,0x65}};
  LPVOID *ppv = new (LPVOID);
  IID iid; //?What this?

  hResult = OleInitialize(NULL); //OK
  hResult = CoCreateInstance((REFCLSID)clsid, //Right?
            NULL, //Right?
            CLSCTX_LOCAL_SERVER, //Right?
            (REFIID)iid, //What this?
            ppv //Right?
Is it right?

And one more question:
How can I use CLSIDFromProgID()?
lpszProgID should contain "SomeName.clSomeName"?
Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

There is a much easier way to do this using classWizard which will create a wrapper class in your project:
1. Call up classWizard
2. Take "Add class"
3. Take "from a type library"
4. Navigate to your dll and hit enter on everything else.

This will create a new pair of files containing the new class.

Simply instantiate this class and call the member functions directly.
mahnoAuthor Commented:
Hi wardkd,

I try Ur method, It's create new class with my functions; But when I try to start this funstions nothing wrong. In generated source files there are no places where my DLL attaches (or CLSID?)

Why? May be I something forgot?
Or I need to attach DLL by myself?

To Wyn:
U can't tell me where I mistaken? Or put some code (may from Ur project)

ps: I want to know both methods (using CoCreateInstance() and using Class Wizard). I give points to you both.

->LPVOID *ppv = new (LPVOID);
IID iid; //?What this?
The IID structure is a GUID structure used to describe an identifier for a  interface.
Here is GUID structure:
typedef struct _GUID
    unsigned long        Data1;
    unsigned short       Data2;
    unsigned short       Data3;
    unsigned char        Data4[8];

->And one more question:
How can I use CLSIDFromProgID()?
lpszProgID should contain "SomeName.clSomeName"?
CLSIDFromProgID() looks up a CLSID in the registry, given a ProgID.

Here is signature:

  LPCOLESTR lpszProgID,  //Pointer to the ProgID
  LPCLSID pclsid         //Pointer to the CLSID

So you'd use it this way:

// Get the CLSID for the application.

//You should know the progid.      
wchar_t progid[] = L"Myapplication.version1" ;
      CLSID clsid ;
       CLSIDFromProgID(progid, &clsid) ;

//Here you get the clsid and you can use it in the CoCreateInstance().

mahno ,here is a sample I just rearrange to use a com object ,this com contains a class Iface which has two interface ,IX and IY.
Check it:


// Client.cpp

#include <iostream.h>
#include <objbase.h>

#include "Iface.h"

// {32bb8320-b41b-11cf-a6bb-0080c7b2d682}
const IID IID_IX =
      {0x32bb8320, 0xb41b, 0x11cf,
      {0xa6, 0xbb, 0x0, 0x80, 0xc7, 0xb2, 0xd6, 0x82}} ;

// {32bb8321-b41b-11cf-a6bb-0080c7b2d682}
const IID IID_IY =
      {0x32bb8321, 0xb41b, 0x11cf,
      {0xa6, 0xbb, 0x0, 0x80, 0xc7, 0xb2, 0xd6, 0x82}} ;

const CLSID CLSID_Iface =
      {0x0c092c21, 0x882c, 0x11cf,
      {0xa6, 0xbb, 0x0, 0x80, 0xc7, 0xb2, 0xd6, 0x82}} ;

// main function
int main()
      // Initialize COM Library
      CoInitialize(NULL) ;
      IX* pIX = NULL ;
//Here you get the IX pointer
HRESULT hr = ::CoCreateInstance(CLSID_Iface,
 (void**)&pIX) ;
// Use interface IX.
    pIX->Fx() ;          

//now,let's get the IY interface pointer
        IY* pIY = NULL ;
        hr = pIX->QueryInterface(IID_IY, (void**)&pIY) ;
//call IY functions

     pIY->Fy() ;       // Use interface IY.
  //You'd release them.      
            pIY->Release() ;
            pIX->Release() ;

      // Uninitialize COM Library
      CoUninitialize() ;

      return 0 ;


Sincerely hope above helpful.


mahnoAuthor Commented:
Thanks Win, thanks wardkd

My program works with both methods

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.