In my PBDLL60 program I have created a bitmap whose handle is hBmp.
I would like to write it to a file "linear.bmp". In Petzold's book I found functions that I thought should be applicable here.
These functions are shown below.
//LOCAL Bm as BITMAP
GETOBJECT hBmp,SIZEOF(Bm),Bm
count&=bm.bmWidthBytes*bm.bmHeight*bm.bmPlanes
GetBitmapBits hBmp,count&,pbuffer
hDCMEM&=CreateFile("linear.bmp",%generic_write,0,BYVAL %null,%create_always,0,0)
hDCMEMM&=WriteFile(hDCMEM&,pbuffer,count!,count1!,%null)
GETOBJECT retrieves the bitmap's information.
It is surprising, however, that Bm.bmBits is zero.
It seems that I have a problem with pbuffer in function GetBitmapBits.
I am not sure what this parameter should be.
I dimensioned a string and got pbuffer as VARPTR(), but it does not work.
The program crashes at GetBitmapBits function.
By the way, the bitmap is OK - I copy it to the screen.
How can I achieve my goal?
Could, please, somebody help me with this problem?
Edmund
[email protected]
------------------
I would like to write it to a file "linear.bmp". In Petzold's book I found functions that I thought should be applicable here.
These functions are shown below.
//LOCAL Bm as BITMAP
GETOBJECT hBmp,SIZEOF(Bm),Bm
count&=bm.bmWidthBytes*bm.bmHeight*bm.bmPlanes
GetBitmapBits hBmp,count&,pbuffer
hDCMEM&=CreateFile("linear.bmp",%generic_write,0,BYVAL %null,%create_always,0,0)
hDCMEMM&=WriteFile(hDCMEM&,pbuffer,count!,count1!,%null)
GETOBJECT retrieves the bitmap's information.
It is surprising, however, that Bm.bmBits is zero.
It seems that I have a problem with pbuffer in function GetBitmapBits.
I am not sure what this parameter should be.
I dimensioned a string and got pbuffer as VARPTR(), but it does not work.
The program crashes at GetBitmapBits function.
By the way, the bitmap is OK - I copy it to the screen.
How can I achieve my goal?
Could, please, somebody help me with this problem?
Edmund
[email protected]
------------------
Comment