1.How to build a proxy/stub dll with connection points ?.
2. Connection points works only for an interface. If I remove singleton class It's firing for current interface
which invokes that method. Is there anyway to track the connected interfaces in COM server and
fire the event to all conneted clients.
[I feel the disadvantage of using SINGLETON class because It makes one client to wait until It finishes
3. Is there anyway to fire an event for a particular connection .[Example Like in chat program If I want
to send a message to a particular client ]
3. Is there any way to detect IP of the remote machine using connection point interface.
If any one know how to do, please let me know. you can contact me at email@example.com
I am new in IE programming..i am able to put a click event for a button element...but i could not fire a event for a drop-down(list)to expand list from a using MFC..i have the drop-down element...plz some body help me to fire the drop down element..i need the project or helping code..Thanks
Most likely these issues are obvious for experience programmer, but I would like to accent them.
It's related to case when COM server is implemented as executable, and client that catch events implemented as console application with ATL support.
1) In stdafx.h should be #define _WIN32_DCOM
2) COM must be initialized via CoInitializeEx(NULL,COINIT_MULTITHREADED) - if simple CoInitialize or CoInitializeEx with COINIT_APARTMENTTHREADED flag used, Invoke call didn't return in server Fire_Finished() function.
3) ATL _Module must be initialized with HINSTANCE value different from zero. I couldn't find how to obtain module HINSTANCE for console application, but _Module.Init(NULL,(HINSTANCE) 0x400000) worked for me.
1) If server is implemented as multithreaded application and it fires events from thread different from it's main thread, then following conditions must be met:
- CoInitializeEx(NULL,COINIT_MULTITHREADED) must be called by firing thread
- server class must derive from CComMultiThreadModel
- ATL_FREE_THREADED must be defined in stdafx.h instead of ATL_APARTMENT_THREADED
- Multithreaded version of runtime library must be used (Project -- Settings -- C++ -- Category: Code generation)
1) Server launch and access permissions must be properly configured via dcomcnfg.exe utility.
2) It's better to use short server name (in 8.3 format) - when Service Control Manager (SCM) creates server process it calls CreateProcessAsUser - it seems that process will be created with proper credentials only if name of server in 8.3 format.
I didn't dig deep into security, in my version client obtains server interface pointer via CoCreateInstanceEx with default security attributes (COSERVERINFO::pAuthInfo = 0), and it worked when server and client were run under the same account.
Hello, I used the knowledge in this article to update my program. However, I have a question here: my client dialog has a CProgressCtrl control, I want to manupilate the control in my event handler so that I can see the progress while the COM object is doing long time caculation, but I don't know how to acquire the pointer.
Please let me know, how the above illustrated connection point example could be used over DCOM.
Have a SINGLETON EXE Server(Out of proc) and multiple Clients some MFC & some ATL connecting to this SINGLETON server, Connection points work perfectly fine on the LOCAL SERVER with multiple clients, but when tried over DCOM, the DispEventAdvise fails on the remote client.
m_pHandler = new CEventHandler;
IUnknownPtr pUnk = m_pIS;
Have registered the proxy stub dll and could call into the interface methods but could get the connection point or events/DispEventAdvise to work though.
Any help or downloadle code is much appreciated,
Thanking you much,
Best Regards, -Raj.
Connection point works if COM server is registered in client machine
Posted by edjamesx
on 04/23/2004 05:57am
We also encounter same problem. But When we register COM server exe in client machine with
(/Regserver) option Connection points started working. I think Connection point implementation for this Interface is not packed in proxy/stub dll.
I'm a neophyte in the COM world and I'm really enjoying the new-found freedoms, but I'm also a bit overwhelmed by all of the new terms, the objects and macros, and everything else. I really appreciate people such as yourself, who take the time to share their knowledge. To me, that's one of the finest characteristics of the best of those in our profession.
I just read your article, "Dispinterface vs. Events and Runtime Sinks". It was well-writen and concise. You saved me a ton of research.
At least 5 times better than Chapter 8 of "ATL Internals".
One little point to mention, if you have a lagecy COM server and want to add connection point support. Define a event interface and add it to coclass with "[default, source]" in xxserver.idl, the Wizard still can generate event support code after this xxserver.idl get compiled.