Lebans Holdings 1999 Ltd.

 Home ] Up ] Feedback ] Contents ] Search ] What's New ] Files & Tips ] 

LoadJpegGif
Home
Up
Select A Row
Magnify
LimitCharsMemo
RotateText
ImageClass
AutoSize TextBox
ZoomInOut
PaintProgram
FormatByCriteria
CmdButton
SetGetSB
Transparent
AnimatedGifPlayer
LoadJpegGif
ImageControlToClipBoard
CanGrow
LimitTextInput
AutoSizeFont
AnimateForm
AutoUpDown
MonthCalendar
AutoColumnWidth
RichText
SelectAlpha
FormDimensions
LoadSaveJpeg
TabColors
ToolTip
TextWidth-Height
MouseWheelOnOff
AlternateColorDetailSection
ConFormsCurControl
ConditionalFormatting
AutoSizeOLE
ChangeMDIBackGround
RecordNavigationButtons
HTMLEditor
CopyGetRTFfromClipboard
OpenForm
GradientFill

RETIRED! September 2009

I have officially retired from all things Access. Please do not send Email requesting support as I will not respond.

 

Keep all of your questions to the Newsgroups where everyone will benefit!

 

 

A2KLoadJpegGifGDIPlus.zip is an update to the function to allow for the Display of Jpeg and Gif files on systems that do not have the Office Graphic Filters installed. TIF and PNG formats are now supported via the Microsoft GDI+ DLL. The GDI+ DLL is freely redistributable and available directly from MS here:

http://www.microsoft.com/downloads/release.asp?releaseid=32738

or on this Web site:

GDI+DLL.zip
Please take a moment to read the redist.txt file contained in distribution archive. This file explains how and where to install the DLL.

