Quote Originally Posted by Alexeyn View Post
comletely wrong unless you mean static variables
Instead of trying to acces private variables of another class
better try to obtain current object of that class and invoke it's(public) functons

//CClass.cpp
...

//Main.cpp global scope ,CClass.h included
CClass cl;
...

//CClassZ.cpp
#include "CClass.h"
extern CClass cl;

CClassZ::Somestuff()
{
cl.whatsoever
}

BUT you cant do it this way with MFC dialogs(coz CDialog-derived constructor does need intra-instance stuff and fails at global scope)
so..
//CDialClass.cpp
...

//Main.cpp global scope ,CDialClass.h included
HWND hd;

CDialApp::InitInstance()
{
CDialClass cl;
...
//after cl window is created somehow
hd=cl.m_hWnd;
//you can do this also inside CDialClass ithelf with hd=this->m_hWnd;
}
...

//CDialClassZ.cpp
#include "CDialClass.h"
extern HWND hd;

CClassZ::Somestuff()
{
//hard
((CDialClass *)CDialog::FromHandle(hd))->whatsoever;
}
The more you add the worse it gets. I really can't even tell what you're trying to say here, how it helps the OP, or how it's an improvement over the previous answers.