API-Calls for Clipboard-Bitmap save to File 
Author Message
 API-Calls for Clipboard-Bitmap save to File

Situation:
The Clipboard contains a Screenshot of a form.
Problem:
How can I save it to disc?


Fri, 25 Jan 2002 03:00:00 GMT  
 API-Calls for Clipboard-Bitmap save to File
In pure VB, paste it into a picturebox using GetData and use the SavePicture
method to save it to disk.

If you prefer to use API functions, it's quite a bit more complicated, but
you can do the first part with OpenClipboard, GetClipboardData, and
CloseClipboard, and the save with GetDIBits and binary file I/O (after
adding your own BITMAPFILEHEADER to the data)...

Jim Deutch
MS Dev MVP


Quote:
>Situation:
>The Clipboard contains a Screenshot of a form.
>Problem:
>How can I save it to disc?



Fri, 25 Jan 2002 03:00:00 GMT  
 API-Calls for Clipboard-Bitmap save to File


Quote:
>Situation:
>The Clipboard contains a Screenshot of a form.
>Problem:
>How can I save it to disc?

Look at the current thread "Form Image to Graphics File" in
comp.lang.basic.visual.misc

--
Richard Mason



Fri, 25 Jan 2002 03:00:00 GMT  
 API-Calls for Clipboard-Bitmap save to File
Thank you, Jim Deutch. The API-way works so far. What I need now are the
parameters for BITMAPFILEHEADER that are responsible for the default
Bitmap-resolutions..
In other words:
Jim Deutch to Lu-Khon Mai (22.07.99)
Quote:
>I've got a routine here to save a picturebox as a monochrome bitmap: you
>should find it pretty easy to change it for 16- and 256-color standard
>palettes (if not, just ask more questions here!).  Custom palettes are
quite
>a bit more work...

So I ask for more... :-)


Sat, 26 Jan 2002 03:00:00 GMT  
 API-Calls for Clipboard-Bitmap save to File
Hi Richard Mason!

Can you give me more info? I searched
comp.lang.basic.visual.misc
and
comp.lang.basic.misc
but cannot find a thread named "Form Image to Graphics File"

Is there a way to do a search by title? Or is something wrong?
Or is it a user-problem?

Thanks



Sat, 26 Jan 2002 03:00:00 GMT  
 API-Calls for Clipboard-Bitmap save to File
Resolution is not controlled in any way by the BITMAPFILEHEADER.

You have to coordinate the BITMAPINFO data (the .biBitsPixel member and the
.bmiColors palette array of RGBQuads) along with the pixel bits themselves
(eg, 8 Bits/Pixel means each byte represents a pixel as an index into the
.bmiColors array, while monochrome (1 Bit/Pixel) means each byte represents
eight pixels).

What was it you wanted to do?

Jim Deutch
MS Dev MVP


Quote:
>Thank you, Jim Deutch. The API-way works so far. What I need now are the
>parameters for BITMAPFILEHEADER that are responsible for the default
>Bitmap-resolutions..
>In other words:
>Jim Deutch to Lu-Khon Mai (22.07.99)
>>I've got a routine here to save a picturebox as a monochrome bitmap: you
>>should find it pretty easy to change it for 16- and 256-color standard
>>palettes (if not, just ask more questions here!).  Custom palettes are
>quite
>>a bit more work...

>So I ask for more... :-)



Sat, 26 Jan 2002 03:00:00 GMT  
 API-Calls for Clipboard-Bitmap save to File


Quote:
>Hi Richard Mason!

>Can you give me more info? I searched
>comp.lang.basic.visual.misc
>and
>comp.lang.basic.misc
>but cannot find a thread named "Form Image to Graphics File"

As posted by Mike Williams in c.l.b.v.misc (8th August)

To simulate PrintScreen:

Private Declare Sub keybd_event Lib "user32" _
(ByVal bVk As Byte, ByVal bScan As Byte, _
ByVal dwFlags As Long, ByVal dwExtraInfo As Long)

Const VK_SNAPSHOT As Byte = &H2C

Private Sub Command1_Click()
Clipboard.Clear
Call keybd_event(VK_SNAPSHOT, 0, 0, 0)
DoEvents
SavePicture Clipboard.GetData, "c:\mypic.bmp"
End Sub

--
Richard Mason



Sat, 26 Jan 2002 03:00:00 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. Window's API Call: GetClipboardData to retrieve a Bitmap from Clipboard

2. Saving a CLIPBOARD image to a file using API's

3. (Q) API Call for File/Save as

4. ExtractIcon api call and then saving the icon to a file (HELP)

5. How to call Open File and Save As dialog box API from VB

6. saving bmp file with API calls

7. Saving a Bitmap file to an .MDB file

8. Copying to Clipboard using API calls

9. Copy to Clipboard using API Calls

10. Clipboard Manipulation using API Calls

11. Clipboard Manipulation using API Calls

12. Access XP: Clearing the clipboard / not saving data to the clipboard

 

 
Powered by phpBB® Forum Software