|
|
|
|
#1 |
|
Senior Member
Join Date: May 2009
Posts: 152
|
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:
|
|
|
|
|
|
#2 | |
|
Major Dude
Join Date: Jun 2001
Posts: 1,173
|
Quote:
|
|
|
|
|
|
|
#3 |
|
Moderator
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
|
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 |
|
|
|
|
|
#4 | ||
|
Major Dude
Join Date: Jun 2001
Posts: 1,173
|
Quote:
Quote:
![]() http://source.winehq.org/source/include/oleauto.h |
||
|
|
|
|
|
#5 |
|
Senior Member
Join Date: May 2009
Posts: 152
|
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 Last edited by Zinthose; 19th August 2010 at 22:00. Reason: Update [BSTR] |
|
|
|
|
|
#6 |
|
Member
Join Date: Nov 2009
Posts: 52
|
Is it index 6 ? See, http://www.clarionopensource.com/Cla...hInterface.htm
I was recently fighting with something similar, ITypeLib
|
|
|
|
|
|
#7 |
|
Senior Member
Join Date: May 2009
Posts: 152
|
Woot! It was the BSTR!
PHP Code:
|
|
|
|
|
|
#8 |
|
Senior Member
Join Date: May 2009
Posts: 152
|
Just a warning... if anyone is playing around with this.. check your TaskManager.. I just found 23 instances of Excel running.....
![]() Here is the updated code with the COM Release at the end. PHP Code:
|
|
|
|
|
|
#9 |
|
Major Dude
Join Date: Jun 2001
Posts: 1,173
|
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
|
|
|
|
|
|
#10 |
|
Senior Member
Join Date: May 2009
Posts: 152
|
Good idea!!
Here is what I thew together.. needs more optimizations but it's a good start.. PHP Code:
|
|
|
|
|
|
#11 |
|
Moderator
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,442
|
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)
IntOp $PostCount $PostCount + 1 |
|
|
|
![]() |
|
|||||||
| Tags |
| system::call ole32 com |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|