Re: Unhandled Exception in XMPP - WeOnlyDo Discussion board

Re: Unhandled Exception in XMPP (General questions)

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


Complete thread: