Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to capture the Desktop Window into a jpeg image?
Message
 
To
10/11/2003 00:01:10
General information
Forum:
Visual FoxPro
Category:
Pictures and Image processing
Miscellaneous
Thread ID:
00847508
Message ID:
00848185
Views:
24
Peter,

>3. GDI has no function to save bitmap into a JPEG format. For curiosity, how to save the GDI object (bitmap) into a bmp file using GDI (not GDI+)?

This could be done with poorly documented OleSavePictureFile() function. The sample you can find in message #754817. The more complex way you can see in George Tasker's Obj2Bmp code, for example.

>4. GdipCreateBitmapFromHBITMAP is used to create a GDI+ object (image) from a GDI object (bitmap). This is necessary because GdipSaveImageToFile only supports GDI+ object. Where can I find more information on these functions besides the very limited info in MSDN?

I know only only one "good" place - GdiPlusFlat.h file in Platform SDK.

>One concern I have using GdipCreateBitmapFromHBITMAP and GdipSaveImageToFile is that they are not supported by Microsoft Product Support Services. In the link http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdicpp/GDIPlus/GDIPlusReference/FlatBitmap.asp, it mentions that we should use C++ wrappers.

Yes, GDI+ is announced evewhere as a set of C++ classes. However they are just wrappers around GDI+ API. These classes make development in C++ more clear and robust, but in VFP we have to call API functions directly.

>I have no idea how to do that in VFP.

Just use gpImage class. This code from capture.prg sample will make the job without learning the GDI, GDI+, WinAPI, C++ and World's history of humanity :) :
If Not "gpImage" $ Set("Procedure")
	Set Procedure To gpImage Additive
EndIf

gdip = CreateObject("gpInit")
img = CreateObject("gpImage")

img.Capture(0)
img.SaveAsJPEG("Desktop")
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform