Click here to Skip to main content
15,034,986 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Adding Text to the Frame Of a Dialog Pin
jeron19-Aug-16 8:33
Memberjeron19-Aug-16 8:33 
GeneralRe: Adding Text to the Frame Of a Dialog Pin
ForNow9-Aug-16 13:07
MemberForNow9-Aug-16 13:07 
AnswerRe: Adding Text to the Frame Of a Dialog Pin
leon de boer9-Aug-16 19:05
Memberleon de boer9-Aug-16 19:05 
GeneralRe: Adding Text to the Frame Of a Dialog Pin
ForNow10-Aug-16 3:47
MemberForNow10-Aug-16 3:47 
SuggestionRe: Adding Text to the Frame Of a Dialog Pin
David Crow10-Aug-16 5:41
MemberDavid Crow10-Aug-16 5:41 
GeneralRe: Adding Text to the Frame Of a Dialog Pin
leon de boer10-Aug-16 17:07
Memberleon de boer10-Aug-16 17:07 
GeneralRe: Adding Text to the Frame Of a Dialog Pin
ForNow10-Aug-16 20:31
MemberForNow10-Aug-16 20:31 
GeneralRe: Adding Text to the Frame Of a Dialog Pin
leon de boer11-Aug-16 3:00
Memberleon de boer11-Aug-16 3:00 
GetDCEx expects a HRGN which as you said is in the wParam and gives you back the DC.
HDC hdc;
hdc = GetDCEx(hwnd, (HRGN)wParam, DCX_WINDOW|DCX_INTERSECTRGN);

Also remember that returned DC is a screen DC so you have to BitBlt the bitmap onto it to display anything, simply selecting the bitmap onto it will do nothing other than attach a pointer. The fact you got the white box makes me think you didn't do it right so lets give you the basics, which go like this

SETUP (usually in WM_INITDIALOG):
HBITMAP hBmp;  // This needs to be held somewhere for life of dialog or global
HDC hMemDC;  // This is  the same it needs to be held somewhere for life of dialog or global

hBmp = (HBITMAP) LoadImage(0, "SomeName.Bmp", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE); // Load bitmap file
hMemDC = CreateCompatibleDC(NULL);  // Create memory device context
if (hMemDC) SelectObject(hMemDC, hBmp); // Select the bitmap to any valid memory context

// Optional stuff you might want the loaded bitmap dimensions
BITMAP bm;
GetObject(hBmp, sizeof(bm), &bm); // Get object data
BmpWth = bm.bmWidth; // Get and hold bitmap width to some dialog life variable
BmpHt = bm.bmHeight; // Get and hold bitmap height to some dialog life variable


USE (NC_PAINT):
HDC hdc = GetDCEx(hwnd, (HRGN)wParam, DCX_WINDOW|DCX_INTERSECTRGN); // Get DC
BitBlt(hdc, ???, ???, BmpWth, BmpHt, hMemDC, 0, 0, SRCCOPY); // Transfer bitmap ... ??? are co-ords where to place 


CLEANUP (usually WM_DESTROY):
DeleteObject(hBmp); // Release loaded bitmap
DeleteDC(hMemDC); // Release the memory context created above


Finally if you want to add buttons etc there are a few more tricks and I will refer you to an article
Custom Titlebar | Catch22[^]
In vino veritas


modified 11-Aug-16 9:06am.

GeneralRe: Adding Text to the Frame Of a Dialog Pin
ForNow11-Aug-16 3:18
MemberForNow11-Aug-16 3:18 
GeneralRe: Adding Text to the Frame Of a Dialog Pin
ForNow11-Aug-16 2:58
MemberForNow11-Aug-16 2:58 
AnswerRe: Adding Text to the Frame Of a Dialog Pin
Richard MacCutchan9-Aug-16 20:49
mveRichard MacCutchan9-Aug-16 20:49 
Questionconst "getter" but updating on request? Pin
FriendOfAsherah8-Aug-16 21:20
MemberFriendOfAsherah8-Aug-16 21:20 
AnswerRe: const "getter" but updating on request? Pin
Jochen Arndt8-Aug-16 23:46
professionalJochen Arndt8-Aug-16 23:46 
GeneralRe: const "getter" but updating on request? Pin
FriendOfAsherah9-Aug-16 2:30
MemberFriendOfAsherah9-Aug-16 2:30 
GeneralRe: const "getter" but updating on request? Pin
Jochen Arndt9-Aug-16 3:03
professionalJochen Arndt9-Aug-16 3:03 
QuestionGrowing Pains Going from Debug to Release Pin
ForNow8-Aug-16 9:19
MemberForNow8-Aug-16 9:19 
AnswerRe: Growing Pains Going from Debug to Release Pin
CPallini8-Aug-16 20:31
mveCPallini8-Aug-16 20:31 
GeneralRe: Growing Pains Going from Debug to Release Pin
ForNow8-Aug-16 21:15
MemberForNow8-Aug-16 21:15 
QuestionC programming Pin
Kofi_Tommy7-Aug-16 8:16
MemberKofi_Tommy7-Aug-16 8:16 
QuestionRe: C programming Pin
David Crow7-Aug-16 10:38
MemberDavid Crow7-Aug-16 10:38 
QuestionRe: C programming Pin
Paul Conrad13-Aug-16 18:09
professionalPaul Conrad13-Aug-16 18:09 
AnswerRe: C programming Pin
Kofi_Tommy17-Aug-16 10:04
MemberKofi_Tommy17-Aug-16 10:04 
QuestionMigrating old project to VS2008 - resource file errors Pin
charlieg4-Aug-16 3:10
Membercharlieg4-Aug-16 3:10 
AnswerRe: Migrating old project to VS2008 - resource file errors Pin
Richard MacCutchan4-Aug-16 3:36
mveRichard MacCutchan4-Aug-16 3:36 
GeneralRe: Migrating old project to VS2008 - resource file errors Pin
charlieg4-Aug-16 8:07
Membercharlieg4-Aug-16 8: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.