Click here to Skip to main content
15,929,653 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: code to search in a text file Pin
CPallini3-Jun-07 3:52
mveCPallini3-Jun-07 3:52 
GeneralRe: code to search in a text file Pin
non light3-Jun-07 4:04
non light3-Jun-07 4:04 
GeneralRe: code to search in a text file Pin
Hans Dietrich3-Jun-07 4:19
mentorHans Dietrich3-Jun-07 4:19 
GeneralRe: code to search in a text file Pin
non light3-Jun-07 4:39
non light3-Jun-07 4:39 
GeneralRe: code to search in a text file Pin
Christian Graus3-Jun-07 11:22
protectorChristian Graus3-Jun-07 11:22 
GeneralRe: code to search in a text file Pin
CPallini3-Jun-07 10:16
mveCPallini3-Jun-07 10:16 
AnswerRe: code to search in a text file Pin
Hamid_RT3-Jun-07 7:33
Hamid_RT3-Jun-07 7:33 
QuestionHeap corruption. Pin
Polite Programmer3-Jun-07 1:26
Polite Programmer3-Jun-07 1:26 
I am writting a button control from scratch in pure C + Win32. I have a structure as under

<br />
typedef struct tagBUTTONINFO<br />
{<br />
   TCHAR * szText;<br />
   int iLenght;<br />
   COLORREF backColor<br />
   // Other memebers...<br />
} BUTTONINFO, * PBUTTONINFO;<br />


Now on each WM_NCCREATE, I use malloc() to allocate a BUTTONINFO and set its address in USERDATA of the HWND of the window. In each WM_SETTEXT, I allocate space for the text and set in the PBUTTONINFO->szText. On WM_NCDESTROY, I deallocate the space for BUTTONINFO and the BUTTONINFO::szText as well. But in debug sessions, I get Heap Corruption Error Message. Whats wrong?

However, if you use new and delete keywords for the same tasks, no such problem occurs... whats wrong and where?

Polite Programmer


More Object Oriented then C#

AnswerRe: Heap corruption. Pin
Gary R. Wheeler3-Jun-07 1:44
Gary R. Wheeler3-Jun-07 1:44 
GeneralRe: Heap corruption. Pin
Polite Programmer3-Jun-07 1:47
Polite Programmer3-Jun-07 1:47 
GeneralRe: Heap corruption. Pin
Polite Programmer3-Jun-07 1:57
Polite Programmer3-Jun-07 1:57 
GeneralRe: Heap corruption. Pin
Gary R. Wheeler3-Jun-07 1:59
Gary R. Wheeler3-Jun-07 1:59 
GeneralRe: Heap corruption. Pin
CPallini3-Jun-07 3:47
mveCPallini3-Jun-07 3:47 
AnswerRe: Heap corruption. Pin
Matthew Faithfull3-Jun-07 3:08
Matthew Faithfull3-Jun-07 3:08 
AnswerRe: Heap corruption. Pin
CPallini3-Jun-07 3:48
mveCPallini3-Jun-07 3:48 
AnswerRe: Heap corruption. Pin
Stephen Hewitt3-Jun-07 14:08
Stephen Hewitt3-Jun-07 14:08 
GeneralRe: Heap corruption. Pin
Polite Programmer3-Jun-07 20:00
Polite Programmer3-Jun-07 20:00 
GeneralRe: Heap corruption. Pin
Polite Programmer3-Jun-07 20:01
Polite Programmer3-Jun-07 20:01 
GeneralRe: Heap corruption. Pin
Stephen Hewitt3-Jun-07 20:05
Stephen Hewitt3-Jun-07 20:05 
Questionhelp with fstream Pin
anbluemoon3-Jun-07 1:24
anbluemoon3-Jun-07 1:24 
AnswerRe: help with fstream Pin
CPallini3-Jun-07 4:02
mveCPallini3-Jun-07 4:02 
QuestionDLL and EXE files Pin
prithaa3-Jun-07 0:43
prithaa3-Jun-07 0:43 
AnswerRe: DLL and EXE files Pin
Christian Graus3-Jun-07 1:14
protectorChristian Graus3-Jun-07 1:14 
GeneralRe: DLL and EXE files Pin
Rajesh R Subramanian3-Jun-07 20:43
professionalRajesh R Subramanian3-Jun-07 20:43 
QuestionRe: DLL and EXE files Pin
Matthew Faithfull3-Jun-07 1:18
Matthew Faithfull3-Jun-07 1:18 

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.