Link to home
Start Free TrialLog in
Avatar of mjwilliamson
mjwilliamson

asked on

LPUNKNOWN Get_NewEnum()

Hi

I want to get a enumeration for a excel range using automation in MFC.
I think I need to use

LPUNKNOWN Get_NewEnum()

only I can't find any examples on how you would then use this
LPUNKNOWN.

Anyone had the pleasure!
Avatar of Salte
Salte

LPUNKNOWN is a COM interface thingy.

It is the basic interface that all COM interfaces inherits from and expands.

The LPUNKNOWN have only 1 function of interest:

QueryInterface()

You pass it an argument identifying the interface you want to use (The particular interface depends on what the object in Excel you want to access is, for an Excel range you pass the interface GUID value for excel ranges :-))

If the specified object has the interface you query about it will return a pointer to a new object type which isn't LPUNKNOWN but is a pointer to the object type you want to get. That object type will then have methods that are specific to that object type and defined in a C++ class wrapper for that COM object.

If the object do not support the interface you query about it will return a NULL pointer.

The LPUNKNOWN interface has - as far as I know - only two additional methods one to add a reference to the object and one to delete a reference to the object.

Hope this helps.

Alf
Avatar of mjwilliamson

ASKER

thanks

do you know of any good examples of using
QueryInterface, I think I need and IEnumVARIANT pointer

ASKER CERTIFIED SOLUTION
Avatar of Salte
Salte

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Answered: Points to Salte

Please leave any comments here within the next seven days. Experts: Silence
means you don't care.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

-bcl (bcladd)
EE Cleanup Volunteer