Click here to Skip to main content
15,922,650 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: app's memory usage Pin
David Crow28-Oct-04 6:26
David Crow28-Oct-04 6:26 
GeneralRe: app's memory usage Pin
bektek28-Oct-04 9:15
bektek28-Oct-04 9:15 
GeneralRe: app's memory usage Pin
David Crow28-Oct-04 10:49
David Crow28-Oct-04 10:49 
GeneralWriting to an XML file Pin
wcovuaku28-Oct-04 5:39
wcovuaku28-Oct-04 5:39 
GeneralPlease Help: Driving me crazy..... Pin
...---...28-Oct-04 4:43
...---...28-Oct-04 4:43 
GeneralRe: Please Help: Driving me crazy..... Pin
Maximilien28-Oct-04 5:13
Maximilien28-Oct-04 5:13 
GeneralRe: Please Help: Driving me crazy..... Pin
Anonymous28-Oct-04 5:41
Anonymous28-Oct-04 5:41 
Generalhelp! Can't BitBlt! Pin
sagmam28-Oct-04 4:17
sagmam28-Oct-04 4:17 
Hi all,
I really don't know what I'm doing wrong...

I have a simple dialog (MFC), and I want to create a buffer, paint some pixels on it, and BitBlt it onto the dialog's client area.

In my dialog class I've created a new DC member:
CDC m_PicDC;

In my OnInitDialog method I create it to be compatible with my dialogs's own DC, and draw some pixels on it:
{
CDialog::OnInitDialog();
...
m_PicDC.CreateCompatibleDC(GetDC());
... draw some pixels inside m_PicDC using CDC::SetPixel ....
}

Finally, in the OnPaint method I do this:
CPaintDC dc(this);
dc.BitBlt(0,0,100,100,&m_PicDC, 0, 0, SRCCOPY);

Each and every SetPixel call returns -1 (as if I'm trying to draw outside the clipping area). All other GDI functions return TRUE. It's worth noting that if I draw directly onto the dialog's DC, everything's great, so it's unlikely that my pixel drawing routine is bad or something... but why isn't the DC big enough to hold my pixels? How can I change its size? I've trying using the SetBoundsRect method, but I'm not sure which flags to use. In any combination I tried, the SetPixel calls still returned -1..

Any ideas?
Thanks...

/=/=/=/= Sagmam =\=\=\=\
GeneralRe: help! Can't BitBlt! Pin
Antony M Kancidrowski28-Oct-04 5:03
Antony M Kancidrowski28-Oct-04 5:03 
GeneralC library and C++ application Pin
[CoY0te]28-Oct-04 3:28
[CoY0te]28-Oct-04 3:28 
GeneralRe: C library and C++ application Pin
Blake Miller28-Oct-04 7:05
Blake Miller28-Oct-04 7:05 
GeneralRe: C library and C++ application Pin
John R. Shaw28-Oct-04 7:05
John R. Shaw28-Oct-04 7:05 
GeneralRe: C library and C++ application Pin
[CoY0te]29-Oct-04 0:59
[CoY0te]29-Oct-04 0:59 
Questionhow to assign a specific ip address to server and client Pin
syaks28-Oct-04 2:19
syaks28-Oct-04 2:19 
Questionget the actual selected file in windows explorer??? Pin
mightyCoCo28-Oct-04 2:18
mightyCoCo28-Oct-04 2:18 
AnswerRe: get the actual selected file in windows explorer??? Pin
David Crow28-Oct-04 3:55
David Crow28-Oct-04 3:55 
GeneralRe: get the actual selected file in windows explorer??? Pin
mightyCoCo28-Oct-04 4:17
mightyCoCo28-Oct-04 4:17 
GeneralRe: get the actual selected file in windows explorer??? Pin
David Crow28-Oct-04 5:17
David Crow28-Oct-04 5:17 
GeneralRe: get the actual selected file in windows explorer??? Pin
mightyCoCo28-Oct-04 23:43
mightyCoCo28-Oct-04 23:43 
GeneralRe: get the actual selected file in windows explorer??? Pin
mightyCoCo29-Oct-04 0:19
mightyCoCo29-Oct-04 0:19 
QuestionHelp For Memory Leak ? Pin
Amarelia28-Oct-04 1:51
Amarelia28-Oct-04 1:51 
AnswerRe: Help For Memory Leak ? Pin
jmkhael28-Oct-04 2:56
jmkhael28-Oct-04 2:56 
AnswerRe: Help For Memory Leak ? Pin
[CoY0te]28-Oct-04 3:33
[CoY0te]28-Oct-04 3:33 
GeneralMultiple threads and MFC Pin
Anonymous28-Oct-04 1:43
Anonymous28-Oct-04 1:43 
GeneralRe: Multiple threads and MFC Pin
Blake Miller28-Oct-04 7:09
Blake Miller28-Oct-04 7:09 

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.