-
May 1st, 2013, 04:20 AM
#1
[DC's] - how can i create an empty DC with window size?
Code:
struct ImageInfo
{
HBITMAP ImageImage;
BITMAP Imagebm;
HDC ImagehdcMem;
HBITMAP ImageMaskImage;
BITMAP ImageMaskbm;
HDC ImageMaskhdcMem;
};
//...................
ImageInfo DoubleBuffer;
DoubleBuffer.ImagehdcMem = CreateCompatibleDC (Console.WindowDC);//Console.WindowDC is window DC
DoubleBuffer.ImageImage = CreateCompatibleBitmap (Console.WindowDC,rec.right-rec.left , rec.bottom-rec.top); //rec is the window RECT
SelectObject (Console.WindowDC , Console.WindowHandle); //Console.WindowHandle is the window handle
TextOut(DoubleBuffer.ImagehdcMem,10,10, "Hello world",strlen("Hello world"));
BitBlt(Console.WindowDC,0,0,DoubleBuffer.Imagebm.bmWidth , DoubleBuffer.Imagebm.bmHeight ,DoubleBuffer.ImagehdcMem,0,0,SRCCOPY);
system("pause");
why the text isn't show in window after use BitBlt()?
-
May 1st, 2013, 03:25 PM
#2
Re: [DC's] - how can i create an empty DC with window size?
Where do you call this code from?
Victor Nijegorodov
-
May 1st, 2013, 03:35 PM
#3
Re: [DC's] - how can i create an empty DC with window size?
Originally Posted by VictorN
Where do you call this code from?
(in my Menu() function)
finally i resolve it. but i don't know why wasn't
Code:
GetWindowRect(Console.WindowHandle, &rectWindow);
HDC DoubleBuffer = CreateCompatibleDC(NULL);
HBITMAP mbmp = CreateCompatibleBitmap(Console.WindowDC,rectWindow.right- rectWindow.left , rectWindow.bottom-rectWindow.top); // width, height, 1, bit_depth, NULL
HBITMAP moldbmp = (HBITMAP)SelectObject(DoubleBuffer,mbmp);
but think on that: why 2 handle (mbmp and moldbmp ) variables and what is the handle that we need?
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
|