[WinAPI] DC and pixel data

BlitzMax Forums/BlitzMax Programming/[WinAPI] DC and pixel data

Suco-X(Posted 2006) [#1]
Good evening
I have a problem. I need my desktop in a pixmap and the GDI function "GetPixel" is too slow. After hours of search I have found this code.
<Click>
Sounds logical, i need a pointer to the pixel data, easy.
The Blitz Max version:



I´m tired and disappointed.
The GetDIBits function returns 0 and I dont know where the problem is (Wrong Type structure, Wrong Ptr?)
Thx for help.
Mfg Suco


Suco-X(Posted 2006) [#2]
Ok, I have found the solution. The problem ist on the BITMAPINFO Type. If I copy the BITMAPINFOHEADER directly into the BITMAPINFO type, it runs fine.

My small GetDesktopPixmap function



Please test, Win32 only

Mfg Suco


Brucey(Posted 2006) [#3]
This is absolutely perfect for my form-editor project, and if you don't mind I would appreciate it if I could use a modifed version of it (with credits) :-)

With this one you pass in *any* gadget, and it makes a pixmap copy of whatever it is displaying.

It allows me to get around the win32 problem of not being able to have a button on the window that I don't want to click on.

Excellent :-D