Name
LoadPicture Function
Syntax
LoadPicture(picturename)picturenameUse: Required
Data Type: String
The path and filename of the picture file.
Return Value
A StdPicture object.
Description
Loads a picture object.
Rules at a Glance
picturenameconsists of an optional path along with the name of a supported image file. If the path component ofpicturenameis omitted, the VBScript runtime engine attempts to find the image in the script’s current directory.picturenamecan be a bitmap (.bmp), enhanced metafile (.emf ), icon (.ico), Graphics Interchange Format (.gif ), JPEG (.jpg), run-length encoded (.rle), or Windows metafile (.wmf ).
Example
The following example loads an image into an Outlook contact form:
Function Item_Open( )
Dim oPic
Set oPic = LoadPicture("C:\windows\" & Item.FullName & ".bmp")
Set Item.GetInspector.ModifiedFormPages("General").imgContact.Picture = _
oPic
End FunctionProgramming Tips and Gotchas
The StdPicture object is defined by the OLE Automation library STDOLE2.TLB. It supports the members shown in the following table:
Name | Type | Description |
Handle | Property | Returns a handle to the image. |
Height | Property | Indicates the height of the image in HiMetric units. |
hPal | Property | Returns a handle to the Picture object’s palette. |
Render | Method | Draws all or part of the image to a destination object. |
Type | Property | Returns the Picture object’s graphics format. Possible values are 0 (none), 1 (bitmap), 2 (metafile), 3 (icon), and 4 (enhanced metafile). |
Width | Property | Indicates the width of the image in HiMetric ... |
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access