Click here to Skip to main content
15,887,175 members
Home / Discussions / COM
   

COM

 
GeneralRe: Registering .NET DLL without regasm Pin
hasan030506911-Sep-09 22:46
hasan030506911-Sep-09 22:46 
GeneralRe: Registering .NET DLL without regasm Pin
Md. Marufuzzaman12-Sep-09 3:46
professionalMd. Marufuzzaman12-Sep-09 3:46 
QuestionCOM Connection Points: Problem to call an function out of an sink class Pin
Juergen_809-Sep-09 2:04
Juergen_809-Sep-09 2:04 
AnswerRe: COM Connection Points: Problem to call an function out of an sink class Pin
Jürgen Jung9-Sep-09 3:38
Jürgen Jung9-Sep-09 3:38 
QuestionRe: COM Connection Points: Problem to call an function out of an sink class Pin
Juergen_809-Sep-09 4:59
Juergen_809-Sep-09 4:59 
AnswerRe: COM Connection Points: Problem to call an function out of an sink class Pin
Stuart Dootson9-Sep-09 10:31
professionalStuart Dootson9-Sep-09 10:31 
QuestionShell Extension + COM permission Pin
Kedrr8-Sep-09 2:25
Kedrr8-Sep-09 2:25 
QuestionCOM Connection Points: Problem to create an instance of an sink object. Pin
Juergen_808-Sep-09 0:01
Juergen_808-Sep-09 0:01 
Hi All,

