retrieve picture from clipboard to File 
Author Message
 retrieve picture from clipboard to File

How TO : Retrieve a Picture from Clipboard and save to a file in acecss 97
thanks
FLAVIO


Thu, 22 May 2003 03:00:00 GMT  
 retrieve picture from clipboard to File
Flavio have a look at:
http://www.*-*-*.com/
specifically:
http://www.*-*-*.com/

It only saves as a Bitmap file.

Metafiles are even easier. Once you get the handle to the Metafile on
the ClipBoard you just copy the Metafile using CopyEnhMetaFile to your
hard drive.

' ******** WARNING ***********
' ******** AIR CODE ***********

'Open the clipboard to read
Private Declare Function OpenClipboard Lib "user32" (ByVal hwnd As Long)
As Long

'Get a pointer to the bitmap/metafile
Private Declare Function GetClipboardData Lib "user32" (ByVal wFormat As
Integer) As Long

'Close the clipboard
Private Declare Function CloseClipboard Lib "user32" () As Long

'Create our own copy of the metafile, so it doesn't get wiped out by
subsequent clipboard updates.
Declare Function CopyEnhMetaFile Lib "gdi32" Alias "CopyEnhMetaFileA"
(ByVal hemfSrc As Long, ByVal lpszFile As String) As Long

Private Declare Function Dele{*filter*}hMetaFile Lib "gdi32" Alias
"Dele{*filter*}hMetaFile" (ByVal hemf As Long) As Long

Function GetClipBoard() As Boolean

' Handles for graphic Objects
Dim hClipBoard As Long
Dim hEMF As Long
Dim hEMFdisk as long
Dim lngRet as long

 ' Open the ClipBoard
 hClipBoard = OpenClipboard(0&)

 If hClipBoard <> 0 Then
    ' Get a handle to the Bitmap
    hEMF = GetClipboardData(CF_ENHMETAFILE)

    If hEMF = 0 Then GoTo exit_error
    ' Create our own copy of the image onto our HDisk.
    hEMFdisk = CopyEnhMetaFile(hEMF, "C:\OurTempEMF.emf")
    ' Only deletes the handle not the Disk file!
    lngRet = Dele{*filter*}hMetaFile(hEMFdisk)

    'Release the clipboard to other programs
    hClipBoard = CloseClipboard

 GetClipBoard = TRUE
 Exit Function

 End If

exit_error:
' Return False
GetClipBoard = -1
End Function
' *** END AIR CODE

--

HTH
Stephen Lebans
http://www.*-*-*.com/
Access Code, Tips and Tricks


Quote:
> How TO : Retrieve a Picture from Clipboard and save to a file in
acecss 97
> thanks
> FLAVIO



Thu, 22 May 2003 03:00:00 GMT  
 retrieve picture from clipboard to File
We offer an image control for Access that can do this for you;
You would simply have to provide a handler as follows:

Private Sub BtnPaste_Click()
    if DBPixCtl.ImagePaste then
        DBPixCtl.ImageSaveFile <somefilename>
    End If
End Sub

You would be able to save the file as jpeg, bmp or png and if required
you could resample the image, store the dimensions etc, or
alternatively read the image directly from a camera or scanner.
(Note: the format will be determined from the extension you supply; if
you do not wish to use jpeg compression you should set the
ImageSaveFormat property to png to prevent the image being jpeg
compressed as soon as you paste it).

If this sounds useful you can download the control, documentation and
samples from www.ammara.com



Quote:
> How TO : Retrieve a Picture from Clipboard and save to a file in
acecss 97
> thanks
> FLAVIO

Sent via Deja.com http://www.deja.com/
Before you buy.


Fri, 23 May 2003 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Extract real colors from Image Picture, Clipboard or File

2. Save picture in clipboard to a file

3. Save picture in clipboard to a file

4. Find number of colors in a Image Picture, Clipboard or File

5. How to save a picture from clipboard into a file

6. Copy picture: Clipboard -> Picture object

7. Retrieve embedded information from jpg file (digital camera picture)

8. save/retrieve picture without files

9. VB6 how to Save/retrieve Picture from BD without files

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

11. Retrieve Clipboard graphics in VBA(PrintScreen)

12. Retrieving image from clipboard

 

 
Powered by phpBB® Forum Software