IPicture::get_Type
Returns the current type of the picture contained in the picture object.HRESULT get_Type(
  short* ptype  //Receives a pointer to the picture type
);
Parameters
ptype 
[out] Pointer to the caller's short variable to receive the picture type. The Type property can have any one of the values contained in the PICTYPE enumeration. 
Return Values
This method supports the standard return value E_FAIL, as well as the following: S_OK 
The type was returned successfully. 
E_POINTER 
The address in ptype is not valid. For example, it may be NULL. 

解决方案 »

  1.   

    PICTYPE
    The PICTYPE enumeration values are used to describe the type of a picture object as returned by IPicture::get_Type, as well as to describe the type of picture in the picType field of the PICTDESC structure that is passed to OleCreatePictureIndirect.typedef enum tagPICTYPE
    {
        PICTYPE_UNINITIALIZED    = -1,
        PICTYPE_NONE             = 0,
        PICTYPE_BITMAP           = 1,
        PICTYPE_METAFILE         = 2,
        PICTYPE_ICON             = 3
        PICTYPE_ENHMETAFILE      = 4
    } PICTYPE;Elements
    PICTYPE_UNINITIALIZED 
    The picture object is currently uninitialized. This value is only valid as a return value from IPicture::get_Type and is not valid with the PICTDESC structure. 
    PICTYPE_NONE 
    A new picture object is to be created without an initialized state. This value is valid only in the PICTDESC structure. 
    PICTYPE_BITMAP 
    The picture type is a bitmap. When this value occurs in the PICTDESC structure, it means that the bmp field of that structure contains the relevant initialization parameters. 
    PICTYPE_METAFILE 
    The picture type is a metafile. When this value occurs in the PICTDESC structure, it means that the wmf field of that structure contains the relevant initialization parameters. 
    PICTYPE_ICON 
    The picture type is an icon. When this value occurs in the PICTDESC structure, it means that the icon field of that structure contains the relevant initialization parameters. 
    PICTYPE_ENHMETAFILE 
    The picture type is a Win32-enhanced metafile. When this value occurs in the PICTDESC structure, it means that the emf field of that structure contains the relevant initialization parameters. 
      

  2.   

    如果是gif或者jpg的图像,我如何知道其格式呢?