|
-
Dec 13th, 2003, 11:24 AM
#1
Thread Starter
Frenzied Member
Blitting compatable dc to compatable dc does not work.
//creation of the 2 dc's. hdc is screen.
HDC memDC= ::CreateCompatibleDC(hdc);
HDC imageDC= ::CreateCompatibleDC(hdc);
//created drawing surface fo the memDC
HBITMAP hMemBmp= ::CreateCompatibleBitmap(hdc, wndRect.right-wndRect.left,
wndRect.bottom-wndRect.top);
//Selecting bmp's into dc's
HBITMAP hOldBmp= (HBITMAP)::SelectObject(imageDC, hBmp->HBmp);
HBITMAP hOldMemBmp= (HBITMAP)::SelectObject(memDC, hMemBmp);
//drawing background on memDC
::StretchBlt(memDC, 0, 0, wndRect.right-wndRect.left,
wndRect.bottom-wndRect.top, imageDC, 0, 0, BmpW, BmpH, SRCCOPY);
//Attempt to copy the memDC to another dc yeilds a black box
//and not the image!
::BitBlt(imageDC, drawLocation->left, drawLocation->top, BmpW, BmpH, memDC, drawLocation->left, drawLocation->top, SRCCOPY);
-
Dec 13th, 2003, 02:33 PM
#2
Thread Starter
Frenzied Member
My mistake. I could not see it! It's exactly the same as the background! Bad mistake!
-
Dec 13th, 2003, 02:58 PM
#3
transcendental analytic
the old bitmaps seems a bit redundant there, you've just created them dcs
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Dec 13th, 2003, 03:40 PM
#4
Thread Starter
Frenzied Member
I have no idea what you are talking about but do you know how to create another object in memory just like a chosen object? Like a Bitmap?
Do I use
::CreateCompatibleBitmap for a Bitmap?
What about anything else?
Last edited by aewarnick; Dec 13th, 2003 at 03:45 PM.
-
Dec 13th, 2003, 04:11 PM
#5
transcendental analytic
yes, you can read more on msdn for creating other GDI objects http://msdn.microsoft.com/library/en...asp?frame=true
I just pointed out that these:
HBITMAP hOldBmp=
HBITMAP hOldMemBmp=
were redundant, as there are no bitmaps for the new dcs
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Dec 13th, 2003, 04:25 PM
#6
Thread Starter
Frenzied Member
But don't I have to Select them out of the dc's and then delete the HBitmap's when I'm done?
-
Dec 13th, 2003, 04:34 PM
#7
transcendental analytic
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Dec 13th, 2003, 05:05 PM
#8
Thread Starter
Frenzied Member
Thanks. Are you trying to confuse me?
-
Dec 13th, 2003, 05:23 PM
#9
transcendental analytic
no, i certainly didn't intend to and i hope i didn't.
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Dec 13th, 2003, 05:26 PM
#10
Thread Starter
Frenzied Member
Are you saying that these
HBITMAP hOldBmp=
HBITMAP hOldMemBmp=
are NULL?
-
Dec 13th, 2003, 05:56 PM
#11
transcendental analytic
well now i'm not sure in fact, most of the time i see people even on msdn not deleting the objects.. so now that you mentioned it (and i used to take it for granted) it does return a 1x1 bitmap - and doing it again returns the same bitmap.. sorry if it seems confusing, but it seems to me as you should not delete it after all. Yet you should delete all bitmaps you create on your own.
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Dec 13th, 2003, 06:26 PM
#12
Thread Starter
Frenzied Member
Thank you very much. My code is now improved and probably a little faster.
-
Dec 14th, 2003, 10:32 AM
#13
Thread Starter
Frenzied Member
I read this article: CLICK
and as you see, it mentions that there is a default Bitmap in the DC's that MS was not Selecting the Old hbitmaps back into the dc's and there was a leak.
-
Dec 14th, 2003, 12:05 PM
#14
transcendental analytic
thanks.. seems like microsoft can't keep track on anything but thats nothing new then..
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|