Click here to Skip to main content
15,901,035 members
Home / Discussions / COM
   

COM

 
AnswerRe: How to make arguments as optional in DCOM method ? Pin
f646-Aug-04 14:40
f646-Aug-04 14:40 
QuestionHow can I pass a COM object from one server application to another? Pin
bpChristoph3-Aug-04 0:27
bpChristoph3-Aug-04 0:27 
QuestionHow to pass variable into DCOM STDMETHOD ? Pin
Amarelia30-Jul-04 19:24
Amarelia30-Jul-04 19:24 
GeneralInheritence in COM Pin
Gaurav Singhal30-Jul-04 10:50
Gaurav Singhal30-Jul-04 10:50 
GeneralRe: Inheritence in COM Pin
darkbyte30-Jul-04 15:42
darkbyte30-Jul-04 15:42 
QuestionNew to Com - is Com the way to go? Pin
John Ulvr29-Jul-04 3:56
John Ulvr29-Jul-04 3:56 
Generalwindows Message loop Pin
Abhi Lahare23-Jul-04 18:32
Abhi Lahare23-Jul-04 18:32 
GeneralHelp, COM advanced programmer help me. Pin
yellowdragon21-Jul-04 20:24
yellowdragon21-Jul-04 20:24 
I have a much terrible problem . I need a dll to accomplish a Dictionary(dll 's name) which contain any object called VB6.0. The Dictionary using c++ ' s stl std::map<anytype key="" ,="" anytype="" object=""> , the key type must adapt for a self defined class or a object , that is the method Add(para1, para2 ) can also deliver that argument para1 is object. The destination goal is Add(Object obj1, Object obj2).
can you help me ? thank you in advance!
following is the source :

project name : TestDictionary

// TestDictionary.cpp : Implementation of CTestDictionary

#include "stdafx.h"
#include "TestDictionary.h"
#include ".\testdictionary.h"

// CTestDictionary
STDMETHODIMP CTestDictionary::Add(BSTR key, VARIANT object)
{
// TODO: Add your implementation code here
wstring keystirng(key);
_map[keystirng] = object;
return S_OK;
}

STDMETHODIMP CTestDictionary::get_Items(BSTR key, VARIANT* pVal)
{
// TODO: Add your implementation code here
wstring keystirng(key);
*pVal = _map[keystirng];
return S_OK;
}

STDMETHODIMP CTestDictionary::put_Items(BSTR key, VARIANT newVal)
{
// TODO: Add your implementation code here
wstring keystirng(key);
_map[keystirng] = newVal;
return S_OK;
}



head source:
// TestDictionary.h : Declaration of the CTestDictionary

#pragma once
#include "resource.h" // main symbols


// ITestDictionary
[
object,
uuid("AB33763D-A604-42CF-9F86-4EA61D8B51EA"),
dual, helpstring("ITestDictionary Interface"),
pointer_default(unique)
]
__interface ITestDictionary : IDispatch
{
[id(1), helpstring("method Add")] HRESULT Add([in] BSTR key, [in] VARIANT object);

[propget, id(2), helpstring("property Items")] HRESULT Items([in] BSTR key, [out, retval] VARIANT* pVal);
[propput, id(2), helpstring("property Items")] HRESULT Items([in] BSTR key, [in] VARIANT newVal);
};

[
object,
uuid("{8FA3C023-1EF5-4b1b-91F7-41815B8A5294}"),
dual, helpstring("ITestEnumrator Interface"),
pointer_default(unique)
]
__interface ITestEnumrator : IDispatch
{
[id(1), helpstring("method Next")] HRESULT Next([out,retval] VARIANT* pObject);
};

// CTestDictionary
[
coclass,
threading("apartment"),
vi_progid("ComLib.TestDictionary"),
progid("ComLib.TestDictionary.1"),
version(1.0),
uuid("B610EB97-5CEC-451A-90D9-A13EED57C168"),
helpstring("TestDictionary Class")
]
class ATL_NO_VTABLE CTestDictionary :
public ITestDictionary,
public ITestEnumrator
{
public:
CTestDictionary()
{
}


DECLARE_PROTECT_FINAL_CONSTRUCT()

HRESULT FinalConstruct()
{
return S_OK;
}

void FinalRelease()
{
}

public:

STDMETHOD(Add)(BSTR key, VARIANT object);

private:
map<wstring,variant> _map;
map<wstring,variant>::iterator _iter;
public:
STDMETHOD(get_Items)(BSTR key, VARIANT* pVal);
STDMETHOD(put_Items)(BSTR key, VARIANT newVal);
};


thank u
GeneralRe: Help, COM advanced programmer help me. Pin
Milton Karimbekallil22-Jul-04 17:54
Milton Karimbekallil22-Jul-04 17:54 
GeneralRe: Help, COM advanced programmer help me. Pin
yellowdragon24-Jul-04 0:21
yellowdragon24-Jul-04 0:21 
GeneralCDialog in In-Process Server (DLL) Pin
Anonymous21-Jul-04 0:58
Anonymous21-Jul-04 0:58 
Generalshortcut Pin
ANDYFA20-Jul-04 14:23
ANDYFA20-Jul-04 14:23 
GeneralRe: shortcut Pin
Abhi Lahare23-Jul-04 18:20
Abhi Lahare23-Jul-04 18:20 
GeneralMixing COM event handling techniques Pin
zumichu20-Jul-04 11:48
zumichu20-Jul-04 11:48 
GeneralRe: Mixing COM event handling techniques Pin
Vi221-Jul-04 18:10
Vi221-Jul-04 18:10 
GeneralRe: Mixing COM event handling techniques Pin
zumichu21-Jul-04 18:41
zumichu21-Jul-04 18:41 
GeneralRe: Mixing COM event handling techniques Pin
Vi221-Jul-04 19:19
Vi221-Jul-04 19:19 
GeneralRe: Mixing COM event handling techniques Pin
zumichu21-Jul-04 19:44
zumichu21-Jul-04 19:44 
GeneralIHTMLWindow2 navigate opening new window Pin
zumichu20-Jul-04 11:11
zumichu20-Jul-04 11:11 
GeneralRe: IHTMLWindow2 navigate opening new window Pin
Alexander Wiseman20-Jul-04 11:40
Alexander Wiseman20-Jul-04 11:40 
GeneralRe: IHTMLWindow2 navigate opening new window Pin
zumichu20-Jul-04 12:50
zumichu20-Jul-04 12:50 
GeneralRe: IHTMLWindow2 navigate opening new window Pin
Alexander Wiseman20-Jul-04 14:25
Alexander Wiseman20-Jul-04 14:25 
GeneralRe: IHTMLWindow2 navigate opening new window Pin
zumichu20-Jul-04 16:22
zumichu20-Jul-04 16:22 
GeneralGUIDs and MIDL.exe Pin
Tropicana20-Jul-04 7:58
Tropicana20-Jul-04 7:58 
Questionhow to marshal interface Pin
yingkou19-Jul-04 18:30
yingkou19-Jul-04 18:30 

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.