Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

A few simple ATL DLL Questions

Posted on 2003-12-05
2
Medium Priority
?
654 Views
Last Modified: 2013-12-14
Hi, a couple of questions relating to ATL (COM) DLL's.  I'm moving from MFC to ATL/WTL, so I'm having to get away from MFC Extension DLLs.  Basically, most of these relate to a replacement for my happy MFC Extension DLL way.

1) What is the (myproject)PS project?  What function does it serve, and when would I need to use it?

2) With an ATL COM DLL, is there a way to export a C++ Class (for example, a derivation of CWindowImpl) from the DLL?  If so, how; if not, is there an alternate way with a different type of dll?

3) With these COM objects and such, aren't all the methods to the interface exposed to anyone wanting to look at them? Is there a way to prevent this?


I'm very new to COM, but I fear it's something that will not go away.  Any tips would be *greatly* appreciated. :)  I'll split points if need be.

Thanks.
0
Comment
Question by:Shutterbug
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 49

Assisted Solution

by:DanRollins
DanRollins earned 200 total points
ID: 9887827
1) I don't know.  Where did you see it?  Provide a context.
2) Yes.  Use the ClassWizard to create and object publish its methods and properties via the IDL.  But it is probably easiest to just export normally, via a shared header (standad DLL exporting).
3) The direct interfaces... yes.  But let's say that the first parameter to a method is a long int.  Nobody knows that if that integer is set to 0x27856, the program performs some magic, undocumented operation.
-- Dan
0
 
LVL 9

Accepted Solution

by:
_ys_ earned 400 total points
ID: 9896083
1) This project allows you to compile a custom proxy/stub dll. If you don't know what these are, chances are you don't need them. Feel free to ignore this project.

2) As DanRollins pointed out, yes. But be careful. A COM dll can be unloaded by the COM runtime whenever it's not using it - this would result in some nasty dangling references to instances of your exported classes.

3) But this is one of the points to, and benefits of, COM - exposing objects via interfaces. If you do want to hide any interfaces, remove them from the IDL - thus excluding them from the type library. Of course, in this situation, you would have to declare those interfaces elsewhere.

struct IMyInterface
{
    __stdcall HRESULT myMethod1 ( ) = 0;
    __stdcall HRESULT myMethod2 (int) = 0;
};

// {XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}
const GUID IID_IMyInterface =
{ 0xXXXXXXXX, 0xXXXX, 0xXXXX, { 0xXX, 0xXX, 0xXX, 0xXX, 0xXX, 0xXX, 0xXX, 0xXX } };
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
For most people, the WrapPanel seems like a magic when they switch from WinForms to WPF. Most of us will think that the code that is used to write a control like that would be difficult. However, most of the work is done by the WPF engine, and the W…
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…

705 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