Using the Active/X component wizard, I wrapped a set of COM objects provided
by Quiksoft that access and manage POP3 mailboxes. One of the properties is supposed to return a collection of Messages after they are downloaded from the server. The main POP3 object, in my case EMIPOP3Main, generated a #message method, which represent the property that holds a collection of message objects downloaded from the server. According to the documentation, this is supposed to return the collection object EMIPOP3Messages, which is also wrapped. However, when I execute the EMIPOP3Main>>#messages method, I get an instance of IDispatch, and none of the EMIPOP3Messages work (it tries to do something via the IDispatch>>#doesNotUnderstand: protocol, and generates and error). It may be I'm expecting too much from the COM wrapper generator, but I though I would get an instance of EMIPOP3Messages from EMIPOP3Main>>#messages . The generated code for EMIPOP3Main>>#messages is: messages "Answer the <variant> value of the 'Messages' property of the receiver. Helpstring: 'property Messages'" | answer | answer := VARIANT new. self get_Messages: answer. ^answer asObject Any help appreciated - thanks - jlo |
Some further information -
Even though an instance of IDispatch is returned, the IDispatch>>#doesNotUnderstand: logic allows the #count method to be sent, and it returns the value I expect (1). However, it does not allow the #item: method to be sent. The IDispatch>>#doesNotUnderstand: does find the dispatch id of #item: (0), but when it executes the method on IDispatch>>#invokeId:flags:parms:retVal:, it gets error number: -2147352573, which translates to message "Member not Found". I'm passing the parameter 1 to it. I tried passing the parater 0 to it, as sometimes the COM collections are zero based, but I got the same result. Any insights welcome - TIA - jlo |
In reply to this post by Jeffrey Odell-2
Jeffrey Odell wrote:
> Using the Active/X component wizard, I wrapped a set of COM objects provided > by Quiksoft that access and manage POP3 mailboxes. One of the properties is > supposed to return a collection of Messages after they are downloaded from > the server. > > The main POP3 object, in my case EMIPOP3Main, generated a #message method, > which represent the property that holds a collection of message objects > downloaded from the server. According to the documentation, this is > supposed to return the collection object EMIPOP3Messages, which is also > wrapped. However, when I execute the EMIPOP3Main>>#messages method, I get > an instance of IDispatch, and none of the EMIPOP3Messages work (it tries to > do something via the IDispatch>>#doesNotUnderstand: protocol, and generates > and error). > > It may be I'm expecting too much from the COM wrapper generator, but I > though I would get an instance of EMIPOP3Messages from > EMIPOP3Main>>#messages . > > The generated code for EMIPOP3Main>>#messages is: > > messages > "Answer the <variant> value of the 'Messages' property of the receiver. > Helpstring: 'property Messages'" > | answer | > answer := VARIANT new. > self > get_Messages: answer. > ^answer asObject > Jeff, I wonder if the EMIPOP3Messages is supposed to be an enumerator interface to a collection of messages. Since you're getting an IDispatch back (presumably pointing to some valid COM object), you might try modifying the messages method to do something like: ... ^answer asObject queryInterface: EMIPOP3Messages. I can't help but wonder if you have hold of the correct COM object, but just need to get the right interface on it. You might be able to send that item: message. Just a thought, Eric > Any help appreciated - thanks - > > jlo > > > |
Yes! That was it. The wrapper caused the parameter to be set up slightly
differently. I had to do the same thing on the #item: method of the EMIPOP3Messages to turn the result into the individual message object, EMIPOP3Message in my case. Thanks for the pointer - I was looking for methods on the superclass of IDispatch to set up the generated wrappers around the IDispatch but didn't find it there. Blair/Andy - if you think the generator should have taken care of this, I can provide the examples you need. In the mean time, Eric has provided a work-around to get me moving. Thanks again, Eric - jlo "Eric Winger" <[hidden email]> wrote in message news:[hidden email]... > > > Jeffrey Odell wrote: > > > Using the Active/X component wizard, I wrapped a set of COM objects provided > > by Quiksoft that access and manage POP3 mailboxes. One of the properties is > > supposed to return a collection of Messages after they are downloaded from > > the server. > > > > The main POP3 object, in my case EMIPOP3Main, generated a #message method, > > which represent the property that holds a collection of message objects > > downloaded from the server. According to the documentation, this is > > supposed to return the collection object EMIPOP3Messages, which is also > > wrapped. However, when I execute the EMIPOP3Main>>#messages method, I get > > an instance of IDispatch, and none of the EMIPOP3Messages work (it tries to > > do something via the IDispatch>>#doesNotUnderstand: protocol, and generates > > and error). > > > > It may be I'm expecting too much from the COM wrapper generator, but I > > though I would get an instance of EMIPOP3Messages from > > EMIPOP3Main>>#messages . > > > > The generated code for EMIPOP3Main>>#messages is: > > > > messages > > "Answer the <variant> value of the 'Messages' property of the receiver. > > Helpstring: 'property Messages'" > > | answer | > > answer := VARIANT new. > > self > > get_Messages: answer. > > ^answer asObject > > > > > Jeff, > > I wonder if the EMIPOP3Messages is supposed to be an enumerator > interface to a collection of messages. Since you're getting an IDispatch > back (presumably pointing to some valid COM object), you might try > modifying the messages method to do something like: > > ... > ^answer asObject queryInterface: EMIPOP3Messages. > > I can't help but wonder if you have hold of the correct COM object, but > just need to get the right interface on it. You might be able to send > that item: message. > > Just a thought, > > Eric > > > > Any help appreciated - thanks - > > > > jlo > > > > > > > |
Free forum by Nabble | Edit this page |