Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

Handling connection notification between a desktop machine and Windows CE based devices

, 14 Jan 2009
This article describes how to get notification when a Windows CE based device is connected or disconnected from a desktop machine.
GetNotificationOnConnect_src.zip
GetNotificationOnConnect
WindowsApplication1
bin
Release
WindowsApplication1.exe
WindowsApplication1.vshost.exe
GetNotificationOnConnect.vbproj.user
My Project
Application.myapp
Settings.settings
Imports System.Runtime.InteropServices
''' <summary>
''' This event handler is used to register the event on Connection.
''' </summary>
<Serializable()> <ComVisible(True)> Public Delegate Sub ActiveHandler()
''' <summary>
''' This event handler is used to register the event on DisConnection.
''' </summary>
<Serializable()> <ComVisible(True)> Public Delegate Sub DisconnectHandler()
''' <summary>
''' This class is used to get the instance of IDccManSink. It is implemented by
''' Connection Manager of ActiveSynk.
''' </summary>
<ComImport(), Guid("499C0C20-A766-11cf-8011-00A0C90A8F78")> _
Public Class DccMan
End Class
''' <summary>
''' This Interface is used to get all the methods available in the IDccMan. with the help of 
''' this interface we can register / deregister the IDccManSink.
''' </summary>
<ComImport(), Guid("A7B88841-A812-11cf-8011-00A0C90A8F78"), _
InterfaceType(ComInterfaceType.InterfaceIsIUnknown)> _
Public Interface IDccMan
    Function Advise(ByVal pDccSink As IDccManSink, _
                    ByRef dwContext As Int32) As Int32
    Function Unadvise(ByVal dwContext As Int32) As Int32
    Sub ShowCommSettings()
    Sub AutoconnectEnable()
    Sub AutoconnectDisable()
    Sub ConnectNow()
    Sub DisconnectNow()
    Sub SetIconDataTransferring()
    Sub SetIconNoDataTransferring()
    Sub SetIconError()
End Interface
''' <summary>
''' This Interface is used to get all the methods available in the IDccManSink.
''' </summary>
<Guid("A7B88840-A812-11cf-8011-00A0C90A8F78"), _
InterfaceType(ComInterfaceType.InterfaceIsIUnknown)> _
Public Interface IDccManSink
    <PreserveSig()> Function OnLogIpAddr(<InAttribute()> ByVal dwIpAddr As Int32) As Int32
    <PreserveSig()> Function OnLogTerminated() As Int32
    <PreserveSig()> Function OnLogActive() As Int32
    <PreserveSig()> Function OnLogInactive() As Int32
    <PreserveSig()> Function OnLogAnswered() As Int32
    <PreserveSig()> Function OnLogListen() As Int32
    <PreserveSig()> Function OnLogDisconnection() As Int32
    <PreserveSig()> Function OnLogError() As Int32
End Interface
''' <summary>
''' This class is used to define all the methods of IDccManSink. the methods of this class gets
''' triggered on connection / disconnection.
''' </summary>
''' <remarks></remarks>
<Guid("C6659361-1625-4746-931C-36014B146679")> _
Public Class DccManSink
    Implements IDccManSink
    Public Event Active As ActiveHandler
    Public Event Disconnect As DisconnectHandler
    Public Function OnLogActive() As Int32 Implements IDccManSink.OnLogActive
        RaiseEvent Active()
    End Function

    Public Function OnLogAnswered() As Int32 Implements IDccManSink.OnLogAnswered

    End Function

    Public Function OnLogDisconnection() As Int32 Implements IDccManSink.OnLogDisconnection
        RaiseEvent Disconnect()
    End Function

    Public Function OnLogError() As Int32 Implements IDccManSink.OnLogError
    End Function

    Public Function OnLogInactive() As Int32 Implements IDccManSink.OnLogInactive
    End Function

    Public Function OnLogIpAddr(ByVal dwIpAddr As Int32) As Int32 Implements IDccManSink.OnLogIpAddr
    End Function

    Public Function OnLogListen() As Int32 Implements IDccManSink.OnLogListen
    End Function

    Public Function OnLogTerminated() As Int32 Implements IDccManSink.OnLogTerminated
    End Function
End Class

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Anil_gupta
Software Developer Microsoft India
India India
No Biography provided

| Advertise | Privacy | Mobile
Web03 | 2.8.140721.1 | Last Updated 15 Jan 2009
Article Copyright 2006 by Anil_gupta
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid