|
-
March 16th, 1999, 09:33 AM
#1
QueryIntreface
Hello.
If a COM Object has two intefaces, how do I reach the second interface from the first one, like you do with QueryInterface in C++ ?.
Regards
Martin
-
March 16th, 1999, 08:32 PM
#2
Re: QueryIntreface
If you want to do it C++ way I don't think it's possible. Maybe you can call C++ function & get pointer to the interface. But you won't be able to call functions as pointer arithmatic & calling functions by pointer is not possible in VB.
So VB makes life easier by asking user to reference the type library at design time. That way it saves classids in design time. Then, it allows user to use interfaces as if they are classes. So you really don't get new interface pointer from other interface pointer you have. Instead (may be) VB gets all of them right in the beginning(???). So they are available all the time.
User's job is to use them.
-
August 25th, 1999, 12:25 PM
#3
Re: QueryIntreface
If a coclass (ProgID is MyLib.Dog) implents two intefaces, iAnimal and iDog then you create an instange of Class Dog...
Dim id as iDog 'declare pointer to interface
Dim ia as iAnimal 'declare pointer to interface
set id = new dog 'this creates a coclass of AND does QueryInterface to get its dog interface!
set ia = id 'this does just QI and now we have access to the animal interface
Also:
If dog is typeof iAnimal then ...
does QI on dog to see if it supports the iAnimal interface.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|