Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
OLEDragDrop GetData() in BMP/WAV format?
Message
From
23/05/2005 16:27:08
 
 
To
23/05/2005 15:39:32
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
01016102
Message ID:
01016886
Views:
64
>Hi Herman,
>
>>You're welcome. Let me know if you need some help :-)
>
>Thanks for helping me out. I really, really appreciate your help. :)
>
>Here's where I'm at: Thanks to you I can successfully detect the presence of image data being dropped on my VFP image control. And now I can even read the data via oDataObject.GetData( CF_DIB )!
>
>Unfortunately, I can't figure out what to do with the binary data stream that .GetData( CF_DIB ) returns. I don't think that .GetData( CF_DIB ) is returning valid DIB data and here's why: If I strtofile( .GetData( CF_DIB ), "TEMP.DIB" ) I can't view TEMP.DIB using VFP's image control, MS Paint, or the IrfanView image utility. This leads me to believe that either:
>
>1. the data I'm retrieving isn't a raw DIB data stream
>
>2. the data I'm retrieving is DIB data but missing a special type of data header/prefix and/or data suffix
>
>3. VFP's implementation of .GetData() has a problem returning data of type CF_DIB and thus I'm getting corrupted DIB data?
>
>4. some other reason?
>
>Any ideas you might have would be greatly appreciated!
>
>Thanks again for your help, Herman,
>
>Malcolm


Hi Malcolm,

First, I'm using VFP7 (I'm still waiting for my MSDN shipment). So I don't know if there is a different return data between VFP7 & VFP9.

In VFP7 the data is properly returned by .GetData(). The returned data is using BITMAPINFO (BI) structure. It contains BITMAPINFOHEADER (BIH) structure, then followed by arrays of RGBQUAD structure.

So:
1. parse BIH, then calculate the image size that will be needed by BITMAPFILEHEADER (BFH)
2. create BFH, fill in the structure. As from the example at the link:
BITMAPFILEHEADER hdr; // bitmap file-header
PBITMAPINFOHEADER pbih; // bitmap info-header 

hdr.bfType = 0x4d42;        // 0x42 = "B" 0x4d = "M" 
// Compute the size of the entire file. 
hdr.bfSize = (DWORD) (sizeof(BITMAPFILEHEADER) + 
             pbih->biSize + (pbih->biClrUsed * sizeof(RGBQUAD)) +
             pbih->biSizeImage); 
hdr.bfReserved1 = 0; 
hdr.bfReserved2 = 0; 

// Compute the offset to the array of color indices. 
hdr.bfOffBits = (DWORD) sizeof(BITMAPFILEHEADER) + 
                pbih->biSize + pbih->biClrUsed * sizeof (RGBQUAD);
3. save BFH + the returned data = BMP file

Regards
Herman
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform