I am a C programmer, but I am new to Windows & COM programming.
For the following C# code:
//Change the font of the selected text in the running PowerPoint.
Application app = Marshal.GetActiveObject("Powerpoint.Application");
app.ActiveWindow.Selection.TextRange.Font = ...;
I know how to write the corresponding OLE code in C. To recap briefly:
- Call GetActiveObject to get the IUnknown interface of the application;
- Call IUnknown_QueryInterface to get the IDispatch of the application;
- Call IDispatch_GetIDsOfNames and IDispatch_Invoke with DISPATCH_PROPERTYGET to get the named property of the current IDispatch.
- Repeat Step 2 to Step 4, until we reach the second innermost property(that is TextRange in the above example).
- Call IDispatch_GetIDsOfNames and IDispatch_Invoke with DISPATCH_PROPERTYPUT to set the value of innermost property(that is Font in the above example).
here comes the question: What if a property is an "array"? For example, given the following C# code:
Application app = Marshal.GetActiveObject("Illustrator.Application");
foreach (object textFrame in app.ActiveDocument.TextFrames)
...;
The above C# code iterates every text frame from the TextFrames "array", I have no idea of the corresponding C code for "iterating" such a property in C. I have searched through the Internet and Microsoft development references, but failed to get any clue.
How do I get members from an "array" property using C?