Sign in to follow this  
sunilsin

VC++ problem

Recommended Posts

i have created VC++ Dialog based application and i have added one member variable in my application class(CXyzApp) now i want to access this vairable through my Dialog class(CXyxDlg) how to do it. Any one.

Share this post


Link to post
Share on other sites
Like you always do. Its no different from when you use classes in general. Just because its derived from a dialog class.

Either put a pointer to CXyzApp in your class or give it to your class when you construct it.

ie.


class CXyzDlg : public dialogclass
{
CXyzApp * mApp;

int getAppVar ( void ) {
return mApp->getVariable();
}
}

Share this post


Link to post
Share on other sites
Quote:
Original post by sunilsin
i did the same thing but i am getting error of Access voilation (0X000000c).


Then your pointer is not properly setup.
Most likely the pointer never get set before you call the function in the app class.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this