COM Expertise needed: COM Callbacks

Nierjerson via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Apr 27 13:20:23 PDT 2017


On Thursday, 27 April 2017 at 07:51:26 UTC, John Chapman wrote:
> On Wednesday, 26 April 2017 at 23:04:53 UTC, Nierjerson wrote:
>> On Wednesday, 26 April 2017 at 15:30:37 UTC, John Chapman 
>> wrote:
>>> On Tuesday, 25 April 2017 at 18:39:56 UTC, Nierjerson wrote:
>>>> [...]
>>>
>>> When you use DISPATCH_PROPERTYPUT you need to set cNamedArgs 
>>> and rgdispidNamedArgs like so:
>>>
>>>   int dispidNamed = DISPID_PROPERTYPUT;
>>>   params.cNamedArgs = 1;
>>>   params.rgdispidNamedArgs = &dispidNamed;
>>>
>>> You should also call AddRef on any COM objects you add to 
>>> your paramVars array.
>>
>>
>> Did you try this? I tried and same issue. Are you sure the 
>> above is required? I'm not using any "named" args so not sure 
>> why it should matter?
>
> From the documentation 
> (https://msdn.microsoft.com/en-us/library/windows/desktop/ms221479(v=vs.85).aspx):
>
> "When you use IDispatch::Invoke() with DISPATCH_PROPERTYPUT or 
> DISPATCH_PROPERTYPUTREF, you have to specially initialize the 
> cNamedArgs and rgdispidNamedArgs elements of your DISPPARAMS 
> structure"
>
> Thought it might help.

Ok, thanks. I will try again, Maybe I did something wrong. It 
seems though that it isn't necessary, at least in my specific 
test case since the same behavior was seen(although it might have 
been a future bug).

I think the main issue though, is that I really don't know what 
is going on when I invoke the PS function. It seems to call the 
server method that takes the interface and then the server does 
it's "magic"(which is calling my QueryInterface) but how the 
implemented QueryInterface is suppose to respond is beyond me... 
I've tried some based stuff but nothing seem to work. The good 
news is that it is doing something(calling QueryInterface) which 
means that the server is at work.

Any more ideas?  I think the issue currently is is the 
QueryInterface(it is simply not doing what it is suppose to). 
I'll probably have to look at some other implementations to see 
what is going on.




More information about the Digitalmars-d-learn mailing list