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!

Problems With MFC Control ...

Status
Not open for further replies.

daniloa

Programmer
Nov 23, 2001
27
BR
Hi every one, I'm very beginer C++ Developer and I have a problem developing a OCX control that I can't know what I have to do, this is:

I have a Function like: long PlayInteger(long pDev, long pNum) that was created with the class wizard.
but this function uses four other functions, that I cannot create in class wizard because are internal functions, Until Here OK, but inside these internal funcitons I need to use another function that was created with class wizard, it's more or less this:

long MyClass::FuncA(long pP1)
{ ... }

long MyClass::FuncB(long pP2)
{
...
Ret = FuncC(0);
...
}

long FuncC(long pP3)
{
...
Aux = FuncA(56);
...
}

when I complile I receive thi error message:
on this sample line "Aux = FuncA(56);"

D:\Temp\Testes\AlcUra\AlcUraCtl.cpp(807) : error C2065: 'TocaPromptA' : undeclared identifier

someone can help me ??

very thanks,

Danilo...
 
Before calling FuncA, create instance instMyClass of MyClass like MyClass* instMyClass and use instMyClass->FuncA
 
If you declare a pointer to your class, don't forget to use the 'new' and 'delete' operaters, otherwise referencing a null pointer will cause a runtime error:

MyClass* pMyClass;
pMyClass = new MyClass;
pMyClass->FuncA(x);
delete pMyClass;

A much simple solution is:

MyClass myclass;
myclass.FuncA(x);


This way, memory deallocation is done for you automatically when the myclass instance goes out of scope.
Phil
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top