Click here to Skip to main content
15,890,185 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Good ol static member inits Pin
Eytukan23-Mar-09 2:35
Eytukan23-Mar-09 2:35 
QuestionNeed a AVC/H.264 Video Decoder Pin
Andy Rama21-Mar-09 21:10
Andy Rama21-Mar-09 21:10 
AnswerRe: Need a AVC/H.264 Video Decoder Pin
Michael Schubert22-Mar-09 1:20
Michael Schubert22-Mar-09 1:20 
GeneralRe: Need a AVC/H.264 Video Decoder Pin
Andy Rama22-Mar-09 20:26
Andy Rama22-Mar-09 20:26 
GeneralRe: Need a AVC/H.264 Video Decoder Pin
Andy Rama22-Mar-09 20:50
Andy Rama22-Mar-09 20:50 
GeneralRe: Need a AVC/H.264 Video Decoder Pin
Michael Schubert22-Mar-09 21:14
Michael Schubert22-Mar-09 21:14 
QuestionRe: Need a AVC/H.264 Video Decoder Pin
Andy Rama23-Mar-09 3:33
Andy Rama23-Mar-09 3:33 
QuestionA default MFC project don't use /Yc compiler option, how does it work? [modified] Pin
followait21-Mar-09 16:33
followait21-Mar-09 16:33 
AnswerRe: A default MFC project don't use /Yc compiler option, how does it work? Pin
Stuart Dootson23-Mar-09 0:39
professionalStuart Dootson23-Mar-09 0:39 
QuestionTimer or For Loop Help. Pin
FISH78621-Mar-09 13:36
FISH78621-Mar-09 13:36 
AnswerRe: Timer or For Loop Help. Pin
Code-o-mat21-Mar-09 23:42
Code-o-mat21-Mar-09 23:42 
GeneralRe: Timer or For Loop Help. Pin
FISH78622-Mar-09 0:23
FISH78622-Mar-09 0:23 
GeneralRe: Timer or For Loop Help. Pin
Code-o-mat22-Mar-09 0:50
Code-o-mat22-Mar-09 0:50 
GeneralRe: Timer or For Loop Help. Pin
FISH78622-Mar-09 1:45
FISH78622-Mar-09 1:45 
GeneralRe: Timer or For Loop Help. Pin
Code-o-mat22-Mar-09 7:33
Code-o-mat22-Mar-09 7:33 
GeneralRe: Timer or For Loop Help. Pin
FISH78622-Mar-09 7:55
FISH78622-Mar-09 7:55 
GeneralRe: Timer or For Loop Help. Pin
Code-o-mat22-Mar-09 8:19
Code-o-mat22-Mar-09 8:19 
This:
MemDC = CreateCompatibleDC(DlgDC);
must be "freed" like this:
DeleteDC(MemDC);
ReleaseDC does not need to be used for the memory DC, and DeleteObject is not for device contexts at all.

This:
DlgDC = GetDC(hWnd);
needs to be released like this:
ReleaseDC(hWnd, DlgDC);
ReleaseDC(NULL, DlgDC) is wrong, you need to specify the same window handle you used to get the DC. And once again, don't use DeleteObject for a DC.

Also note, when you select objects into a DC, may those be bitmaps or brushes or whatever, the original objects should be select back into the DC before you delete the DC or delete objects that were selected into the DC. To explain this a bit more clearly:
This is not complete:
HDC MemDC = CreateCompatibleDC(DlgDC);
HBITMAP bitmap = CreateCompatibleBitmap(MemDC, 100, 100);
SelectObject(MemDC, bitmap);
...
DeleteDC(MemDC);
DeleteObject(bitmap);

Should be done something like this:
HDC MemDC = CreateCompatibleDC(DlgDC);
HBITMAP bitmap = CreateCompatibleBitmap(MemDC, 100, 100);
HBITMAP originalbitmap = (HBITMAP)SelectObject(MemDC, bitmap);
...
SelectObject(MemDC, originalbitmap);
DeleteDC(MemDC);
DeleteObject(bitmap);

If you do not follow this "rule", your program will leak GDI resources...

Also one very important thing you should know about threads is that fiddling with GUI objects in other than the GUI thread is strongly not recommended.

> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <

GeneralRe: Timer or For Loop Help. Pin
FISH78622-Mar-09 8:30
FISH78622-Mar-09 8:30 
GeneralRe: Timer or For Loop Help. Pin
FISH78622-Mar-09 10:28
FISH78622-Mar-09 10:28 
Questionhow to use in-place editing Pin
jiaweicz21-Mar-09 11:01
jiaweicz21-Mar-09 11:01 
AnswerRe: how to use in-place editing Pin
Yusuf21-Mar-09 13:02
Yusuf21-Mar-09 13:02 
QuestionXP/Vista Styles Pin
The_Judgement21-Mar-09 9:27
The_Judgement21-Mar-09 9:27 
AnswerRe: XP/Vista Styles Pin
Code-o-mat21-Mar-09 10:35
Code-o-mat21-Mar-09 10:35 
GeneralRe: XP/Vista Styles Pin
The_Judgement21-Mar-09 11:14
The_Judgement21-Mar-09 11:14 
GeneralRe: XP/Vista Styles Pin
Code-o-mat21-Mar-09 11:27
Code-o-mat21-Mar-09 11:27 

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.