Click here to Skip to main content
15,558,352 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Question__debugbreak(); [modified] Pin
Mohibur Rashid17-Jun-11 19:07
professionalMohibur Rashid17-Jun-11 19:07 
AnswerRe: __debugbreak(); Pin
Richard MacCutchan17-Jun-11 23:48
mveRichard MacCutchan17-Jun-11 23:48 
AnswerRe: __debugbreak(); Pin
Mohibur Rashid18-Jun-11 0:04
professionalMohibur Rashid18-Jun-11 0:04 
GeneralRe: __debugbreak(); Pin
Philippe Mori18-Jun-11 6:17
Philippe Mori18-Jun-11 6:17 
Question[Win32]Set Dialog Bitmap Background Pin
Member 296547117-Jun-11 14:20
Member 296547117-Jun-11 14:20 
AnswerRe: [Win32]Set Dialog Bitmap Background Pin
Cheongwadae17-Jun-11 15:34
Cheongwadae17-Jun-11 15:34 
GeneralRe: [Win32]Set Dialog Bitmap Background Pin
Ram Shelke17-Jun-11 23:09
Ram Shelke17-Jun-11 23:09 
AnswerRe: [Win32]Set Dialog Bitmap Background Pin
enhzflep18-Jun-11 4:05
enhzflep18-Jun-11 4:05 
Hi, I seem to remember trying this in the past, though failed miserably (presumably for the same reason) I recall using a frame based window, since I could define the background image (as a HBRUSH) in the windows class (ms class, not c++ class)

Anyhow, I just ad a few fresh ideas and seem to have resolved the issue. I'll admit I didn't try with a bmp, but since trying to paint a solid color resulted in the same behaviour, I'll (perhaps foolishly?) assume that the solution would be valid if I had.
[EDIT: yup - it works just fine with a bitmap too]

It's just a simple matter of calling InvalidateRect along with the hWnd of the dialog, the client area (or NULL for all of it) and False - for do not redraw.

I.e, just add the line
InvalidateRect(hwndDlg, NULL, false);

after you've done the clean-up and before you return true.

Something like so:
case WM_ERASEBKGND:
{
    HDC memDC, hdc;
    HBITMAP hBmp;
    BITMAP bmp;
    RECT rcc;

    hdc = GetDC(hwndDlg);
    hBmp = LoadBitmap(hInst, MAKEINTRESOURCE(IDB_BITMAP1));

    memDC = CreateCompatibleDC(hdc);

    SelectObject(memDC,hBmp);
    GetObject(hBmp, sizeof(bmp), &bmp);
    GetClientRect(hwndDlg,&rcc);

    SetStretchBltMode(hdc, HALFTONE);
    StretchBlt(hdc, 0,0, rcc.right,rcc.bottom, memDC, 0,0,bmp.bmWidth, bmp.bmHeight, SRCCOPY);

    DeleteDC(memDC);
    DeleteObject(hBmp);
    ReleaseDC(hwndDlg,hdc);
    InvalidateRect(hwndDlg, NULL, false);

return (INT_PTR)TRUE;
}

QuestionError 2248: cannot access protected member declared in CWinapp Pin
eastman7517-Jun-11 9:23
eastman7517-Jun-11 9:23 
QuestionRe: Error 2248: cannot access protected member declared in CWinapp Pin
Abhi Lahare17-Jun-11 9:36
Abhi Lahare17-Jun-11 9:36 
AnswerRe: Error 2248: cannot access protected member declared in CWinapp Pin
eastman7521-Jun-11 20:23
eastman7521-Jun-11 20:23 
AnswerRe: Error 2248: cannot access protected member declared in CWinapp Pin
Albert Holguin17-Jun-11 9:44
professionalAlbert Holguin17-Jun-11 9:44 
GeneralRe: Error 2248: cannot access protected member declared in CWinapp Pin
eastman7517-Jun-11 23:10
eastman7517-Jun-11 23:10 
GeneralRe: Error 2248: cannot access protected member declared in CWinapp Pin
Richard MacCutchan17-Jun-11 23:52
mveRichard MacCutchan17-Jun-11 23:52 
GeneralRe: Error 2248: cannot access protected member declared in CWinapp Pin
Albert Holguin18-Jun-11 7:38
professionalAlbert Holguin18-Jun-11 7:38 
GeneralRe: Error 2248: cannot access protected member declared in CWinapp Pin
eastman7519-Jun-11 6:01
eastman7519-Jun-11 6:01 
GeneralRe: Error 2248: cannot access protected member declared in CWinapp Pin
eastman7520-Jun-11 6:39
eastman7520-Jun-11 6:39 
GeneralRe: Error 2248: cannot access protected member declared in CWinapp Pin
Albert Holguin20-Jun-11 8:25
professionalAlbert Holguin20-Jun-11 8:25 
AnswerRe: Error 2248: cannot access protected member declared in CWinapp Pin
eastman7520-Jun-11 19:34
eastman7520-Jun-11 19:34 
QuestionUnresolved external Symbol Pin
William Engberts17-Jun-11 5:14
William Engberts17-Jun-11 5:14 
AnswerRe: Unresolved external Symbol Pin
Albert Holguin17-Jun-11 5:16
professionalAlbert Holguin17-Jun-11 5:16 
GeneralRe: Unresolved external Symbol Pin
William Engberts17-Jun-11 5:20
William Engberts17-Jun-11 5:20 
GeneralRe: Unresolved external Symbol Pin
Albert Holguin17-Jun-11 5:25
professionalAlbert Holguin17-Jun-11 5:25 
GeneralRe: Unresolved external Symbol Pin
MicroVirus17-Jun-11 5:26
MicroVirus17-Jun-11 5:26 
GeneralRe: Unresolved external Symbol Pin
William Engberts17-Jun-11 5:30
William Engberts17-Jun-11 5:30 

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.