 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Al Guest
|
Posted: Mon Apr 05, 2004 2:58 pm Post subject: No such interface supported |
|
|
I have an OLE object embedded in an OleContainer. I imported their
TLB and everything is basically working just fine. However, I need to
respond to an onchange event they will be triggering. I have an event
dispatcher class something like this:
class TMyEventSink : public TEventDispatcher <TMyEventSink,
&DIID_ISomeServer>
{
private:
ISomeServerPtr server;
protected:
HRESULT InvokeEvent(DISPID id, TVariant *params);
public:
TMyEventSink() { };
~TMyEventSink() { };
int Connect(ISomeServerPtr svr)
{
server = svr;
server->AddRef();
return ConnectEvents(server);
}
void Disconnect()
{
server->Release();
}
};
In my header file I have:
ISomeServerPtr Server;
TMyEventSink es;
In my FormShow I have:
OleContainer1->Run();
Server = OleContainer1->OleObjectInterface;
Server->StartUp(...); // something they need me to do --
works fine
OleContainer1->DoVerb(-1);
int i = es.Connect(Server);
The ConnectEvents in my Connect function produces the error
"'p->QueryInterface(GetIID(), (LPVOID*)(&intf))': No such interface
supported ..." Like I said, if I remove the ConnectEvents everything
works fine (except I will never be notified of they event they have
for me).
Thanks for the help.
Al
|
|
| Back to top |
|
 |
Al Guest
|
Posted: Mon Apr 12, 2004 1:17 pm Post subject: Re: No such interface supported |
|
|
Still stuck on this problem. Can anybody help? Am I on the wrong
track completely?
Thanks, Al
|
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Mon Apr 12, 2004 4:53 pm Post subject: Re: No such interface supported |
|
|
"Al" <alanc (AT) jancointernational (DOT) com> wrote
| Quote: | server = svr;
server->AddRef();
|
You are calling AddRef() one too many times. The ISomeServerPtr is already
performing an AddRef() internally.
| Quote: | server->Release();
|
Use server.Unbind() instead of server->Release().
| Quote: | The ConnectEvents in my Connect function produces the error
|
Does the COM object in question support IConnectionPointContainer to begin
with? Chances are, it does not. That would be the only way ConnectEvents()
could be throwing the particular error that you mentioned.
Gambit
|
|
| Back to top |
|
 |
Al Guest
|
Posted: Tue Apr 20, 2004 3:15 pm Post subject: Re: No such interface supported |
|
|
| Quote: |
The ConnectEvents in my Connect function produces the error
Does the COM object in question support IConnectionPointContainer to begin
with? Chances are, it does not. That would be the only way ConnectEvents()
could be throwing the particular error that you mentioned.
|
I've been told to check into IAdviseSink. Is that lots different than
what I was trying? If so, can you give some guidance/example of how I
would accomplish what I need to do using that instead? Or do you know
where else I could see a decent example that I could use as a guide?
Thanks
|
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Tue Apr 20, 2004 5:24 pm Post subject: Re: No such interface supported |
|
|
"Al" <alanc (AT) jancointernational (DOT) com> wrote
| Quote: | I've been told to check into IAdviseSink.
|
I would not have told you that. IAdviseSink is used for containers to
notify client objects of events. You are going the other way around, having
the client object notify the containing application of events instead.
When you created your COM object, you probably simply didn't enable the
"Generate Event Support" option in the wizard. Just add a new DispInterface
to your TypeLibrary with the desired events, then add
IConnectionPointContainterImpl to your Impl class's ancestor classes that it
derives from, then add the IConnectionPointContainer interface to your Impl
class's COM_MAP, and then a CONNECTION_POINT_MAP. For example:
class ATL_NO_VTABLE TMyObjectImpl :
//...
public IConnectionPointContainerImpl<TMyObjectImpl>,
public TEvents_MyObject<TMyObjectImpl>, //<-- class which contains the
Fire_...() methods for the events
//...
{
public:
//...
BEGIN_COM_MAP(TMyObjectImpl)
//...
COM_INTERFACE_ENTRY_IMPL(IConnectionPointContainer)
//...
END_COM_MAP()
//...
BEGIN_CONNECTION_POINT_MAP(TMyObjectImpl)
CONNECTION_POINT_ENTRY(DIID_IMyObjectEvents)
END_CONNECTION_POINT_MAP()
};
Otherwise, just start your project over, making sure that the "Generate
Events Support" option was enabled in the first place so that the proper
skeleton code is actually generated.
| Quote: | Is that lots different than what I was trying?
|
Yes.
Gambit
|
|
| Back to top |
|
 |
