Solved

How to create object that will receive connection notifications??

Posted on 2004-09-16
2
560 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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
how do i create updater to My Activex application? 3 88
if loop in java 3 142
Change to event 1 112
Increment column based of a FK 8 22
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

777 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