Unhandled Exception in XMPP (General questions)
by gothic_coder, Friday, December 10, 2010, 14:22 (5098 days ago)
Hello,
I was trying to run the program under the directory Samples-VC-Component-ATL, But at one point it was giving me error Unhandled Exception in SimpleIm.exe (WODXMPP.DLL): 0xC0000005: Access Violation , Below is the line where it's giving that error, Please take a look.
[code]
IwodXMPPComPtr pXMPP;
HRESULT hr = NULL;
CoInitialize (NULL);
hr = pXMPP.CreateInstance (CLSID_wodXMPPCom, NULL);
if (FAILED (hr))
{
_com_error comErr (hr);
printf ( Unable to load IwodXMPPCom interface.
Err # u: s , hr, comErr.ErrorMessage () );
CoUninitialize ();
return 99;
}
wodXMPPEvents *pEvents = new wodXMPPEvents(pXMPP);
pXMPP->Blocking = VARIANT_TRUE; // Here it's throwing the exception
[/code]
Looking forward to get some answers.
Thanks all
Re: Unhandled Exception in XMPP
by wodDamir, Friday, December 10, 2010, 15:00 (5098 days ago) @ gothic_coder
Hi,
Can you please try re-importing the component into the project?
Regards,
Damba
Re: Unhandled Exception in XMPP
by gothic_coder, Saturday, December 11, 2010, 08:11 (5097 days ago) @ wodDamir
Hi,
Can you please try re-importing the component into the project?
Regards,
Damba
Hello Damba,
I'm pretty novice in that, Could you please explain how to re-import the component.
Please note that i downloaded XMPP Component from here and didn't change anything in that SimpleIm project, On the other hand the MFC project was working fine.
Thanks
Re: Unhandled Exception in XMPP
by gothic_coder, Saturday, December 11, 2010, 10:26 (5097 days ago) @ gothic_coder
Also if i comment the statement which was causing the unhandled exception, It went on and ask for login and password, After that it ask for to whom i need to send the message and what, after providing the details it calls SendText but i get following error message
The value of ESP was not properly saved across a function call. This is usually a result of calling a function pointer declared with a different calling convention.
Here the whole code
[code]
//#import c:windowssystem32wodxmpp.dll no_namespace named_guids
#include wodxmpp.tlh
#include <atlbase.h>
CComModule _Module; // dummy required to utilize atlcom.h
#include <atlcom.h>
bool error = false;
// Define the wodXMMP events to be handled:
_ATL_FUNC_INFO OnConnectedInfo = {CC_STDCALL, VT_EMPTY, 0, VT_EMPTY};
_ATL_FUNC_INFO OnDisconnectedInfo = {CC_STDCALL, VT_EMPTY, 2, {VT_I4, VT_BSTR}};
class wodXMPPEvents : public IDispEventSimpleImpl<1, wodXMPPEvents, &DIID__IwodXMPPComEvents>
{
public:
wodXMPPEvents (IwodXMPPComPtr pwodXMPPCom)
{
m_pwodXMPPCom = pwodXMPPCom;
DispEventAdvise ( (IUnknown*)pwodXMPPCom);
}
virtual ~wodXMPPEvents ()
{
DispEventUnadvise ( (IUnknown*)m_pwodXMPPCom);
m_pwodXMPPCom.Release();
}
void __stdcall OnConnected ()
{
printf(
Connected, continuing....
);
}
void __stdcall OnDisconnected (long ErrorCode, BSTR ErrorText)
{
if (ErrorCode)
{
error = true;
_bstr_t err(ErrorText);
printf(
s
, (char *)err);
}
else
printf(
Done and disconnected
);
}
BEGIN_SINK_MAP (wodXMPPEvents)
SINK_ENTRY_INFO (1, DIID__IwodXMPPComEvents, 0, OnConnected, &OnConnectedInfo)
SINK_ENTRY_INFO (1, DIID__IwodXMPPComEvents, 1, OnDisconnected, &OnDisconnectedInfo)
END_SINK_MAP ()
private:
IwodXMPPComPtr m_pwodXMPPCom;
};
int main(int argc, char* argv[])
{
IwodXMPPComPtr pXMPP;
HRESULT hr = NULL;
CoInitialize (NULL);
hr = pXMPP.CreateInstance (CLSID_wodXMPPCom, NULL);
if (FAILED (hr))
{
_com_error comErr (hr);
printf ( Unable to load IwodXMPPCom interface.
Err # u: s , hr, comErr.ErrorMessage () );
CoUninitialize ();
return 99;
}
wodXMPPEvents *pEvents = new wodXMPPEvents(pXMPP);
//This was creating problem, Now i commented it.
//pXMPP->Blocking = VARIANT_FALSE;
//pXMPP->Register = VARIANT_TRUE; // register new account
VARIANT var;
var.vt = VT_ERROR;
char Login[256];
char Password[256];
printf( This sample will let you login to your Jabber account and send a message to one of your contacts.
);
printf( Enter your JID: );
scanf( s , Login);
printf( Enter your password: );
scanf( s , Password);
pXMPP->Login = _bstr_t(Login);
pXMPP->Password = _bstr_t(Password);
try
{
hr = pXMPP->Connect(var);
}
catch (_com_error e)
{
error = true;
}
if (!error)
{
char JID[256];
char message[1024];
printf( Send message to (JID): );
scanf( s , JID);
printf( Message: );
scanf(
[^
] ,message); //reads whole line from console
//pXMPP->Contacts->Add(_bstr_t( someone@wippien.com ))->Subscribe(); // you can add someone to your contact list...
//Now here it shows the error message.
pXMPP->SendText(_bstr_t(JID), _bstr_t(message));
pXMPP->Disconnect();
}
delete pEvents;
pXMPP.Release();
CoUninitialize ();
return 0;
}
[/code]
Looking forward for quick reply..
Thanks.
Re: Unhandled Exception in XMPP
by wodDamir, Sunday, December 12, 2010, 12:57 (5096 days ago) @ gothic_coder
Ash,
Can you please re-download the component? We re-worked the sample, so it should work directly.
Regards,
Damba
Re: Unhandled Exception in XMPP
by gothic_coder, Monday, December 13, 2010, 07:57 (5095 days ago) @ wodDamir
Ash,
Can you please re-download the component? We re-worked the sample, so it should work directly.
Regards,
Damba
I downloaded the new component, But there's problem in wodxmpp.tlh and wodxmpp.tli, I see character like  at the beginning of the file which gives me compiler error below, Removing those character from file does not solve the problem.
Please Check Again..
[code]
Compiling...
SimpleIM.cpp
c:program filesweonlydo.comxmppsamplesvccomponentatlwodxmpp.tlh(1) : error C2018: unknown character '0xef'
c:program filesweonlydo.comxmppsamplesvccomponentatlwodxmpp.tlh(1) : error C2018: unknown character '0xbb'
c:program filesweonlydo.comxmppsamplesvccomponentatlwodxmpp.tlh(1) : error C2018: unknown character '0xbf'
c:program filesweonlydo.comxmppsamplesvccomponentatlwodxmpp.tli(1) : error C2018: unknown character '0xef'
c:program filesweonlydo.comxmppsamplesvccomponentatlwodxmpp.tli(1) : error C2018: unknown character '0xbb'
c:program filesweonlydo.comxmppsamplesvccomponentatlwodxmpp.tli(1) : error C2018: unknown character '0xbf'[/code]
Thanks
Re: Unhandled Exception in XMPP
by gothic_coder, Monday, December 13, 2010, 15:21 (5095 days ago) @ gothic_coder
Ok the sample wasn't working on VC 6.0, But it works on Visual studio 2005..
So we used IwodXMPPComPtr for connecting and sending messages, But what if i need to keep check on incoming messages? I guess i need to tackle IXMPPMessage class.. Could you please tell me how to add functionality, Simply creating object gives me lot's of error.
Thanks
Re: Unhandled Exception in XMPP
by woddrazen, Monday, December 13, 2010, 15:25 (5095 days ago) @ gothic_coder
Ash,
You are using DEMO or licensed version of a component?
Drazen
Re: Unhandled Exception in XMPP
by gothic_coder, Tuesday, December 14, 2010, 07:19 (5094 days ago) @ woddrazen
Ash,
You are using DEMO or licensed version of a component?
Drazen
Hello Drazen,
I'm currently using DEMO version of the component. Do you mean that i can't add IXMPPMessage or IXMPPContact functionality in DEMO version, But i guess it's been used in the MFC project.
Thanks
Re: Unhandled Exception in XMPP
by wodDamir, Tuesday, December 14, 2010, 08:51 (5094 days ago) @ gothic_coder
Ash,
No, you can use those objects. You should be able to re-create the tli/tlh files by uncommenting the import line in the .cpp.
Or, you can contact us at techsupport@weonlydo.com and I'll send them to you.
Regards,
Damba
Re: Unhandled Exception in XMPP
by gothic_coder, Tuesday, December 14, 2010, 10:09 (5094 days ago) @ wodDamir
Ash,
No, you can use those objects. You should be able to re-create the tli/tlh files by uncommenting the import line in the .cpp.
Or, you can contact us at techsupport@weonlydo.com and I'll send them to you.
Regards,
Damba
Hello Damba,
I'm using the same tli/tlh files which are in C:\Program Files\WeOnlyDo.Com\XMPPSamples\VC\Component\ATL folder, This particular project only connect and sends message to specified user, What if i need to handle incoming messages also, I need to know the steps to do it. How to add the functionality.
Do i need to send the mail for this particular query?
Thanks
Re: Unhandled Exception in XMPP
by wodDamir, Tuesday, December 14, 2010, 10:53 (5094 days ago) @ gothic_coder
Ash,
I know, but you can delete them, and uncomment the #import statement from the sample. In that case when you compuile it the tli/tlh files will be recreated.
As for sending messages, that's not possible in blocking mode. You would need to add events and handle IncomingMessage events.
Can you perhaps try that?
Regards,
Damba
Re: Unhandled Exception in XMPP
by gothic_coder, Tuesday, December 14, 2010, 11:18 (5094 days ago) @ wodDamir
Ash,
I know, but you can delete them, and uncomment the #import statement from the sample. In that case when you compuile it the tli/tlh files will be recreated.
Yes i already uncommented #import, But the problem is that the new tli/tlh files build by compiling the sample application gives me lot's of error.. Those error are
[code]
c:program filesweonlydo.comxmppsamplesvccomponentatldebugwodxmpp.tlh(1430) : error C2556: 'HRESULT IXMPPChatRoom::GetSettings(void)' : overloaded function differs only by return type from 'IXMPPVarsPtr IXMPPChatRoom::GetSettings(void)'
c:program filesweonlydo.comxmppsamplesvccomponentatldebugwodxmpp.tlh(1403) : see declaration of 'IXMPPChatRoom::GetSettings'
c:program filesweonlydo.comxmppsamplesvccomponentatldebugwodxmpp.tlh(1430) : error C2371: 'IXMPPChatRoom::GetSettings' : redefinition; different basic types
c:program filesweonlydo.comxmppsamplesvccomponentatldebugwodxmpp.tlh(1403) : see declaration of 'IXMPPChatRoom::GetSettings'
c:program filesweonlydo.comxmppsamplesvccomponentatldebugwodxmpp.tli(1422) : error C2556: 'HRESULT IXMPPChatRoom::GetSettings(void)' : overloaded function differs only by return type from 'IXMPPVarsPtr IXMPPChatRoom::GetSettings(void)'
c:program filesweonlydo.comxmppsamplesvccomponentatldebugwodxmpp.tlh(1403) : see declaration of 'IXMPPChatRoom::GetSettings'
c:program filesweonlydo.comxmppsamplesvccomponentatldebugwodxmpp.tli(1422) : error C2371: 'IXMPPChatRoom::GetSettings' : redefinition; different basic types
c:program filesweonlydo.comxmppsamplesvccomponentatldebugwodxmpp.tlh(1403) : see declaration of 'IXMPPChatRoom::GetSettings'
c:program filesweonlydo.comxmppsamplesvccomponentatldebugwodxmpp.tli(1422) : error C2084: function 'IXMPPVarsPtr IXMPPChatRoom::GetSettings(void)' already has a body
c:program filesweonlydo.comxmppsamplesvccomponentatldebugwodxmpp.tlh(1403) : see previous definition of 'GetSettings'
[/code]
As for sending messages, that's not possible in blocking mode. You would need to add events and handle IncomingMessage events.Can you perhaps try that?
Regards,
Damba
Yes i need to know how to add those events and handle IncomingMessage events, I know i'm asking for much, But it'll be great if you let me know the way to do it or redirect me to some sample program.
Thanks a ton
Re: Unhandled Exception in XMPP
by wodDamir, Tuesday, December 14, 2010, 11:43 (5094 days ago) @ gothic_coder
Jeff,
You can simply ignore those errors, and comment out the declarations where they are thrown.
As for events, please contact us at techsupport@weonlydo.com and we'll prepare a sample for you.
Regards,
Damba
Re: Unhandled Exception in XMPP
by gothic_coder, Tuesday, December 14, 2010, 11:48 (5094 days ago) @ wodDamir
Jeff,
You can simply ignore those errors, and comment out the declarations where they are thrown.
Well re-compiling would again make those tli/tlh files. Nevertheless i'll find something of it.
As for events, please contact us at techsupport@weonlydo.com and we'll prepare a sample for you.Regards,
Damba
Thanks, I already put a mail, Will you please check.
Thanks a lot again :)
Re: Unhandled Exception in XMPP
by gothic_coder, Tuesday, December 14, 2010, 13:19 (5094 days ago) @ gothic_coder
Hello Damba,
I tried to add events and handle IncomingMessage, But it creates more problem, Could you please check where am i making problem.
[code]
_ATL_FUNC_INFO OnConnectedInfo = {CC_STDCALL, VT_EMPTY, 0, VT_EMPTY};
_ATL_FUNC_INFO OnDisconnectedInfo = {CC_STDCALL, VT_EMPTY, 2, {VT_I4, VT_BSTR}};
_ATL_FUNC_INFO OnIncomingMessageInfo = {CC_STDCALL, VT_EMPTY, 3, {VT_DISPATCH, VT_DISPATCH,VT_DISPATCH}};
class wodXMPPEvents : public IDispEventSimpleImpl<1, wodXMPPEvents, &DIID__IwodXMPPComEvents>
{
public:
BEGIN_SINK_MAP (wodXMPPEvents)
SINK_ENTRY_INFO (1, DIID__IwodXMPPComEvents, 0, OnConnected, &OnConnectedInfo)
SINK_ENTRY_INFO (1, DIID__IwodXMPPComEvents, 1, OnDisconnected, &OnDisconnectedInfo)
SINK_ENTRY_INFO (1, DIID__IwodXMPPComEvents, 2, OnIncomingMessage, &OnIncomingMessageInfo)
END_SINK_MAP ()
wodXMPPEvents (IwodXMPPComPtr pwodXMPPCom)
{
m_pwodXMPPCom = pwodXMPPCom;
DispEventAdvise ( (IUnknown*)pwodXMPPCom);
}
virtual ~wodXMPPEvents ()
{
DispEventUnadvise ( (IUnknown*)m_pwodXMPPCom);
m_pwodXMPPCom.Release();
}
void __stdcall OnConnected ()
{
//printf(
Connected, continuing....
);
MessageBox(NULL, Connected , Text , MB_OK);
}
void __stdcall OnDisconnected (long ErrorCode, BSTR ErrorText)
{
if (ErrorCode)
{
error = true;
_bstr_t err(ErrorText);
printf(
s
, (char *)err);
}
//else
//printf(
Done and disconnected
);
}
void __stdcall OnIncomingMessage(struct IXMPPContact * Contact, struct IXMPPChatRoom * ChatRoom, struct IXMPPMessage * Message )
{
BSTR bText;
Message->get_Text(&bText);
MessageBox(NULL, (LPCSTR)bText, Text , MB_OK);
}
private:
IwodXMPPComPtr m_pwodXMPPCom;
};
[/code]
I also change the statement
[code]pXMPP->Blocking = VARIANT_FALSE;[/code]
it was initially VARIANT_TRUE .
After doing this the SendText throws unhandled exception.. Please take a look.
Thanks
Re: Unhandled Exception in XMPP
by gothic_coder, Tuesday, December 14, 2010, 14:15 (5094 days ago) @ gothic_coder
[code]SINK_ENTRY_INFO (1, DIID__IwodXMPPComEvents, 2, OnIncomingMessage, &OnIncomingMessageInfo)[/code]
With This Code in execution, It gives some error in Atlcom.h, So i changed the code with the following one.
[code]SINK_ENTRY_INFO (1, DIID__IwodXMPPComEvents, 7, OnIncomingMessage, &OnIncomingMessageInfo)[/code]
Now it gives error on SendText, And when i change pXMPP->Blocking = VARIANT_TRUE; to pXMPP->Blocking = VARIANT_FALSE; it gives the following error in SendText definition under wodxmpp.tli.
Unhandled exception at 0x7c812afb in zChatIM.exe: Microsoft C++ exception: _com_error at memory location 0x0013fe5c..
Please take a look.
Thanks a lot.
Re: Unhandled Exception in XMPP
by wodDamir, Tuesday, December 14, 2010, 15:33 (5094 days ago) @ gothic_coder
Ash,
Can you please contact us at techsupport@weonlydo.com and we'll prepare a sample of events implementation?
The _com_error (i can't say for sure since I don't know what exception is occuring) is most probably because you are calling methods one after another in non-blocking mode (Blocking = false). Blocking causes component to stop and wait for method to execute. That allows line-by-line execution, which is usually used in scripting environments.
Regards,
Damba
Re: Unhandled Exception in XMPP
by gothic_coder, Tuesday, December 14, 2010, 15:40 (5094 days ago) @ wodDamir
Ash,
Can you please contact us at techsupport@weonlydo.com and we'll prepare a sample of events implementation?
The _com_error (i can't say for sure since I don't know what exception is occuring) is most probably because you are calling methods one after another in non-blocking mode (Blocking = false). Blocking causes component to stop and wait for method to execute. That allows line-by-line execution, which is usually used in scripting environments.
Regards,
Damba
Hello Damba,
I already dropped a mail to techsupport@weonlydo.com , But haven't received reply..
Re: Unhandled Exception in XMPP
by wodDamir, Tuesday, December 14, 2010, 16:03 (5094 days ago) @ gothic_coder
Ash,
I checked, but none came. Can you please verify that you used the correct e-mail address?
Regards,
Damba
Re: Unhandled Exception in XMPP
by gothic_coder, Wednesday, December 15, 2010, 07:28 (5093 days ago) @ wodDamir
Ash,
I checked, but none came. Can you please verify that you used the correct e-mail address?
Regards,
Damba
Yes i send it to right address, I even get the reply saying that
Dear Ashish Chauhan,
This is an automated response to inform you that your ticket has been
created and added to our helpdesk.
We will respond as soon as possible to your inquiry. You will receive
a separate email notification when a response is submitted.
But no solution as of yet :(
Re: Unhandled Exception in XMPP
by woddrazen, Wednesday, December 15, 2010, 09:04 (5093 days ago) @ gothic_coder
Ash,
New sample is included in installation. You can find it in Samples ATL folder.
Can you please delete wodXMPP Samples folder, reinstall wodXMMP and try new 2. DialogEvents sample?
Let us know how it goes.
Drazen
Re: Unhandled Exception in XMPP
by gothic_coder, Wednesday, December 15, 2010, 10:38 (5093 days ago) @ woddrazen
Hello Drazen,
Yes i checked the new sample and it worked perfectly, The problem is that the new sample is dialog based application so after sending text it wait for the incomingmessage event till it get disconnected (when someone press the disconnect button).
But i was trying in console application (SimpleIm in ATL Folder), where it Sends the text and immediately call disconnect. How could i make it wait for IncomingMessage event?
I thought of turn off the Blocking but it throws the exception.
pXMPP->Blocking = VARIANT_FALSE; making this false throws exception, I can't even comment it.
I hope you get the point.
Thanks a lot for you time.
Re: Unhandled Exception in XMPP
by woddrazen, Wednesday, December 15, 2010, 11:37 (5093 days ago) @ gothic_coder
Ash,
Inside scripting environment like ATL console application you should use blocking mode.
Non blocking mode and wodXMPP Events will work there only if you use message pump (GetMessage..TranslateMessage..DispatchMessage) to process messages.
Drazen
Re: Unhandled Exception in XMPP
by gothic_coder, Wednesday, December 15, 2010, 12:31 (5093 days ago) @ woddrazen
Ash,
Inside scripting environment like ATL console application you should use blocking mode.
If i send some offline messages, and then if i connect it catch the offline message and shows it, But it won't catch while i send reply while the program is running... Am i missing something here..
Thanks
Re: Unhandled Exception in XMPP
by woddrazen, Wednesday, December 15, 2010, 12:41 (5093 days ago) @ gothic_coder
Ash,
Inside console application you can use wodXMPP Events in non blocking mode only if you will use message pump to process messages.
while (GetMessage())
{
TranslateMessage();
DispatchMessage();
}
Drazen
Re: Unhandled Exception in XMPP
by gothic_coder, Wednesday, December 15, 2010, 12:44 (5093 days ago) @ woddrazen
Ash,
Inside console application you can use wodXMPP Events in non blocking mode only if you will use message pump to process messages.while (GetMessage())
{
TranslateMessage();
DispatchMessage();
}
Drazen
Please read my previous post, I modified it.
Thanks.
Re: Unhandled Exception in XMPP
by woddrazen, Wednesday, December 15, 2010, 13:07 (5093 days ago) @ gothic_coder
Ash,
Does this problem occur with new 2. DialogEvents sample?
Drazen
Re: Unhandled Exception in XMPP
by gothic_coder, Wednesday, December 15, 2010, 13:11 (5093 days ago) @ woddrazen
No, The new sample works perfectly.. But i can't use Dialog Box in my application, So i'm sticking with SimpleIm Project.
Re: Unhandled Exception in XMPP
by gothic_coder, Wednesday, December 15, 2010, 13:32 (5093 days ago) @ gothic_coder
Ok i just added Message Loop in Console Applicatio, It's working fine..
Thanks for your time, Will get back to you in case of any problem.