DefaultInterface.QueryInterface - WeOnlyDo Discussion board

DefaultInterface.QueryInterface (wodCrypt)

by dandraka, Friday, February 18, 2005, 14:10 (6978 days ago)


Hi there,

in the wodCrypto samples, right before the .Encrypt (or decrypt) there are the lines:
inblob.DefaultInterface.QueryInterface(WODCRYPTCOMLib_TLB.IID_IBlob, inb);
outblob.DefaultInterface.QueryInterface(WODCRYPTCOMLib_TLB.IID_IBlob, outb);

I have only a vague understanding of what this does, and this makes me a little nervous [:uhoh:]. Can you point me to some explanation ?

And another related question: For fileblobs, does it matter if the filename (inblob.filename) is set before or after the DefaultInterface.QueryInterface ?

Thanks for your time,

Dimitris Andrakakis

Re: DefaultInterface.QueryInterface

by wodSupport, Friday, February 18, 2005, 15:58 (6978 days ago) @ dandraka

Dandraka,

to explain in common words - QueryInterface returns Blob type from FileBlob. As you may guessed, FileBlob is based on Blob type. Since wodCrypt requires Blob type, QueryInterface casts (in COM terms) from FileBlob to Blob, so wodCrypt accepts it properly.

It doesn't matter if you set Filename before this case or after it - reference always points to exactly the same object.

Hope it helps.