Solved

How to create object that will receive connection notifications??

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
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.

910 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

20 Experts available now in Live!

Get 1:1 Help Now