Click here to Skip to main content
15,901,035 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: can we make class cant be derived at all? Pin
Richard MacCutchan24-Oct-09 7:15
mveRichard MacCutchan24-Oct-09 7:15 
GeneralRe: can we make class cant be derived at all? Pin
Rajesh R Subramanian24-Oct-09 7:38
professionalRajesh R Subramanian24-Oct-09 7:38 
AnswerRe: can we make class cant be derived at all? Pin
Rajesh R Subramanian23-Oct-09 19:31
professionalRajesh R Subramanian23-Oct-09 19:31 
AnswerRe: can we make class cant be derived at all? Pin
Kushagra Tiwari23-Oct-09 21:33
Kushagra Tiwari23-Oct-09 21:33 
AnswerRe: can we make class cant be derived at all? [modified] Pin
Nuri Ismail23-Oct-09 22:27
Nuri Ismail23-Oct-09 22:27 
Questionscanner Driver Pin
randydom23-Oct-09 11:03
randydom23-Oct-09 11:03 
QuestionRe: scanner Driver Pin
NitinMakwana8-Jan-10 1:10
NitinMakwana8-Jan-10 1:10 
QuestionMemory Leak Pin
BarryPearlman23-Oct-09 10:51
BarryPearlman23-Oct-09 10:51 
I am attempting to write an application in VC 2008 under Vista 64. In the application, I create a Class and a pointer; the pointer is cast (void) and held in a map.

<CMap<int, int, void*, void*> myMap

m_pClassXYZ = new ClassXYZ;
m_pClassXYZ->Create(NULL, NULL, WS_CHILD, CRect(0, 0, 0, 0), this, nClsID, NULL);
p_vPtr = (void*)m_pClassXYZ;

//Note: Map holds pointers to multiple classes of different types and hence is cast void.

pmyMap->SetAt(n, p_vPtr);

When I want to use the pointer, it is cast back:

m_pClassXYZ = (ClassXYZ*)p_vPtr;

This seems to compile, link and execute without incident. On exit the application I want to destroy the Class(es) and free the memory:

m_pClassXYZ->DestroyWindow();
delete m_pClassXYZ;

The appropriate DLL's are part of the project and allow memory leak checking. I get the following in the Output pane when the application exits:

c:\..................\MyApp.cpp(164) : {192} client block at 0x00098F60, subtype c0,
88 bytes long. a ClassXYZ object at $00098F60, 88 bytes long

When I click on the leak statement, it takes me to the line with the "new" operator.

I understand the leak statement, just not why. I think that this worked in previous versions of Visual Studio.

Am I not destroying the class and freeing memory properly? If not, can someone please give me an idea of what I am doing wrong?

Thanks,

Barry
AnswerRe: Memory Leak Pin
«_Superman_»23-Oct-09 12:21
professional«_Superman_»23-Oct-09 12:21 
AnswerRe: Memory Leak Pin
BarryPearlman25-Oct-09 3:56
BarryPearlman25-Oct-09 3:56 
GeneralRe: Memory Leak Pin
«_Superman_»25-Oct-09 8:43
professional«_Superman_»25-Oct-09 8:43 
AnswerRe: Memory Leak Pin
PJ Arends23-Oct-09 12:37
professionalPJ Arends23-Oct-09 12:37 
GeneralRe: Memory Leak Pin
BarryPearlman23-Oct-09 15:12
BarryPearlman23-Oct-09 15:12 
Questionint treated as binary no. Pin
Manmohan2923-Oct-09 10:41
Manmohan2923-Oct-09 10:41 
AnswerRe: int treated as binary no. Pin
David Crow23-Oct-09 10:45
David Crow23-Oct-09 10:45 
GeneralRe: int treated as binary no. Pin
Manmohan2923-Oct-09 10:58
Manmohan2923-Oct-09 10:58 
AnswerRe: int treated as binary no. Pin
David Crow23-Oct-09 11:04
David Crow23-Oct-09 11:04 
GeneralRe: int treated as binary no. Pin
Manmohan2923-Oct-09 11:16
Manmohan2923-Oct-09 11:16 
GeneralRe: int treated as binary no. Pin
David Crow23-Oct-09 15:08
David Crow23-Oct-09 15:08 
QuestionScrollbars are shown incorrectly. Pin
Nikz223-Oct-09 10:01
Nikz223-Oct-09 10:01 
AnswerRe: Scrollbars are shown incorrectly. [modified] Pin
Nikz223-Oct-09 12:17
Nikz223-Oct-09 12:17 
GeneralRe: Scrollbars are shown incorrectly. Pin
«_Superman_»23-Oct-09 12:31
professional«_Superman_»23-Oct-09 12:31 
GeneralRe: Scrollbars are shown incorrectly. Pin
Nikz223-Oct-09 12:53
Nikz223-Oct-09 12:53 
GeneralRe: Scrollbars are shown incorrectly. Pin
«_Superman_»23-Oct-09 13:01
professional«_Superman_»23-Oct-09 13:01 
GeneralSolution Pin
Nikz223-Oct-09 14:07
Nikz223-Oct-09 14:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.