![]() |
Playing with COM
I'm attempting to recreate the example posted at: http://en.wikipedia.org/wiki/OLE_Automation#Examples
My code is choking at GetIDsOfNames... Can anyone add some insight? PHP Code:
|
Quote:
|
It's the zero-based index of the method as it is listed physically in the interface. This includes methods from interfaces that the interface you are using implements. As IUnknown has 3 methods, your first interface method will typically be #3.
Stu |
Quote:
Quote:
http://source.winehq.org/source/include/oleauto.h |
Aight... Using the VTable index to lookup the interfaces methods I have now updated with the following..
PHP Code:
UPDATE: I'm convinced it is the BSTR.. Reading up on how to implement them now... http://msdn.microsoft.com/en-us/library/ms221069.aspx |
Is it index 6 ? See, http://www.clarionopensource.com/Cla...hInterface.htm
I was recently fighting with something similar, ITypeLib :) |
Woot! It was the BSTR!
PHP Code:
|
Just a warning... if anyone is playing around with this.. check your TaskManager.. I just found 23 instances of Excel running..... :eek:
Here is the updated code with the COM Release at the end. PHP Code:
|
heehee
good job :) one thing you might want to do, just for readability, is defining the interface bits.. e.g. !define GetIDsOfNames 5 or even !define IDispatch->GetIDsOfNames 5 Then later on you can just use.. ${IDispatch->GetIDsOfNames} (g ${IID_NULL, etc. ..bit cleaner to read :) |
Good idea!!
Here is what I thew together.. needs more optimizations but it's a good start.. PHP Code:
|
I have been using some helper macros that are very similar to this (See http://nsis.pastebin.com/BqQFTRv3 ) but I also declare the parameter types in my "_COM_Function" macro so you don't have to specify them when you invoke the method (Can also be used to set default parameter values IIRC) I also use -> and not ::. It might be a good idea to come up with a standard and include it in some header (There is no way we can define all COM interfaces, but some of the shell interfaces would be a good start)
|
| All times are GMT. The time now is 18:03. |
Copyright © 1999 - 2010 Nullsoft. All Rights Reserved.