hi All, I have build an ATL COM using C++ , in this ATL COM i have implemented connection points also I have used this ATL COM in a Web Page using java script I can call the methods of ATL COM using java script in a web page and its working fine but the discrepancy is in the case of event handling , everytime ATL COM fires an event ,the event occurance on web page increases by one i.e for the first time event is fired , event will be displayed only once on web page ,next time is fired it will shown twice and next time it is fired the event is shown more than one time the previous one... I have also tested this ATL COM on VB it is working fine for every event , VB Client shows that there is only one event , evertime an event is fired from an ATL COM there is no discrepancy as there is in Web Page Here is the HTML page code.. CallMe function myatl::ExecutionOver(CallID) { alert("CallId : " + CallID); } Any pointers will be a good help with regards Abhiraj
garammasala
Posts
-
Issue in Event Handling of COM Event in Java Script -
Handle VC++ ATL COM Event in Java Script ?? [modified]I am not firing the event manually.. i am using the code generated by the ATL Wizard as such.. For firing event from worker thread .... microsoft has given link to be implemented for the same thats the only change i have done and rest of the code i have not touched... with regards Abhiraj
modified on Wednesday, May 7, 2008 12:27 AM
-
Fire Event from Worker thread in ATL COM Loaded on a Web PageHi All, I have developed a ATL COM which has a dependency , i have registered callback function of ATL COM to the dependency , which is ultimately invoked by one of the thread of the dependency and i am firing Event when callback funciton is invoked from callback function in ATL COM , Also i have implemented the way it is given the to fire event from Worker thread including atlcmplimpl.h ..... etc.. The event is fired from the worker thread correctly but .. My problem is in Internet Explorer , When ATL COM fires event once , the event is shown on internet explorer more than once as if event is fired many times... i.e each event is shown repeatedly and count is increasing every time.. I have tested ATL COM on VB Client it is working fine on the VB but it is giving problem in the internet explorer... Here is the code snippet... //EventCallBack is registered as call back function in depedency module // It is static function of CCallMonitor as it was to be registered as //callback function int CCallMonitor::EventCallBack(void* pData) { HRESULT hRes = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); MessageBox(NULL,TEXT("Fire Event Reached"),TEXT("OK"),MB_OK); //g_CallMonitor is the pointer to the COM CLass g_CallMonitor->Fire_IncomingCall((BSTR)Objbstr); ::CoUninitialize (); MessageBox(NULL,TEXT("After Test Reached"),TEXT("OK"),MB_OK); return S_OK; } MessageBox for debugging purpose only... Please let me what is the problem with the same... with regards Abhiraj
-
Handle VC++ ATL COM Event in Java Script ?? [modified]Hi Steve I have implemented the IProvideClassInfo and IProvideClassInfo2 interfaces for the callbacks and the callback are working fine Now the issue is even if I fire Event from ATL COM once , its shown more than once on the web page as if i have fired event from ATL COM many times and everytime the count is getting increased .... I have used this ATL Component in VB also , in VB its working fine if event is fired once the event is shown once and not more than that... Here is the code snippet ...... MessageBox(NULL,TEXT("Fire Event Reached"),TEXT("OK"),MB_OK); hr = pConnection->Invoke(1, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, ¶ms, &varResult, NULL, NULL); MessageBox(NULL,TEXT("Fire Event Complete"),TEXT("OK"),MB_OK); ......... I have used two message boxes just for the sake for debugging... Now in VB whenever there is event i have shown a msg box so once event is fired only 3 messages boxes comes one after the other 1. Fired Event Reached 2. Event Message Box (When "pConnection->Invoke" is fired) 3. Fire Event Complete Now in Internet Explorer its different.. whenever event is fired by ATL COM Event Message Box is shown many times in the Internet Explorer and everytime the count is getting increased What can be the problem... with regards Abhiraj
-
Handle VC++ ATL COM Event in Java Script ?? [modified]Hi Steve I would like to change my question... How to use ATL COM in java script and handle COM event in java script if the ATL COM is developed in C++ Abhiraj
-
Handle VC++ ATL COM Event in Java Script ?? [modified]Hi Steve You took the question wrong ... The question is how to handle events in Java script which are fired from ATL COM I am able to call COM interface methods in java scripts but not able to handle events fired from the same ATL COM Component and not "call java script functions in C++" with regards Abhiraj
-
VB Client Crashes while using ATL COM build in C++yes Nathan Your are right that i have implemented one of the options and my work was done... Since ATL COM is very vast so no idea where to start exactly to find the solution for the same ,also the solution given in the link which i gave requires a lot of deep understanding of ATL before the solution provided can be understood, As you have said there are so many articles in the Code project that can tell me a lot better about ATL and basically the solution given in the links... so will request to point some of those if you can... ? with regards Abhiraj
modified on Monday, April 28, 2008 1:38 PM
-
Handle VC++ ATL COM Event in Java Script ?? [modified]How to handle COM Events in Java script How to use ATL COM in java script and handle COM event in java script if the ATL COM is developed in C++ Abhiraj
modified on Tuesday, April 29, 2008 2:43 AM
-
VB Client Crashes while using ATL COM build in C++Hi Nathan < Also, unrelated to your problem, it looks to me like g_pTestATL and g_CallMonitor could be static member variables of CTest_ATL > I made a mistake while giving the question i.e "g_CallMonitor" is nothing it is the global pointer "g_pTestATL" which is firing the event from the static function.... replace g_CallMonitor with g_pTestATL I have found the solution to the problem but was not really able to understand the whole solution , Below is the link http://vcfaq.mvps.org/com/1.htm May be you can through some light....
-
VB Client Crashes while using ATL COM build in C++hi All, My VB Client using ATL COM works fine while running under Debug mode but in the release mode it gets crashed as ATL COM tries to fire event to the VB Client Here are the Details of what i have developed as ATL COM in C+ I have developed a simple ATL COM in C++ , This ATL Com has a dependency which is a DLL , this DLL sends a notification to the ATL COM by using a registering a function of a ATL as callback , i have used a static function of ATL Object as callback function as we cannot give member function of the class as callback function due to "this" pointer. Now Dll sends notification to this static function of ATL COM and this ATL COM send the notification further to the COM Client by firing event. Important to note , since notification is received by static function of ATL class , so i had to use global pointer to the ATL COM in that static function to Fire_Event , as soon as global pointer fires events VB client in release mode gets crashed Here is the code snippet CTest_ATL *g_pTestATL; // Glboal Pointer STDMETHODIMP CTest_ATL::funSubscribe(void) { g_pTestATL = this; m_hDLL = LoadLibrary(TEXT("\\DLL_PlaceCall.dll")); if(NULL == m_hDLL) { return S_FALSE; } return S_OK; } // This is a callback "static" function which gets registered to the DLL // As this static callback function gets called i am firing event using // global pointer to ATL_COM as shown below int CTest_ATL::EventCallBack() { g_CallMonitor->Fire_IncomingCall(CComBSTR("This is a COM Message")); return S_OK; } Any pointers in this issue will be a great help..... with regards Abhiraj