CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2001
    Posts
    13

    detect if dial up is idle

    how can i do that?


  2. #2
    Join Date
    Apr 2000
    Posts
    737

    Re: detect if dial up is idle

    not sure whether this is the best, but it work for me.


    Declare Function RasEnumConnections Lib "rasapi32.dll" Alias "RasEnumConnectionsA" (lprasconn as Any, lpcb as Long, lpcConnections as Long) as Long

    public Type RASCONN
    dwSize as Long
    hRasConn as Long
    szEntryName as string * RAS_MaxEntryName
    szDeviceType as string * RAS_MaxDeviceType
    szDeviceName as string * RAS_MaxDeviceName
    End Type

    public Function IsDialUpIdle() as Long
    Dim conn(255) as RASCONN
    Dim bufferSize as Long
    Dim noOfConn as Long

    bufferSize = 105472 '256 * 412

    conn(0).dwSize = 412

    vbDLLErrorCode = RasEnumConnections(conn(0), bufferSize, noOfConn)

    If vbDLLErrorCode = ERROR_SUCCESS And noOfConn = 0 then

    IsDialUpIdle = VB_TRUE 'yap, it's idle

    ElseIf vbDLLErrorCode = 0 then

    IsDialUpIdle = VB_FALSE 'got connection

    else

    IsDialUpIdle = VB_DLL_ERROR 'RasEnumConnections error

    End If

    End Function





    HTH

    cksiow
    http://vblib.virtualave.net - share our codes


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured