CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2000
    Posts
    14

    VB INTERNET CONTROLS OCX

    Hi,

    With Webbrowser Events Control of VB we can monitor DownloadBegin/Complete events etc, BUT how can we monitor if there is an EXISTING INTERNET MODEM CONNECTION?

    With WININET.DLL there is an
    INTERNETGETCONNECTEDSTATE(INTERNET_CONNECTION_MODEM, 0)
    which returns Boolean results,
    BUT this is not registrable as ACTIVE-X, IS THERE A SIMPLE WAY TO CHECK THE SAME THING IN VB Components??

    OR, how do we incorporate the above WININET codes into VB??


    Thanks in advance.





  2. #2
    Join Date
    Sep 1999
    Location
    Red Wing, MN USA
    Posts
    312

    Re: VB INTERNET CONTROLS OCX

    Try this:
    'In a Module..
    private Declare Function RegOpenKey Lib "advapi32.dll" Alias "RegOpenKeyA" (byval hKey as Long, byval lpSubKey as string, phkResult as Long) as Long
    private Declare Function RegQueryValueEx Lib "advapi32.dll" Alias "RegQueryValueExA" (byval hKey as Long, byval lpValueName as string, byval lpReserved as Long, lpType as Long, lpData as Any, lpcbData as Long) as Long ' Note that if you declare the lpData parameter as string, you must pass it By Value.
    private Declare Function RegCloseKey Lib "advapi32.dll" (byval hKey as Long) as Long
    private Const HKEY_LOCAL_MACHINE = &H80000002

    public Function IsConnected() as Boolean
    Dim lRegKey as Long
    Dim bData(3) as Byte

    If RegOpenKey(HKEY_LOCAL_MACHINE, "System\CurrentControlSet\Services\RemoteAccess", lRegKey) = 0 then
    'Opened RegKey Successfully..
    If RegQueryValueEx(lRegKey, "Remote Connection", 0&, 1&, bData(0), 4) = 0 then
    'Query the Value of "Remote Connection" 1 - Connected, 0 - Not Connected
    IsConnected = bData(0)
    else
    'Counldn't find the Value, assume no Connection
    IsConnected = false
    End If
    'Close the Registry Key
    Call RegCloseKey(lRegKey)
    End If
    End Function



    Aaron Young
    Analyst Programmer
    [email protected]
    [email protected]
    Certified AllExperts Expert: http://www.allexperts.com/displayExp...p?Expert=11884
    Aaron Young
    Senior Programmer Analyst (Red Wing Software)
    Certified AllExperts Expert

  3. #3
    Join Date
    Jan 2000
    Posts
    14

    Re: VB INTERNET CONTROLS OCX

    Thanks for the good registry method.

    Could you give the codes necessary to use Declare INCLUDE LIB method to use WinInet.Dll in VB??


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