Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

GetDIBits don't working when quering a bitmap attributes

39 views
Skip to first unread message

viki

unread,
Oct 23, 2003, 6:33:44 PM10/23/03
to
I have one window with one picture control (p_1).

I want to get the attributes of picture in window's open event. Here
is the code - i set 0 of retrieved buffer address to query the
attributes (like reading in SDK..):

uint li
long ll
ulong hdc
bitmapinfo lbi

hdc=GetDC(this)
lbi.bmiheader.bisize=(10)*4
li=GetBitmapInfo(hdc,handle(p_1),0,0,0,lbi,0) //alias of GetDIBits
ll=GetLastError()


This looks like good, but the return of the funtion is 0, and when
looking about GetLastError() it's also 0. I tryed it with many
situation, but i got always the same reason. Finally i put the code
into c++ builder, and everything works fine.. :-(. But i need it in
PB.


Here is the definitions of local external functions:

function int GetBitmapInfo(ulong hdc,ulong handle,ulong start,ulong
count,ulong array,ref bitmapinfo bi,ulong uUsage) library "gdi32.dll"
alias for GetDIBits

function ulong GetLastError() library "kernel32.dll" alias for
GetLastError

and the structures:

type bitmapinfoheader from structure
ulong bisize
long biwidth
long biheight
integer biplanes
integer bibitcount
ulong bicompression
ulong bisizeimage
long bixpelspermeter
long biypespermeter
ulong biclrused
ulong biclrimportant
end type
type bitmapinfo from structure
bitmapinfoheader bmiheader
rgbquad bmicolors[1]
end type
type rgbquad from structure
character rgbBlue
character rgbGreen
character rgbRed
character rgbUndefinded
end type

Any ideas would be appreciated..

Thanks,
Viktor

0 new messages