I’m an absolutely newbie in the COM technology and I have a little tricky question. I hope there’s someone out there who can help me with my problem. I have an .idl / .h / .c file and I integrated them in my VisualStudio 2005 C++ project. After that I’ve searched on the MSDN Library how I can connect an COM Server from my project. I’ve found a little example (http://msdn.microsoft.com/en-us/magazine/cc163361.aspx) and tried to do it on the same way. I’ve created an Csink class and tried to create an instance of this sink object to pass to the server. But the problem now I get from my compiler is the following error message: „error C2259: 'CSink': cannot instantiate abstract class due to following members: 'HRESULT IUnknown::QueryInterface(const IID &,void **)' : is abstract“. The thing I need is that I must call the „ OnShowMessageDlg “ and the „ OnConfigurationApply “ functions out of the .idl file in my main c++ function. I’ve put all the code here below this entry that could help you to become an overview about my problem. Is the solution I’ve tried with the sink object correct or should I use another way to do this?

Please let me know if you need any other information.

Thanks for ANY help.





*************************************************************************************************
.idl file
.
.
.
// TLib : // TLib : OLE Automation : {00020430-0000-0000-C000-000000000046}
importlib("stdole2.tlb");

// Forward declare all types defined in this typelib
interface ITEST2;
dispinterface ITESTEvents;
.
.
.
[
uuid(6775FB91-B5BE-11D6-A996-0050BA24C7B9),
version(1.1),
helpstring("Event dispatch interface for TEST")
]
dispinterface ITESTEvents {
properties:
methods:
[id(0x00000001)]
void OnConfigurationApply([in, out] VARIANT_BOOL* pAccept);
[id(0x00000002)]
void OnShowMessageDlg(
[in] IMsgDlg* pIMsg,
[out, retval] VARIANT_BOOL* Result);
};
.
.
.
.
coclass TESTv2 {
[default] interface ITEST2;
[default, source] dispinterface ITESTEvents;
};
*************************************************************************************************


.h file
.
.
.
EXTERN_C const IID DIID_ITESTEvents;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("6775FB91-B5BE-11D6-A996-0050BA24C7B9")
ITESTEvents : public IDispatch
{
};

#else /* C style interface */
typedef struct ITESTEventsVtbl
{
BEGIN_INTERFACE

HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
ITESTEvents * This,
/* [in] */ REFIID riid,
/* [iid_is][out] */ void **ppvObject);

.
.
.
*************************************************************************************************

.c file
.
.
.
MIDL_DEFINE_GUID(IID, IID_ITEST2,0xF560F761,0x2948,0x11D7,0xA9,0xBF,0x00,0x50,0xBA,0x24,0xC7,0xB9);

MIDL_DEFINE_GUID(IID, DIID_ITESTEvents,0x6775FB91,0xB5BE,0x11D6,0xA9,0x96,0x00,0x50,0xBA,0x24,0xC7,0xB9);

MIDL_DEFINE_GUID(CLSID, CLSID_TESTv2,0xF560F763,0x2948,0x11D7,0xA9,0xBF,0x00,0x50,0xBA,0x24,0xC7,0xB9);
.
.
.

*************************************************************************************************

.c++ file

class CSink : public ITESTEvents
{
private:
DWORD m_dwRefCount;
public:

CSink::CSink() {m_dwRefCount = 0;}
CSink::~CSink() {}

void OnConfigurationApply(VARIANT_BOOL* pAccept);
void OnShowMessageDlg(IMsgDlg* pIMsg, VARIANT_BOOL* Result);
};


void main(){
.
.
.
CSink *pSink;
pSink = new CSink(); // ERROR MESSAGE
.
.
}

*************************************************************************************************
AnswerRe: COM Connection Points: Problem to create an instance of an sink object. Pin
Stuart Dootson8-Sep-09 3:34
professionalStuart Dootson8-Sep-09 3:34 
AnswerRe: COM Connection Points: Problem to create an instance of an sink object. Pin
Juergen_808-Sep-09 4:07
Juergen_808-Sep-09 4:07 
QuestionHow to control Hide/Show of Custom Toolbar in Windows 2000 OS Pin
am 20096-Sep-09 23:59
am 20096-Sep-09 23:59 
QuestionHow to pass session to a new IE window in the method OnNewWindow2 Pin
sun_key6-Sep-09 17:10
sun_key6-Sep-09 17:10 
QuestionHow to Hide Custome Toolbar from IE6, IE7 ,IE8 Pin
am 20093-Sep-09 21:23
am 20093-Sep-09 21:23 
QuestionHow to use #import for different Windows OS version Pin
am 200931-Aug-09 23:34
am 200931-Aug-09 23:34 
AnswerRe: How to use #import for different Windows OS version Pin
Stuart Dootson1-Sep-09 2:15
professionalStuart Dootson1-Sep-09 2:15 
GeneralRe: How to use #import for different Windows OS version Pin
am 20091-Sep-09 2:48
am 20091-Sep-09 2:48 
GeneralRe: How to use #import for different Windows OS version Pin
Stuart Dootson1-Sep-09 2:54
professionalStuart Dootson1-Sep-09 2:54 
GeneralRe: How to use #import for different Windows OS version Pin
am 20091-Sep-09 3:25
am 20091-Sep-09 3:25 
GeneralRe: How to use #import for different Windows OS version Pin
Stuart Dootson1-Sep-09 4:46
professionalStuart Dootson1-Sep-09 4:46 
QuestionGetting crash while copying a VARIANT type to _variant_t type, Pin
Kundan Kumar Bharti30-Aug-09 20:14
Kundan Kumar Bharti30-Aug-09 20:14 
AnswerRe: Getting crash while copying a VARIANT type to _variant_t type, Pin
«_Superman_»30-Aug-09 21:18
professional«_Superman_»30-Aug-09 21:18 
QuestionHow to get IShellView interface of desired folder Pin
emmmatty129-Aug-09 20:31
emmmatty129-Aug-09 20:31 
AnswerRe: How to get IShellView interface of desired folder Pin
Stuart Dootson30-Aug-09 13:34
professionalStuart Dootson30-Aug-09 13:34 
Questioncom interop exception with IIS webserver using in asp.net web application Pin
.net Programmer 200928-Aug-09 1:50
.net Programmer 200928-Aug-09 1:50 
QuestionHosting a .NET 2.0 winfom in MFC COM C++ 2003 Pin
AbhishekBK27-Aug-09 0:01
AbhishekBK27-Aug-09 0:01 

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.