?
Solved

ICQ Netdetect

Posted on 1999-01-07
1
Medium Priority
?
304 Views
Last Modified: 2006-11-17
 ICQ Netdetect agent is an application that stays in the system tray and waits for an internet connection to launch ICQ. How can I make something like this?
0
Comment
Question by:felipes
[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
1 Comment
 
LVL 3

Accepted Solution

by:
jjbyers earned 100 total points
ID: 1454629
Here is the code I use to check for an active connection.

You could just place a timer in your project and check this function to do what you want.

Public Function ActiveConnection() As Boolean
'*********************************************************
'* Purpose: Checks to see if modem is being used
'*
'* Input Parameters: None
'*
'* Returns: True if connected else False
'*
'* Called Routines: None
'*********************************************************
Dim hKey As Long
Dim lpSubKey As String
Dim phkResult As Long
Dim lpValueName As String
Dim lpReserved As Long
Dim lpType As Long
Dim lpData As Long
Dim lpcbData As Long

  'Setup error trapping
  On Error GoTo ActiveConnection_Error
 
  'Default return
  ActiveConnection = False
 
  'Look in registry for connection information
  lpSubKey = "System\CurrentControlSet\Services\RemoteAccess"
  ReturnCode = RegOpenKey(HKEY_LOCAL_MACHINE, lpSubKey, phkResult)
  If ReturnCode = ERROR_SUCCESS Then
    hKey = phkResult
    lpValueName = "Remote Connection"
    lpReserved = APINULL
    lpType = APINULL
    lpData = APINULL
    lpcbData = APINULL
    ReturnCode = RegQueryValueEx(hKey, lpValueName, lpReserved, lpType, ByVal lpData, lpcbData)
    lpcbData = Len(lpData)
    ReturnCode = RegQueryValueEx(hKey, lpValueName, lpReserved, lpType, lpData, lpcbData)
    If ReturnCode = ERROR_SUCCESS Then
      If lpData = 0 Then
        'Connection not active
        ActiveConnection = False
      Else
        'Connection active
        ActiveConnection = True
      End If
    End If
    RegCloseKey (hKey)
  End If
 
  'No error exit
  Exit Function

ActiveConnection_Error:
  'Show Error
  MsgBox "Error in ActiveConnection of " & Err.Description & " " & Err.Number, vbOKOnly + vbCritical, App.ProductName
End Function

Hope this helps.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

771 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