Click here to Skip to main content
15,894,955 members
Home / Discussions / COM
   

COM

 
GeneralCOM+ Programmers/Trainers Pin
28-Jun-01 6:55
suss28-Jun-01 6:55 
GeneralAsync Queries + ADO Pin
Mukesh27-Jun-01 19:46
Mukesh27-Jun-01 19:46 
GeneralClass address with & Pin
27-Jun-01 16:59
suss27-Jun-01 16:59 
GeneralAdding a User Control Pin
27-Jun-01 3:30
suss27-Jun-01 3:30 
GeneralRe: Adding a User Control Pin
10-Jul-01 3:41
suss10-Jul-01 3:41 
GeneralImage previews in Windows 2000 Pin
Frank Oquendo25-Jun-01 18:17
Frank Oquendo25-Jun-01 18:17 
QuestionSetting up an ImageList at runtime? Pin
Jack Mott25-Jun-01 5:25
Jack Mott25-Jun-01 5:25 
QuestionAdding another IDispatch derived interface? Pin
Dave_25-Jun-01 4:31
Dave_25-Jun-01 4:31 
I cannot add a second interface (derived from IDispatch). I have a feeling I am doing something fundamentally wrong (like maybe it can't be done?).
Here is the code:

// TestDisp.idl : IDL source for TestDisp.dll
//

// This file will be processed by the MIDL tool to
// produce the type library (TestDisp.tlb) and marshalling code.

import "oaidl.idl";
import "ocidl.idl";
[
object,
uuid(050877DD-6973-11D5-BF78-0050DA22A717),
dual,
helpstring("IObj1 Interface"),
pointer_default(unique)
]
interface IObj1 : IDispatch
{
[id(1), helpstring("method FirstMethod")] HRESULT FirstMethod(BSTR Junk);
};
//Added:
[
object,
uuid(050877DD-6973-11D5-BF78-0050DA22A718),
dual,
helpstring("IObj2 Interface"),
pointer_default(unique)
]
//Added:
interface IObj2 : IDispatch
{

[helpstring("method Method2")] HRESULT Method2(BSTR Crud);
};

[
uuid(050877D0-6973-11D5-BF78-0050DA22A717),
version(1.0),
helpstring("TestDisp 1.0 Type Library")
]
library TESTDISPLib
{
importlib("stdole32.tlb");
importlib("stdole2.tlb");

[
uuid(050877DE-6973-11D5-BF78-0050DA22A717),
helpstring("Obj1 Class")
]
coclass Obj1
{
[default] interface IObj1;
interface IObj2; //Added
};
};

// Obj1.h : Declaration of the CObj1

#ifndef __OBJ1_H_
#define __OBJ1_H_

#include "resource.h" // main symbols

/////////////////////////////////////////////////////////////////////////////
// CObj1

//< AND > Characters changed to [ and ], since I can't figure
//out how to get them to display in a web page properly!

class ATL_NO_VTABLE CObj1 :
public CComObjectRootEx[CComSingleThreadModel],
public CComCoClass[CObj1, &CLSID_Obj1],
public IDispatchImpl[IObj1, &IID_IObj1, &LIBID_TESTDISPLib],
public IDispatchImpl[IObj2, &IID_IObj2, &LIBID_TESTDISPLib] //Added (this creates the error)
{
public:
CObj1()
{
}

DECLARE_REGISTRY_RESOURCEID(IDR_OBJ1)

DECLARE_PROTECT_FINAL_CONSTRUCT()

BEGIN_COM_MAP(CObj1)
COM_INTERFACE_ENTRY(IObj1)
COM_INTERFACE_ENTRY(IObj2) //Added
COM_INTERFACE_ENTRY(IDispatch)
END_COM_MAP()

// IObj1
public:
STDMETHOD(FirstMethod)(BSTR Junk);
};

#endif //__OBJ1_H_


Here is the error I get:

testdisp\obj1.h(28) : error C2594: 'static_cast' : ambiguous conversions from 'class CObj1 *' to 'struct IDispatch *'Confused | :confused:
AnswerRe: Adding another IDispatch derived interface? Pin
Alwin7530-Oct-01 11:14
Alwin7530-Oct-01 11:14 
GeneralReturning IPictureDisp in ATL Pin
23-Jun-01 22:14
suss23-Jun-01 22:14 
GeneralRe: Returning IPictureDisp in ATL Pin
Bjarke Viksoe24-Jun-01 3:03
Bjarke Viksoe24-Jun-01 3:03 
GeneralMFC ActiveX Pin
Merl'23-Jun-01 1:28
Merl'23-Jun-01 1:28 
GeneralError generating type library Pin
Yamuna22-Jun-01 22:47
Yamuna22-Jun-01 22:47 
QuestionHow can i use the UDP on the web ?? Pin
khamis22-Jun-01 7:56
khamis22-Jun-01 7:56 
GeneralDCOM Pin
22-Jun-01 1:45
suss22-Jun-01 1:45 
GeneralReleated Problem Pin
21-Jun-01 3:58
suss21-Jun-01 3:58 
Questionhow to download & install OCX with higher ver number Pin
Bartek21-Jun-01 2:43
Bartek21-Jun-01 2:43 
GeneralPassing IDispatch pointer to C++ Pin
20-Jun-01 11:42
suss20-Jun-01 11:42 
GeneralRe: Passing IDispatch pointer to C++ Pin
20-Jun-01 16:02
suss20-Jun-01 16:02 
GeneralRe: Passing IDispatch pointer to C++ Pin
Holger Persch20-Jun-01 19:51
Holger Persch20-Jun-01 19:51 
GeneralRe: Passing IDispatch pointer to C++ Pin
21-Jun-01 4:07
suss21-Jun-01 4:07 
Generalusing com objects Pin
parag20-Jun-01 5:02
parag20-Jun-01 5:02 
Questionloading activex? Pin
19-Jun-01 22:28
suss19-Jun-01 22:28 
AnswerRe: loading activex? Pin
Amit Dey21-Jun-01 15:13
Amit Dey21-Jun-01 15:13 
QuestionHow can I access the collection of properties Pin
19-Jun-01 4:49
suss19-Jun-01 4:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.