Click here to Skip to main content
15,917,329 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Can Debugger show the values in binary form? Pin
CPallini1-Jan-09 10:32
mveCPallini1-Jan-09 10:32 
QuestionApplication working fine but seems like system has hanged Pin
VCProgrammer31-Dec-08 20:01
VCProgrammer31-Dec-08 20:01 
AnswerRe: Application working fine but seems like system has hanged Pin
Joseph Marzbani31-Dec-08 20:14
Joseph Marzbani31-Dec-08 20:14 
AnswerRe: Application working fine but seems like system has hanged Pin
Jijo.Raj1-Jan-09 0:13
Jijo.Raj1-Jan-09 0:13 
Questioncheckbox in List control and image Pin
vicky0000031-Dec-08 18:32
vicky0000031-Dec-08 18:32 
AnswerRe: checkbox in List control and image Pin
Nibu babu thomas31-Dec-08 23:22
Nibu babu thomas31-Dec-08 23:22 
GeneralRe: checkbox in List control and image Pin
vicky000001-Jan-09 17:45
vicky000001-Jan-09 17:45 
QuestionAccess Violation 0xC0000005 Pin
whiteclouds31-Dec-08 18:14
whiteclouds31-Dec-08 18:14 
Hi all!
I'm developing an console application with MFC support. Now I meet an exception when I execute the following code:
    CBitmap 	*bitmap;
    CDC 		memDC;
    CRect		rect;
    CWnd *pWnd=m_pWndHide;//->GetWindow(GW_HWNDFIRST);
//    CWindowDC	dc(pWnd);

    memDC.CreateCompatibleDC(&m_hDC);//(&dc);

    // Calculate required height from specified width
    int height = CAH_glo_y * width / CAH_glo_x;

	bitmap = new CBitmap();
    //The next line will occur "Access Violation 0xC0000005"
    bitmap->CreateCompatibleBitmap(&m_hDC, width, height );//(&dc, width, height );
    CBitmap* pOldBitmap = memDC.SelectObject(bitmap);
    // using the current background colour (assume white for the moment)
    memDC.PatBlt(0, 0, width,height, WHITENESS);
    ...

I trace this error into a source file named SBHEAP.c in MFC then. The function stopped in is __sbh_alloc_block. The related code is following:
...
pEntry->pEntryNext = pHead->pEntryNext;
pEntry->pEntryPrev = pHead;
pHead->pEntryNext = pEntry;
pEntry->pEntryNext->pEntryPrev = pEntry;//Stop here
...

I watch the value of pHead->pEntryNext . It is NULL. So I can't access it. But I don't know why and how to resolve it.Confused | :confused: This code will be executed many times before. But it is wrong when the 3 times. If someone can tell me or give me some good advice, I will be very glad. Thanks!


Regards

whiteclouds
AnswerRe: Access Violation 0xC0000005 Pin
Nibu babu thomas31-Dec-08 23:16
Nibu babu thomas31-Dec-08 23:16 
GeneralRe: Access Violation 0xC0000005 Pin
whiteclouds1-Jan-09 12:46
whiteclouds1-Jan-09 12:46 
Questionprocessor affinity Pin
RomTibi31-Dec-08 13:49
RomTibi31-Dec-08 13:49 
AnswerRe: processor affinity Pin
Mark Salsbery31-Dec-08 15:22
Mark Salsbery31-Dec-08 15:22 
GeneralRe: processor affinity Pin
RomTibi1-Jan-09 2:55
RomTibi1-Jan-09 2:55 
Questionconversion problem Pin
wubousc31-Dec-08 10:17
wubousc31-Dec-08 10:17 
AnswerRe: conversion problem Pin
Rick York31-Dec-08 11:47
mveRick York31-Dec-08 11:47 
GeneralRe: conversion problem Pin
wubousc31-Dec-08 13:32
wubousc31-Dec-08 13:32 
QuestionHow to separate a specified number of Bits from a DWORD? Pin
Joseph Marzbani31-Dec-08 8:16
Joseph Marzbani31-Dec-08 8:16 
AnswerRe: How to separate a specified number of Bits from a DWORD? PinPopular
harold aptroot31-Dec-08 8:25
harold aptroot31-Dec-08 8:25 
AnswerRe: How to separate a specified number of Bits from a DWORD? Pin
Jijo.Raj31-Dec-08 11:54
Jijo.Raj31-Dec-08 11:54 
AnswerRe: How to separate a specified number of Bits from a DWORD? Pin
krmed31-Dec-08 14:12
krmed31-Dec-08 14:12 
GeneralRe: How to separate a specified number of Bits from a DWORD? Pin
Richard Andrew x641-Jan-09 6:52
professionalRichard Andrew x641-Jan-09 6:52 
QuestionStuck in ShowWindow Pin
dj440031-Dec-08 4:41
dj440031-Dec-08 4:41 
QuestionRe: Stuck in ShowWindow Pin
Mark Salsbery31-Dec-08 6:13
Mark Salsbery31-Dec-08 6:13 
AnswerRe: Stuck in ShowWindow Pin
led mike31-Dec-08 7:20
led mike31-Dec-08 7:20 
GeneralRe: Stuck in ShowWindow Pin
Mark Salsbery31-Dec-08 7:24
Mark Salsbery31-Dec-08 7:24 

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.