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
Solved

VC++ 6.0 - Delete a simple object from an ATL project.

Posted on 2004-04-08
2
349 Views
Last Modified: 2013-11-25
Is there a way to remove a simple object from an ATL project?

Currently I delete the .cpp & .h files and then cut the code from the .idl file.

Is there an easier way? Perhaps a reverse "New ATL Object" wizard.

Thanks
0
Comment
Question by:mmouer
2 Comments
 
LVL 14

Expert Comment

by:wayside
ID: 10785738
I don't know of an easier way.

It's a difficult task in general to automate, because you'd have to parse the code looking for all the references and somehow divine what to do. For example, if I have a function that takes a pointer to a class as an argument, and I delete the class, how do I automagically modify this function to still work? I don't think it is possible.

0
 
LVL 15

Accepted Solution

by:
lakshman_ce earned 500 total points
ID: 10786846
No automatic way to remove it.

If you don't want that object to be used from client side you can change the attributes of an ATL-based COM object so that the automation client cannot directly create the object. In this case, the object would be returned via a method call on another object rather than created directly.

To make an object noncreatable

Remove the OBJECT_ENTRY for the object from the ATL object map.
Add the noncreatable attribute to the co-class. For example:
[
uuid(A1992E3D-3CF0-11D0-826F-00A0C90F2851),
helpstring(MyObject),
  noncreatable
]
coclass MyObject
{
[default] interface IMyInterface;
}

-Lakshman
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

As more and more people are shifting to the latest .Net frameworks, the windows presentation framework is gaining importance by the day. Many people are now turning to WPF controls to provide a rich user experience. I have been using WPF controls fo…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
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…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…

809 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