Results 1 to 3 of 3

Thread: Computers connection

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2005
    Posts
    13

    Exclamation Computers connection

    Hi,

    Can someone tell me how can I detect in VB if one ( or at least one ) computer is connected to my computer? I have a host computer and a small one connected to the first; I want to know if the connection is active or not, if the cable is disabled or not.

    Kind regards,

    Kepler

  2. #2
    New Member
    Join Date
    Mar 2006
    Posts
    14

    Re: Computers connection

    This might help: start>run>cmd and type netstat -a. This will dysplay all active connections, listening ports, and so on. For more information about netstat just type netstat -? . OK, now how to get this in visual basic:

    Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long

    ShellExecute Me.hwnd, "Open", "CMD.exe", " /K netstat -a > C:\ip.txt", "C:\", 0
    This will put the results from your command promp in a file so u can use the data.
    Of course there might be an easier way, but I recently used this method in a program and it worked fine.

  3. #3
    Frenzied Member the182guy's Avatar
    Join Date
    Nov 2005
    Location
    Cheshire, UK
    Posts
    1,473

    Re: Computers connection

    there is a lot of examples of how to do this on pscode.com/vb where it does it via API and not saving to a file first
    Chris

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