[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 207
  • 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
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

Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

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