Click here to Skip to main content
15,921,336 members
Home / Discussions / COM
   

COM

 
GeneralRe: passing parameters from c++ to c# COM Pin
Green Fuze21-Apr-08 4:57
Green Fuze21-Apr-08 4:57 
GeneralPartial Lookups in Excel Macro Pin
Brendan Vogt9-Apr-08 4:19
Brendan Vogt9-Apr-08 4:19 
QuestionDoes anyone have the definition documentation of in Vc++ "C:\Program Files\Microsoft Office\OFFICE11\EXCEL.EXE" Pin
larryhcx8-Apr-08 18:36
larryhcx8-Apr-08 18:36 
Questiononly a question about activeX, please help me : ) Pin
sdplox8-Apr-08 16:11
sdplox8-Apr-08 16:11 
QuestionHow to check if a COM DLL was generated from given source code ? [modified] Pin
GuimaSun8-Apr-08 7:20
GuimaSun8-Apr-08 7:20 
Questionhow to defined a defaultvalue interface-function in idl file? Pin
huangdingjun7-Apr-08 17:12
huangdingjun7-Apr-08 17:12 
QuestionHow to add VC++ 6.0 dlls to ASP.NET web application?( through Add ref) Pin
Prabakar3-Apr-08 23:58
Prabakar3-Apr-08 23:58 
GeneralCOM/ATL Event problem [modified] Pin
knuttermutter3-Apr-08 0:21
knuttermutter3-Apr-08 0:21 
I'm learning ATL so i tried to write a simple project supporting connection points.
I want to have a situation that one COM client can raise an event on other clients.
1) I've created new ATL Project. I selected 'Executable' and 'allow merging proxy/stub' options
2) I've added an ATL Simple Object with 'support Connection Points' option. I named it 'Test'
3) I've added a method
[id(1), helpstring("method InsertText")] HRESULT InsertText([in] BSTR txt);
to the ITest interface
4) I've addedn a method
[id(1), helpstring("method OnTextInserted")] HRESULT OnTextInserted([in] BSTR txt);
to the ITestEvents interface
5) I've regenerated CProxy_ITestEvents
6) I've implemented InsertText method
<br />
STDMETHODIMP CTest::InsertText(BSTR txt)<br />
{<br />
	this->Fire_OnTextInserted (txt) ;<br />
<br />
	return S_OK;<br />
}<br />

7) I've added DECLARE_CLASSFACTORY_SINGLETON(CTest) to CTest
8) I've built the project

Next i wanted to test it so i've created a WindowsForms C# Application. I've added reference to my Test component. I've put a textbox and a button on it and implemented the button click to call InsertText method with textboxvalue as a parameter.
i've created also a secon application with a listbox:
<br />
        private testLib.TestClass a;<br />
<br />
         public Form1()<br />
        {<br />
            InitializeComponent();<br />
            a = new testLib.TestClass();<br />
            a.OnTextInserted += new testLib._ITestEvents_OnTextInsertedEventHandler(this.Dn);<br />
         }<br />
<br />
        private void Dn(string b)<br />
        {<br />
            listBox1.Items.Add(b);<br />
        }<br />
<br />


I think that clicking button in first application should add items to the listbox in the second application but it doesnt work.

Moreover, I've added to the second application a button calling InsertText method so when clicking this button an event should by both raised and handled by the same client. But it still doesnt work.

And now something strange. When i start 3 or more instances of the second application (in modified form) it starts to work! Event is properly handled after the button is clicked!

What am I doing wrong? Thanks in advance for your help.

modified on Thursday, April 3, 2008 7:08 AM

GeneralEvents from C# to COM dll (C++) Pin
SteinarAa2-Apr-08 2:58
SteinarAa2-Apr-08 2:58 
GeneralRe: Events from C# to COM dll (C++) Pin
Randor 14-Apr-08 17:10
professional Randor 14-Apr-08 17:10 
QuestionMaking COM introp and calling the method from C# project Pin
Mushtaque Nizamani30-Mar-08 6:06
Mushtaque Nizamani30-Mar-08 6:06 
QuestionDCOM security issue Pin
tony_Udz27-Mar-08 17:46
tony_Udz27-Mar-08 17:46 
GeneralSetWindowPos in COM application Pin
sheetal_0626-Mar-08 23:38
sheetal_0626-Mar-08 23:38 
GeneralCOM Communication Pin
HakunaMatada25-Mar-08 1:25
HakunaMatada25-Mar-08 1:25 
GeneralRe: COM Communication Pin
Mike Dimmick30-Mar-08 12:58
Mike Dimmick30-Mar-08 12:58 
GeneralRe: COM Communication Pin
HakunaMatada30-Mar-08 19:12
HakunaMatada30-Mar-08 19:12 
GeneralBSTR variable Pin
vc++_fragrance24-Mar-08 19:48
vc++_fragrance24-Mar-08 19:48 
GeneralRe: BSTR variable Pin
User 21559725-Mar-08 1:24
User 21559725-Mar-08 1:24 
GeneralRe: BSTR variable Pin
CPallini26-Mar-08 1:07
mveCPallini26-Mar-08 1:07 
GeneralC# class library Pin
pnpfriend24-Mar-08 9:24
pnpfriend24-Mar-08 9:24 
GeneralRe: C# class library Pin
Scott Dorman25-Mar-08 15:37
professionalScott Dorman25-Mar-08 15:37 
GeneralCalling .NET component from VB. [modified] Pin
SPanicker*23-Mar-08 21:38
SPanicker*23-Mar-08 21:38 
GeneralRe: Calling .NET component from VB. Pin
Vi23-Apr-08 20:13
Vi23-Apr-08 20:13 
QuestionHow to Rreference COM object(tlb file) in VC++ Pin
Jahnson K21-Mar-08 10:05
Jahnson K21-Mar-08 10:05 
AnswerRe: How to Rreference COM object(tlb file) in VC++ Pin
User 21559722-Mar-08 3:02
User 21559722-Mar-08 3:02 

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.