The GDI+ A2K version can easily be converted to A97 but you will have to manually change all of the ENUMS. Frankly I am getting tired of supporting both A97 and A2K versions mainly due to the lack of ENUM support in A97. :-(

 -----------------------------------------------------------------------



A97LoadJpegGif.zip is a database containing a function to allow for the Display of Jpeg and Gif files on systems that do not have the Office Graphic Filters installed.  Here is the A2K version: A2KLoadJpegGif.zip

NEW - April 05 2003 Ver 5.0 Developed to allow Access RunTime installations to display Jpeg files in a standard Image Control. Provides functionality to load JPG,GIF,BMP,EMF,WMF,CUR and ICO  files on systems without the Office Graphics Filters loaded.
Originally developed for Systems with Access Runtime only.  Supports transparency in Transparent Gifs.  Allows you to resize Images on Forms/Reports at runtime  with no loss of Image quality.

Windows 98 has a bug in the GDI's handling of Metafiles. That along with the resource issues with Printing Access reports with a large number of Images means you should not use these functions with large reports on Windows 98. The bug is fixed with Win2K or higher. 

'HISTORY

' *************************************************************
' Version 5.0 Notes
' April 12, 2003
' Finally got around to fixing the resizing issues when control's
' SizeMode prop is set to Zoom or Stretch. With A97 any format other
' than Bitmap would resize correctly. With A2K and higher the issue was
' reversed and only Bitmap images would resize properly.
' Solution was to use Use StretchBlt with SetStretchBltMode instead
' of BitBlt in the Enhanced Metafile records.
' This current version now works in all versions of Access for
' both Forms and Reports.
' Found a silly bug/feature. Access use the Office Graphics filters
' for Bitmap and Metafile images is dependant on the letter case
' of the file extensions. I'm serious!
' Will document this and other Image handling anomalies on my Web site with an Image Handling FAQ.


' Version 3.2
' Added code to simulate Magnification for the Image control.
' Autosizing of Image control to match dimensions of loaded picture.
' ScrollBars return to TOP and LEFT when CLIP is selected.

' Version 3.
' Added code to simulate ScrollBars for the Image Control.
'
' Version 2.
' Added code to have cursor change to HourGlass during the
' process to load/display the Jpeg or Gif file. Certain large
' JPEG's can take several seconds to load depending on
' the performance of the system.

' Version 1
' No stones yet!<bg>

 

 

' In case someone ever needs the ability to load disk based Images to a DIB for insertion into the PictureData prop, here is a modified function. Just grad the DIBSection class from my LoadSaveJpeg project for this code to work:

'Function fStdPicToImageDataDIB(hStdPic As Object, ctl As Access.Image, _
'Optional FileNamePath As String = "") As Boolean
'
'' Changed all references to StdPicture to Object
'' I'm going with late binding as this is a sample database
'' and many users may not be comfortable setting references.
'
'' If you need the faster performance you can use Early binding and declare
'' hStdPic as StdPicture. Requires a Reference to Standard OLE Types.
'' This file, OLEPRO32.DLL
'' is usually found in your System folder. Goto the Menu Tools->References
'' and set a reference to the above file.
'
'On Error GoTo ERR_SHOWPIC
'
'' Temp Device Context handles
'Dim hDCRef As Long, hdc As Long
'
'' Temp GDI Bitmap handles
'Dim hBmap As Long
'Dim hBmapOrig As Long
'
'' Temp var to hold API returns
'Dim lngRet As Long
'
'' Bitmap structure to hold Image props
'Dim Bm As BITMAP
'
'
'Dim DS As DIBSECTION
'Dim m_cDib As New cDIBSection
'
'
'' handle to EMF
'Dim hMetafile As Long
'
'' handle to Metafile DC
'Dim hDCMeta As Long
'
'' Array to hold binary copy of Enhanced Metafile
'' we will create.
'Dim arrayMeta() As Byte
'
'' Temp DC to select StdPicture object into
'hdc = apiCreateCompatibleDC(0)
'
'' It must be GetDC not CreateCompatibleDC!!!
'hDCRef = apiGetDC(0)
'
'' Make sure user hasn't tricked us by renaming
'' a graphic file mistakenly to JPG OR GIF.
'
''If hStdPic.Type <> 1 Then
'' Err.Raise vbObjectError + 523, "CreateBitmapFromImageCtl.modStdPic", _
'' "Sorry...This function can only read JPEG or GIF files." & vbCrLf & "Please Select a Valid JPEG or GIF File"
''End If
'
'
'
'
'' Get the Original Images Width and Height props
'lngRet = apiGetObject(hStdPic, Len(Bm), Bm)
'
'' Can we read the picture dimensions
'If Bm.bmWidth <= 0 Then
' Err.Raise vbObjectError + 524, "CreateBitmapFromImageCtl.modStdPic", _
' "Sorry...cannot read Image Dimensions. Please Select a Valid JPEG or GIF File"
'End If
'
'' Clear our DIBSection
'm_cDib.CleanUp
'
'' Create a buffer of sufficient size to hold the image:
' 'If Not (m_cDib.Create(Bm.bmWidth, Bm.bmHeight, Bm.bmBitsPixel / 8)) Then
' 'fStdPicToImageData = False
' 'Exit Function
' 'End If
'm_cDib.Create Bm.bmWidth, Bm.bmHeight, Bm.bmBitsPixel / 8
'
'
'' Set the Dimensions of the Image Control
'' to the actual size of the graphic we are displaying.
'' For fun let's not convert pixels to TWIPS since
'' we always do it that way. Let's be different and
'' convert the StdPicture Height & Width props directly.
'' These are in a Map Mode of HiMetric units, expressed in .01 mm units.
'
'Dim sngConvertX As Single
'Dim sngConvertY As Single
'
'' Convert to CM
'sngConvertX = hStdPic.width * 0.001
'sngConvertY = hStdPic.Height * 0.001
'
''Convert to Inches
'sngConvertX = sngConvertX / 2.54
'sngConvertY = sngConvertY / 2.54
'
''Convert to TWIPS
'sngConvertX = sngConvertX * 1440
'sngConvertY = sngConvertY * 1440
'
'' Error check to ensure we do not exceed
'' SubForm boundaries
'If sngConvertX < ctl.Parent.width Then
' ctl.width = sngConvertX
'Else
' ctl.width = ctl.Parent.width - 200
'End If
'
'If sngConvertY < ctl.Parent.Detail.Height Then
' ctl.Height = sngConvertY
'Else
' ctl.Height = ctl.Parent.Detail.Height - 200
'End If
'
'' Select our Image into its DC
'hBmapOrig = apiSelectObject(hdc, hStdPic)
'
''' Create our Enhanced Metafile - Memory Based
''hDCMeta = apiCreateEnhMetaFile(hDCref, vbNullString, 0&, vbNullString)
''
''If hDCMeta = 0 Then
'' Err.Raise vbObjectError + 525, "CreateBitmapFromImageCtl.modStdPic", _
'' "Sorry...cannot Create Enhanced Metafile"
''End If
'
'' Copy the contents of our StdPicture object over
'' into the DIBSection class 'Enhanced Metafile we created.
''lngRet = apiBitBlt(hDCMeta, 0&, 0&, Bm.bmWidth, _
' ' Bm.bmHeight, hdc, 0, 0, SRCCOPY)
'm_cDib.PaintPicture hdc, 0, 0, Bm.bmWidth, Bm.bmHeight, 0, 0, SRCCOPY
'' Now copy the bits to our Image control's PictureData prop
'm_cDib.DIBtoPictureData ctl
'
'
'' Cleanup our Bitmaps
'If hBmapOrig <> 0 Then
' lngRet = apiSelectObject(hdc, hBmapOrig)
' Call apiDeleteObject(hBmap)
'End If
'
'' Delete our Memory DC
'Call apiDeleteDC(hdc)
'
'' Delete our DIBSection calss
'Set m_cDib = Nothing
'
''' Close EnhMetafile
''If hDCMeta <> 0 Then
'' hMetafile = apiCloseEnhMetaFile(hDCMeta)
''End If
''
''' Grab the contents of the Metafile
''lngRet = GetEnhMetaFileBits(hMetafile, 0, ByVal 0&)
''ReDim arrayMeta((lngRet - 1) + 8)
''lngRet = GetEnhMetaFileBits(hMetafile, lngRet, arrayMeta(8))
''
''' Delete EMF memory footprint.
''lngRet = apiDeleteEnhMetaFile(hMetafile)
''
''' If the first 40 bytes of a PictureData prop are
''' not a BITMAPINFOHEADER structure then we will find
''' a ClipBoard Format structure of 8 Bytes in length
''' signifying whether a Metafile or Enhanced Metafile is present.
''' The first 8 Bytes of a PictureData prop signify
''' that the data is structured as one of the
''' following ClipBoard Formats.
''' CF_ENHMETAFILE
''' CF_METAFILEPICT
''' So the first 4 bytes tell us the format of the data.
''' The next 4 bytes point to handle for a Memory Metafile.
''' This is not needed for our construction purposes.
''arrayMeta(0) = CF_ENHMETAFILE
''
''' Copy our created PictureData bytes over to the Image Contol.
''ctl.PictureData = arrayMeta
'
'EXIT_SHOWPIC:
'Call apiDeleteDC(hdc)
'' Release our reference DC
'lngRet = apiReleaseDC(0&, hDCRef)
'Exit Function
'
'ERR_SHOWPIC:
'MsgBox Err.Description, vbOKOnly, Err.Source & ":" & Err.Number
'Resume EXIT_SHOWPIC
'
'End Function
 




 

 
 
 

May 23, 2004 Product Update
 
 
Rich Text ActiveX control. Version 1.8

Click Here!

 

Mar 15, 2005 Product Update
 
MouseHook  Replaces the MouseWheel DLL subclassing solution. Turns On/Off the MouseWheel with one line of code. No DLL registration required. Now supports Logitech mice!

Click Here! 

 

 

 
Back ] Home ] Up ] Next ] 
Stephen Lebans Copyright 2009

Last Modified : 09/11/09 12:03 AM