Solved

How to create object that will receive connection notifications??

Posted on 2004-09-16
2
554 Views
Last Modified: 2013-11-20
In MSDN I read:

"The IDccMan interface is implemented by the Windows CE connection manager. It allows an application some control of the connection manager and the ability to register for connection notifications. An application creates this interface by calling the COM CoCreateInstance function using the CLSID_DccMan GUID, and receiving a pointer to an IDccMan interface."

OK I can create this interface BUT....

"IDccMan::Advise
The IDccMan::Advise method is called by a client application to register an IDccManSink object for receiving connection notifications from the Windows CE connection manager.

HRESULT STDMETHODIMP IDccMan::Advise(IDccManSink * pDccSink, DWORD pdwContext);

pDccSink
Pointer to an IDccManSink object that will receive connection notifications.
pdwContext
Pointer to a DWORD that will receive a context value used by the IDccMan object to identify the IDccManSink object that was passed in. The value pointed to by pdwContext should be passed in the call to IDccMan::Unadvise.
"

I would like to know how to create IDccManSink object that will receive connection notifications....???????

Code please...

Thank you very much for your help...

0
Comment
Question by:LukaKrop
2 Comments
 
LVL 12

Accepted Solution

by:
migel earned 500 total points
ID: 12081668
Hi!
It is simple: just create C++ class and inhirit it from  IDccManSink
for example:
class CMySinkObject : public  IDccManSink
{
//
public:
    CMySinkObject();
    ~CMySinkObject(); // note not virtual!
// IUnknown methods:
    ULONG AddRef(void);
    HRESULT QueryInterface( REFIID iid, void ** ppvObject);
    ULONG Release(void);
// IDccManSink methods;
   STDMETHODIMP OnLogAnswered(void);
   STDMETHODIMP OnLogActive(void);
   STDMETHODIMP OnLogDisconnection(void);
   STDMETHODIMP OnLogError(void);
   STDMETHODIMP OnLogInactive(void);
   STDMETHODIMP OnLogIpAddr(DWORD dwIpAddr);
   STDMETHODIMP OnLogListen(void);
   STDMETHODIMP OnLogTerminated(void);
private:
   DWORD m_dwRefCount;
}

implementation for iUnknow ios trivial:
ULONG CMySinkObject::AddRef(void)
{
  return ++m_dwRefCount;

}
HRESULT QueryInterface( REFIID iid, void ** ppvObject)
{
    if( IsEqualIID(riid, IID_IUnknown) || IsEqualIID(riid, IID_IDccManSink))
    {
        *ppvObj = (IDccManSink *)this;
    }
    else
    {
        *ppvObj = NULL;
        return E_NOINTERFACE;
    }

    AddRef();
    return S_OK;
}
ULONG Release(void)
{
    ULONG   ul = m_dwRefCount;

    if (!--m_dwRefCount)
        delete this;

    return ul;
}

Other methods you have to implement manually
Good luck!
0
 

Author Comment

by:LukaKrop
ID: 12081695
Thank you for your help....

Luka
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now