Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2004-04-08
2
Medium Priority
?
378 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 2000 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

916 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