• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 208
  • Last Modified:

Simple ATL question

What is the easiest way of reusing a COM component from ATL project?
I know only #import "component.tlb" method, but not always have corresponding type library. How can I generate it from DLL?

Apolo.
0
ekc
Asked:
ekc
  • 3
  • 3
  • 2
  • +1
1 Solution
 
ZoppoCommented:
Hi ekc,

this is from MSDN:
--------------------------------------------------------------------------------------
The #import Directive

The #import directive is used to incorporate information from a type library. The content of the type library is converted into C++ classes, mostly describing the COM interfaces.

Syntax:
#import "filename" [attributes]
#import <filename> [attributes]

attributes:
attribute1, attribute2, ...
attribute1 attribute2 ...

filename is the name of the file containing the type library information. A file can be one of the following types:

-a type library (.TLB or .ODL) file
-an executable (.EXE) file
-a library (.DLL) file containing a type library resource (such as .OCX)
....
--------------------------------------------------------------------------------------

so, I think (even I've never tried) that you can even use #import with dll-files.

hope that helps,

ZOPPO
0
 
mandhjoCommented:
You can #import COM DLL and EXE files.  I am currently doing this on my project.
0
 
naveenkohliCommented:
something like this ..

#import "my.dll" raw_interfaces_only, raw_native_types, no_namespace, named_guids
0
Take Control of Web Hosting For Your Clients

As a web developer or IT admin, successfully managing multiple client accounts can be challenging. In this webinar we will look at the tools provided by Media Temple and Plesk to make managing your clients’ hosting easier.

 
mandhjoCommented:
only without the commas (syntactically speaking)
0
 
ekcAuthor Commented:
Thank you all...
I thought that #import directive is the only solution (have never seen any simpler), and just wanted to be sure...
OLE/View can generate even .h i .c files (as well as .idl, which can be later used for building .tlb), but have never tried that...
0
 
mandhjoCommented:
Glad we could all help.  In my opinion, Zoppo gets the points.
0
 
ZoppoCommented:
I agree                     :o)
0
 
ekcAuthor Commented:
I also agree.
Zoppo, please, lock the question.
0
 
ZoppoCommented:
ok

have a nice day,

ZOPPO
0

Featured Post

Take Control of Web Hosting For Your Clients

As a web developer or IT admin, successfully managing multiple client accounts can be challenging. In this webinar we will look at the tools provided by Media Temple and Plesk to make managing your clients’ hosting easier.

  • 3
  • 3
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now