Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to get pointers to every class in the project?

Status
Not open for further replies.

sulacco

Technical User
Nov 8, 2002
74
RU
Suppose I have some classes in Visual C++ project. And suppose I created
every last of them. In other words I created objects from those classes.
How can I get all poiters to those objects. While some objects were created
by Visual C++ internals so I don't know where they started.
I like to have those pointers in order to have complete control over those classes(which
after creation became objects :).
With respect. sulacco.
 
You are a little vague on your setup, so I don't know exactly what the problem is...

If you know the names of the variables you want access to, just declare them as extern in your files and you will be able to use them.
 
Well, I want pointers to all existed classes(objects) in
my project.
Something like I have pointer to document class like this.
Notice that document class accessed from View class!
Code:
void CMyTreeView::OnDraw(CDC* pDC)
{
	CSplitterDoc* pDoc = GetDocument();
       //now I can get every function and
       //every variable of Document class, see?
       pDoc->WhateverFuFunction();
       int go=pDoc->WhateverFuVar;

}
Something like this I want to have my hands on every
class. Like View, Frame and so on.
 
>I like to have those pointers in order to have complete control over those classes

Heh, right. Not all classes are for you to control.

For example, I would do my best to hinder fiddlers (like you?) to access my classes in ways they are not intended.

>Notice that document class accessed from View class!

That is because the doc is intended to be called from the views (and the views are also intended to be accessed frm the doc) and therefore every view holds a pointer to the doc.

You should learn the structure behind it all (what good is access to everything is you dont understand how everything interacts).





/Per

"It was a work of art, flawless, sublime. A triumph equaled only by its monumental failure."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top