Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

OleVariant -> IPictureDisp

Status
Not open for further replies.

Tilen

Programmer
Apr 2, 2005
75
SI
Hi

I have two properties, VariantTag (OleVariant) and Picture (IPictureDisp) on an object 'Box'. In order to hide image/picture, I need to put Picture into VariantTag and set Picture = nil. This way the image is not shown, but stored at the same time, so we don't loose it.

to hide image:

Box.VariantTag:=Box.Picture;
Box.Picture:=nil;

The problem is when I would like to show the image. So I need to get it back from VariantTag into Picture.

Box.Picture := Box.VariantTag;

well, the compiler doesn't like this.

I tried some of the SetOlePicture and GetOlePicture examples, but either I don't know how to use these functions, or it's not possible.

I hope someone can help me with this.

Thank you

Tilen
 
Found it:


var picDis:IPictureDisp;
begin
...

If VarSupports(vBox.VariantTag, IPictureDisp, picDis) then
vBox.Picture:=picDis;

...

Well, I don't really understand how this works, or if proper syntax should be any other way, but it works!

I hope someone else will also find this helpful.

Tilen
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top