• Welcome to Theos PowerBasic Museum 2017.

Interface data types in TYPES

Started by Paul Squires, November 05, 2009, 11:41:26 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Paul Squires

Hi Everyone,

Am I correct in assuming that a reference to an Interface can be a data member of TYPE definition? I don't think so.

Something like:

TYPE MyType
   iMyClass As MyInterface
END TYPE

MyInterface would be defined in an earlier Class definition.

If it is not supported then would a good alternative be to define it as a DWord (iMyClass As DWord) and then somehow (Poke?) do the assignment to a locally declared variable for the MyInterface and handle the .AddRef stuff?


Paul Squires
FireFly Visual Designer SQLitening Database System JellyFish Pro Editor
http://www.planetsquires.com

José Roca

 
It is not currently supported.

Using a DWORD is the only possible workaround, but you have to manage the reference count by yourself, calling IUnknown::AddRef to make sure that the reference will be valid, converting it to an object variable to be able to use it and calling IUnknown::Release before the variable DIMed as your structure goes out of scope.

Paul Squires

That's what I figured. Thanks.

I thought that we had discussed this before but I couldn't find it in my notes or the forum so I thought that I'd better ask just to be safe.

Paul Squires
FireFly Visual Designer SQLitening Database System JellyFish Pro Editor
http://www.planetsquires.com