
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