Al Guest
|
Posted: Tue Apr 20, 2004 7:47 pm Post subject: Re: No such interface supported |
|
|
| Quote: | When you created your COM object, you probably simply didn't enable the
"Generate Event Support" option in the wizard.
|
Am I missing something or perhaps I didn't explain well enough --
basically all I've done is import their TLB, added an OleContainer to
a form, right-clicked on it and inserted their object. Which now
leaves me with the issue of responding to one of their events. Was I
also supposed to create a COM Object? Forgive me, I'm new to this.
For what it's worth, I just tried that and was told "The selected
interface is neither Dual or Custom."
Thanks for your help on this, I really appreciate it.
Al
|
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Tue Apr 20, 2004 8:13 pm Post subject: Re: No such interface supported |
|
|
"Al" <alanc (AT) jancointernational (DOT) com> wrote
| Quote: | Am I missing something or perhaps I didn't explain well
enough -- basically all I've done is import their TLB,
added an OleContainer to a form, right-clicked on it
and inserted their object.
|
I thought you were creating your own control.
| Quote: | Which now leaves me with the issue of responding to
one of their events.
|
If ConnectEvents() is failing on an imported control, then that control does
not support IConnectionPointContainer to begin with. In which case, you
can't use TEventDispatcher with that control. If there really are events
available for that control, then they must have exposed them differently.
You will have to ask them what they are actually expecting.
| Quote: | Was I also supposed to create a COM Object?
|
No.
Gambit
|
|
| Back to top |
|
 |
Michael Harris Guest
|
Posted: Tue Apr 20, 2004 10:59 pm Post subject: Re: No such interface supported |
|
|
The event dispatcher class is close enough to get the event sink if it is
provided.
I would guess the problem is the Olecontainer is not who is providing
events.
In the imported TLB file you mentioned, Look for
'IConnectionPointImpl'.
the comment above woill look similar to
// *********************************************************************//
// CONNECTIONPOINT/EVENT PROXY
// CoClass : xxx
// Event Interface : xxxEvents
// *********************************************************************//
where xxx represents the name of interface(s).
find the event . find the connection point .
find the interface.
QI on the Container or 'GetControllingUnknown' for that interface.
Pass it to the event dispatcher class .
Alternatively, you could mention the name of the TLB or embedded object and
someone here may have been there / done that.
--
Michael
"Al" wrote in message
| Quote: | When you created your COM object, you probably simply didn't enable the
"Generate Event Support" option in the wizard.
Am I missing something or perhaps I didn't explain well enough --
basically all I've done is import their TLB, added an OleContainer to
a form, right-clicked on it and inserted their object. Which now
leaves me with the issue of responding to one of their events. Was I
also supposed to create a COM Object? Forgive me, I'm new to this.
For what it's worth, I just tried that and was told "The selected
interface is neither Dual or Custom."
Thanks for your help on this, I really appreciate it.
Al
|
|
|
| Back to top |
|
 |
Al Guest
|
Posted: Wed Apr 21, 2004 5:16 pm Post subject: Re: No such interface supported |
|
|
Michael,
I searched for this:
| Quote: | In the imported TLB file you mentioned, Look for
'IConnectionPointImpl'.
the comment above woill look similar to
// *********************************************************************//
// CONNECTIONPOINT/EVENT PROXY
// CoClass : xxx
// Event Interface : xxxEvents
// *********************************************************************//
|
but unfortunately the event line is empty:
// Event Interface :
Am I to assume this lib doesn't support IConnectionPointContainer and
can't use ConnectEvents()? If not, where do I go from there? Is the
IAdviseSink the way to go? I'm very new to this and appreciate any
input and/or examples.
FYI - the TLB is only used by a handful of companies.
Thanks,
Al
|
|
| Back to top |
|
 |
Michael Harris Guest
|
Posted: Thu Apr 22, 2004 1:37 pm Post subject: Re: No such interface supported |
|
|
IAdviseSink may be the only choice. It might be that a custom interface is
used for events. But I would need to see the tlb.h to determine that.
"Al" wrote in message
| Quote: | Am I to assume this lib doesn't support IConnectionPointContainer and
can't use ConnectEvents()? If not, where do I go from there? Is the
IAdviseSink the way to go? I'm very new to this and appreciate any
input and/or examples.
FYI - the TLB is only used by a handful of companies.
Thanks,
Al
|
|
|
| Back to top |
|
 |
Al Guest
|
Posted: Thu Apr 22, 2004 2:05 pm Post subject: Re: No such interface supported |
|
|
Michael,
| Quote: | IAdviseSink may be the only choice. It might be that a custom interface is
used for events. But I would need to see the tlb.h to determine that.
|
I would be very happy to let you look at whatever you like. If you're
willing you can email me at [email]alanc (AT) jancointernational (DOT) com[/email] and I'll
reply back with what you need.
Thanks
|
|
| Back to top |
|
 |
Michael Harris Guest
|
Posted: Tue Apr 27, 2004 12:06 pm Post subject: Re: No such interface supported |
|
|
If anyone is interested, this has been sorted out...
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|