Class: cComStdPicture

Properties  Events  Methods    Index of Classes

OLE conventions implement pictures as Automation objects that contain the properties of the picture

Hierarchy

cObject
---DfComAutomationObject
------cComAutomationObject
---------cComStdPicture

Library: Common (Windows and Web Application) Class Library

Package: StdPicture.pkg

Mixins: cComPicture

Description

OLE conventions implement pictures as Automation objects that contain the properties of the picture. An object of this class manages a bitmap, icon or metafile picture.

In many cases a COM object provides some way of changing a component's bitmap, icon or metafile. In this case you can access the picture by creating an instance of the cComStdPicture wrapper class and connect it to the OLE bitmap, icon or metafile.

Typically, the COM object that you are dealing with will provide access to the object by providing a function that returns an IDispatch* value that points to it. You would then set the cComStdPicture object's pvComObject property to the IDispatch* value to connect it with the OLE bitmap, icon or metafile.

You can create a new bitmap, icon or metafile object by sending CreateComObject to an instance of cComStdPicture.

Sample

Use StdPicture.pkg

Procedure ShowImageInfoFromFile String sFileName Global
    Handle hoPicture
    Variant vPicture
    Integer iHeight iWidth

    Get Create (RefClass (cComStdPicture)) to hoPicture
    Get ComLoadPicture sFileName to vPicture
    Set pvComObject of hoPicture to vPicture
    Get ComHeight of hoPicture to iHeight
    Get ComWidth of hoPicture to iWidth

    Send Info_Box (SFormat ("Image dimensions: %1 x %2", iHeight, iWidth))
    Send Destroy of hoPicture
End_Procedure

Send ShowImageInfoFromFile "c:\MyImages\Photo 06-03-2021.bmp"
Send ShowImageInfoFromFile "CLIPBOARD:"

See Also

cComAutomationObject | cComStdFont