> HWND hWnd // handle to a window -- THIS IS MY PROBLEM.
>
> Where or how can I find it ?
>
> I'm working in a global function and I havent any hWnd of any type.
> > HWND hWnd // handle to a window -- THIS IS MY PROBLEM.
> >
[quoted text clipped - 21 lines]
>
> Tom
Thank you Tom
Ok.
I need to create a DIBSection and below there is a piece of my code ( Idon't
know if it is right).
***
HBITMAP Bitmap;
int Width, Height;
HDC WindowDC, MemDC;
BITMAPINFO BitmapInfo;
unsigned char *Data;
HWND hwnd = NULL;
CRect rect;
WindowDC = GetDC(hwnd);
Width = image_width;
Height = image_height;
memset(&BitmapInfo.bmiHeader, 0, sizeof(BitmapInfo.bmiHeader));
BitmapInfo.bmiHeader.biWidth = Width;
BitmapInfo.bmiHeader.biHeight = -Height;
BitmapInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
BitmapInfo.bmiHeader.biPlanes = 1;
BitmapInfo.bmiHeader.biBitCount = 24;
BitmapInfo.bmiHeader.biCompression = BI_RGB;
MemDC = CreateCompatibleDC(WindowDC);
Bitmap = CreateDIBSection(WindowDC, &BitmapInfo, DIB_RGB_COLORS, (void
**)&Data, 0, 0);
***
how you can see I'm using "hwnd = NULL" that is the full screen. I need only
the window region of the application. What I have to do to put to hwnd the
right value to do that?
Tamas Demjen - 12 Jul 2005 18:50 GMT
> MemDC = CreateCompatibleDC(WindowDC);
> Bitmap = CreateDIBSection(WindowDC, &BitmapInfo, DIB_RGB_COLORS, (void
> **)&Data, 0, 0);
I simply use WindowDC = 0, and it works just fine. The first parameter
for CreateDIBSection is not used anyway, unless the 3rd parameter is
DIB_PAL_COLORS. You're passing DIB_RGB_COLORS, which means WindowDC is
irrelevant. I think you'll be fine with WindowDC = 0. If you're
compatible with the screen, you're compatible with the current window.
If you have concerns, you can always pass the current window handle to
your function.
Tom
mark - 13 Jul 2005 14:49 GMT
>If you have concerns, you can always pass the current window handle to
> your function.
>
> Tom
The question is that i don't know how to obtain the current window handle