![]() Public Declare PtrSafe Function OpenClipboard Lib "user32" (ByVal hwnd As Long) As Long ' * Pause : Makes the program wait, to make sure proper screen capture takes place. ' * AltPrintScreen: Performs the automation of Alt + PrtScrn, for getting the Active Window. ' * SaveClip2Bit : The entry point for 'Saving' the Image, calls for PastePicture ' * fnOLEError : Get the error text for an OLE error code ' * CreatePicture : Private function to convert a bitmap or metafile handle to an OLE reference ' * PastePicture : The entry point for 'Setting' the Image ' * to paste a picture of whatever is on the clipboard into a standard image control. ' * Set ImageControl.Image = PastePicture ' * to save this to a location on the Disc. ' * To use it, just copy this module into your project, then you can use: ' * discovered on MSDN, Access World Forum, VBForums. ' * The code in this module has been derived from a number of sources ' * The code requires a reference to the "OLE Automation" type library. ' * can also be assigned to (for example) and Image control on a userform. ' * This object is then saved to a location on the disc. ' * DESCRIPTION: Creates a standard Picture object from whatever is on the clipboard. ' * PAUL FRANCIS, 11 April 2013 - Putting all pieces togeather ' * LUTZ GENTKOW, 23 July 2011 - Alt + PrtScrn ' * G HUDSON, 5 April 2010 - Pause Function ![]() ' * STEPHEN BULLEN, 15 November 1998 - Original PastPicture code ' * Please leave any Trademarks or Credits in place. Grateful for any help getting the rest of the way, or suggestion of an entirely different way of doing it. Using the code below (without the AltPrintScreen element) I’ve gotten as far as saving from the clipboard and generating an absolute link, but only as a. I’d like to be able to attach multiple images’ links to a given record in this manner. jpg from the clipboard (put there by User using Snip tool) to a subfolder of the database, then pass a relative link to this file to the form. I would like to use VBA that on clicking a button will save an image as a. I would like help building code to achieve the following please, I’m trying to streamline adding images to a record. OleCreatePictureIndirect pd, IPic(0), True, dstPicture ' so we can leverage the SavePicture method if we can turn that into a StdPicĬLSIDFromString StrPtr(StdPicGUID), IPic(0) ' We now have a bitmap in myDC with the resized picture, whcih we want to be able to save Render myDC, 0, 0, NewWidth, NewHeight, 0. Render hdc as Long,x as Long ,y as Long,cs as Long,cy as Long,xSrc as OLE_POS_HIMETRIC,ySrc as OLE_YPOS_HIMETRIC,cxSrc as OLE_XSIZE_HIMETRIC,cySrc as OLE_YSIZE_HIMETRIC,prcWBounds as Any) MyBMP = CreateCompatibleBitmap(GetDC(0&), NewWidth, NewHeight) Set srcIPicture = LoadPicture(srcFileName) ' get different interface to the picture object Private Const StdPicGUID As String = ""ĭim srcFileName As String, dstFileName As String Private Declare Function OleCreatePictureIndirect Lib "olepro32.dll" (PicArray As Any, RefIID As Any, ByVal OwnsHandle As Long, IPic As Any) As Long Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long Private Declare Sub CLSIDFromString Lib "ole32" (ByVal lpsz As Any, pclsid As Any) Private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long Private Declare Function SelectObject Lib "gdi32" (ByVal hdc As Long, ByVal hObject As Long) As Long Private Declare Function DeleteDC Lib "gdi32" (ByVal hdc As Long) As Long Private Declare Function CreateCompatibleBitmap Lib "gdi32" (ByVal hdc As Long, ByVal nWidth As Long, ByVal nHeight As Long) As Long Private Declare Function CreateCompatibleDC Lib "gdi32" (ByVal hdc As Long) As Long
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |