|
-
Jul 12th, 2001, 03:42 AM
#1
Thread Starter
New Member
using clipboard with API (not Clipboard object...)
Dear all,
I have a problem....
Using Office 2000 at the moment, and therefore having to work with VBA as against VB. I'm trying to develop a toolbar button for use in Access for capturing screen shots of the database and saving them directly to a file on disc.
I'm trying to avoid the hassle of using the 'PrintScrn' key, and opening Paint, then pasting in the clipboard image, then having to find a location to save the image, then save it.
What I'd like to do is click the button, be presented with the common dialog box for file open/save with a name already suggested and save the file.
I've managed to get to the stage of getting the image to the clipboard, and I have a module for the common file open/save dialog box, but what I can't figure out how to do is save the clipboard to a file on disk. There's no Clipboard object in VBA so everything would have to be done via the APIs.
Can anyone help out?
Regards,
Ian J.
-
Jul 12th, 2001, 09:18 AM
#2
Here are a few API functions you may find useful.
VB Code:
Private Declare Function CloseClipboard Lib "user32" () As Long
Private Declare Function EmptyClipboard Lib "user32" () As Long
Private Declare Function GetClipboardData Lib "user32" (ByVal wFormat As Long) As Long
Private Declare Function IsClipboardFormatAvailable Lib "user32" (ByVal wFormat As Long) As Long
Private Declare Function OpenClipboard Lib "user32" (ByVal hWnd As Long) As Long
Private Declare Function SetClipboardData Lib "user32" (ByVal wFormat As Long, ByVal hMem As Long) As Long
-
Jul 12th, 2001, 10:10 AM
#3
Thread Starter
New Member
Originally posted by Matthew Gates
Here are a few API functions you may find useful.
VB Code:
Private Declare Function CloseClipboard Lib "user32" () As Long
Private Declare Function EmptyClipboard Lib "user32" () As Long
Private Declare Function GetClipboardData Lib "user32" (ByVal wFormat As Long) As Long
Private Declare Function IsClipboardFormatAvailable Lib "user32" (ByVal wFormat As Long) As Long
Private Declare Function OpenClipboard Lib "user32" (ByVal hWnd As Long) As Long
Private Declare Function SetClipboardData Lib "user32" (ByVal wFormat As Long, ByVal hMem As Long) As Long
Thanks for the above.
Unfortunately, I've already declared these APIs and used them to get the data to the clipboard (they are part of a function for copying and pasting text to/from the clipboard)...my problem is how to get image data from the clipboard into a file.
I've gotten one step further so far... I've managed to get the picture into an unbound ole object on an Access form, (Access doesn't have a Picture object), but the SavePicture statement won't accept it as an object to make a file from... :-(
Seems to me that Microsoft have really neutered the VB code in VBA. It's like trying to work with VB 2.0 or 3.0, only worse.....!!
Ian J.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|