IFaxServerNotify and c++

G

Guest

Guest
Archived from groups: microsoft.public.windowsxp.print_fax (More info?)

Hi,

I want to use fax service extended com api with c++ and did the following:

#import "c:\windows\system32\fxscomex.dll" no_namespace
....
HRESULT res = sipFaxServer->ListenToServerEvents( fsetIN_QUEUE );

....

class fax_notify: public IFaxServerNotify
{
public:
HRESULT OnOutgoingJobAdded( IFaxServer *pFaxServer,
_bstr_t bstrJobId ){ TRACE("added\r\n")};
....
};

In the MSDN I read "A fax client application must implement IFaxServerNotify
and pass the fax service the pointer to an IFaxServerNotify interface.".
But how can I "pass the fax service the pointer to an IFaxServerNotify
interface"???

I hope anybody can help me.

Thanks

claudia
 
Archived from groups: microsoft.public.windowsxp.print_fax (More info?)

The extended COM makes use of Connection pointers to pass on events. You can
read the following links to read more about connection points:-

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/html/_core_connection_points.asp

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/com/htm/events_8jxw.asp



Basically the following are the rough set of steps that you will need to
perform:-

1. Implement a class that supports the IUnknown and IFaxServerNotify
interface.
2. Get The IConnectionpoint interface (refer above links for details) and
call Adivse method with the IUnknown pointer of the class that you
implemented in step 1.

You will now start receiving the events till you call
iConnectionPoint::Unadvise

Please get back if you any more questions.

Thanks,
--
Chandrasekar R
Microsoft Printing, Imaging and Fax Team
This posting is provided "AS IS" with no warranties, and confers no rights.
Please do not send email directly to this alias. This alias is for newsgroup
purposes only.'

"Claudia Hack" <chack@sonocomp.de> wrote in message
news:ccefmq$m32$1@hs-net.handshake.de...
> Hi,
>
> I want to use fax service extended com api with c++ and did the following:
>
> #import "c:\windows\system32\fxscomex.dll" no_namespace
> ...
> HRESULT res = sipFaxServer->ListenToServerEvents( fsetIN_QUEUE );
>
> ...
>
> class fax_notify: public IFaxServerNotify
> {
> public:
> HRESULT OnOutgoingJobAdded( IFaxServer *pFaxServer,
> _bstr_t bstrJobId ){ TRACE("added\r\n")};
> ...
> };
>
> In the MSDN I read "A fax client application must implement
IFaxServerNotify
> and pass the fax service the pointer to an IFaxServerNotify interface.".
> But how can I "pass the fax service the pointer to an IFaxServerNotify
> interface"???
>
> I hope anybody can help me.
>
> Thanks
>
> claudia
>
>
 
Archived from groups: microsoft.public.windowsxp.print_fax (More info?)

Chandrasekar,

I also want to implement the IFaxServerNofity interface and cannot find a
sample code. I wrote the following code and it's not capturing the event
properly.

Regards,
Walter


#include "stdafx.h"

#include "FaxComEx.h"
#include "FaxComEx_i.h"

#include <windows.h>
#include <atlbase.h>
CComModule _Module;
#include <atlcom.h>

_ATL_FUNC_INFO OnIncomingJobAddedInfo = {CC_STDCALL, VT_EMPTY, 2, {VT_I4 |
VT_BYREF, VT_BSTR}};

class CFaxEvents: public IDispEventSimpleImpl<1, CFaxEvents,
&DIID_IFaxServerNotify>
{
public:
//CFaxEvents(IFaxServerNotify *pFaxEvent)
CFaxEvents(IFaxServer *pFaxEvent)
{
m_pFaxEvent = pFaxEvent;
m_pFaxEvent->AddRef();
DispEventAdvise((IUnknown*)m_pFaxEvent);
}
virtual ~CFaxEvents()
{
m_pFaxEvent->Release();
DispEventUnadvise((IUnknown*)m_pFaxEvent);
}
void __stdcall OnOutgoingJobAdded(IFaxServer* pFaxServer, BSTR
bstrJobId)
{
//USES_CONVERSION;
MessageBox(NULL, "Test Message", "Message", MB_OK);
SysFreeString(bstrJobId);
//return S_OK;
}
BEGIN_SINK_MAP(CFaxEvents)
SINK_ENTRY_INFO(1, DIID_IFaxServerNotify, 2, OnOutgoingJobAdded,
&OnIncomingJobAddedInfo)
END_SINK_MAP()
private:
//IFaxServerNotify *m_pFaxEvent;
IFaxServer *m_pFaxEvent;
};



int main(int argc, char* argv[])
{
HRESULT hr;
CoInitialize(NULL);

IFaxServer *pFaxServer = NULL;
CoCreateInstance(CLSID_FaxServer, NULL, CLSCTX_SERVER, IID_IFaxServer,
(void**)&pFaxServer);
hr = pFaxServer->Connect("");

//IFaxServerNotify *pFaxEvent = NULL;
//hr = pFaxServer->QueryInterface(IID_IUnknown, (void**)&pFaxServer);
CFaxEvents *pFEvent = new CFaxEvents(pFaxServer);

pFaxServer->ListenToServerEvents(fsetOUT_QUEUE);

CoUninitialize();
return 0;
}