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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MDI Document´s data member

Status
Not open for further replies.

francisco

Programmer
Jun 20, 2000
8
DE
I´m writing a MDI aplication and I found that while trying to modify a Data Member I get an acces error during run time. For example I have my document class

class CMyDoc : CDocument
{
....
int m_nX;
void modify();
...
}

void modify()
{
m_nX = 10;
}

If I get the document object and I try to call to my function modify() then I get a message error. I´m a bit confused becouse the doesn´t happens in a SDI application. Thanks in advance.

Javi
 
Javi,

Not enough information... but your 'modify' function could be private or protected based on what you posted.

-pete
 
Hey, It´s funny becouse this function (modify()) is public. I give now all the information that I have about the program:

1.-Project built wit the Application Wizard, MDI with the normal classes and etc....
2.-I only modify the class document to introduce the member variable m_nX and the member function Modify(). Both are public.
3.-Then I create a menu command to make the call to Modify(), this is a command member function of the CMainFrame Class (OnTest())

I build my project without problems, I run the program and when I execute the program and make the call to the menu command then program ends with an error message "0x0000005 Acces Violation"

Thanks in advance

javi

ps.- Hey Palbano, I would like to thank you specially for your support so it´s much nicer to program without feeling alone against the problems that are always waiting for the unexperted programers as I am.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top