Solved

Simple ATL question

Posted on 2000-03-01
9
168 Views
Last Modified: 2013-11-25
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
Comment
Question by:ekc
  • 3
  • 3
  • 2
  • +1
9 Comments
 
LVL 30

Expert Comment

by:Zoppo
ID: 2572458
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
 
LVL 4

Expert Comment

by:mandhjo
ID: 2573019
You can #import COM DLL and EXE files.  I am currently doing this on my project.
0
 
LVL 23

Expert Comment

by:naveenkohli
ID: 2573424
something like this ..

#import "my.dll" raw_interfaces_only, raw_native_types, no_namespace, named_guids
0
 
LVL 4

Expert Comment

by:mandhjo
ID: 2573504
only without the commas (syntactically speaking)
0
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 5

Author Comment

by:ekc
ID: 2576406
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
 
LVL 4

Expert Comment

by:mandhjo
ID: 2576723
Glad we could all help.  In my opinion, Zoppo gets the points.
0
 
LVL 30

Expert Comment

by:Zoppo
ID: 2579276
I agree                     :o)
0
 
LVL 5

Author Comment

by:ekc
ID: 2584070
I also agree.
Zoppo, please, lock the question.
0
 
LVL 30

Accepted Solution

by:
Zoppo earned 100 total points
ID: 2586739
ok

have a nice day,

ZOPPO
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now