Solved

How to create object that will receive connection notifications??

Posted on 2004-09-16
2
564 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Unix / Linux grid computing 5 169
sameEnds challenge 3 187
Smart Camera scanning and reading information 3 121
Line meaning 9 90
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
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.
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

749 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