描述:
我用mfc写的控件,有个IPictureDisp*的属性,该属性只读,,在vb\vc下没有问题,但是在delphi下使用,在窗体上添加时总是出现错误。但是,如果把该属性改成可写的,就是添加上set方法,就没有问题了!~~搞不明白啊,,
那位兄弟知道的,帮我分析分析??
解决方案1:
我估计delphi使用了IPictureDisp.set_hPal,不知你引入时是否可以控制一下
Platform SDK: COM
IPictureDisp
The IPictureDisp interface exposes the picture object's properties through Automation. It provides a subset of the functionality available through IPicture methods.
When to Implement
A picture object implements this interface along with IPicture to provide access to the picture's properties through Automation. Typically, it is not necessary to implement this interface on your own object since there is an OLE-provided picture object.
The following table describes the dispIDs for the various picture properties.
Symbol Value
DISPID_PICT_HANDLE 0
DISPID_PICT_HPAL 2
DISPID_PICT_TYPE 3
DISPID_PICT_WIDTH 4
DISPID_PICT_HEIGHT 5
DISPID_PICT_RENDER 6
Each property in the IPictureDisp interface includes a get_PropertyName method if the property supports read access and a put_PropertyName method if the property supports write access. Most of the properties support read access only with the exception of the hPal property.
Property
Type Access Allowed
Description
Handle OLE_HANDLE (int) R The Windows GDI handle of the picture
hPal OLE_HANDLE (int) RW The Windows handle of the palette used by the picture.
Type short R The type of picture (see below).
Width OLE_XSIZE_HIMETRIC (long) R The width of the picture.
Height OLE_YSIZE_HIMETRIC (long) R The height of the picture.
When to Use
Use this interface to change or retrieve the properties of a picture object.
Methods in Vtable Order
IUnknown Methods Description
QueryInterface Returns pointers to supported interfaces.
AddRef Increments reference count.
Release Decrements reference count.
Requirements
Windows NT/2000/XP: Requires Windows NT 4.0 or later.
Windows 95/98: Requires Windows 95 or later.
Header: Declared in ocidl.h.
See Also
IPicture
COM Documentation Team Release: October 2002 What did you think of this topic?
Let us know. Order a COM Documentation Team CD Online
(U.S/Canada) (International)
Requirements
Windows NT/2000/XP: Requires Windows NT 4.0 or later.
Windows 95/98: Requires Windows 95 or later.
Header: Declared in ocidl.h.
See Also
IPicture