Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Winsock: Networking and Internet

Posted on 2000-02-19
9
Medium Priority
?
260 Views
Last Modified: 2013-11-13
I'm looking for codes that will enable a PC to extract another PC's internet activity online. What i want is the ablility to obtain the IE and Netscape Navigator's internet site address and the topic as well, if available.
I've established a connection using the winsock control within 2 PCs. I just need the codes to add in to obtain the infomation on the PC that I'm monitoring. I'm looking for an easy-to-use protocol; i.e. just click and display type, a click will display a list of internet addresses that the monitored PC is currently browsing on.
And can someone teach me how to do multiple connection with that winsock control? I've tried many times but still fail. What are the things that I should do?
Points awarded could be up if necessary...
Thanx.
0
Comment
Question by:pennyroyal
  • 3
  • 2
  • 2
  • +2
9 Comments
 
LVL 2

Expert Comment

by:orbitaltech
ID: 2538973
Well, to create multiple instances of a winsock control is not too hard. Just like any other windows control, you want to set the Index property of the Winsock control to 0. This will allow you to reference multiple instances of the control. For example:

Winsock1(0)
Winsock1(1)
Winsock1(2)  etc...

This should solve some of your problems..
0
 

Expert Comment

by:FAQ
ID: 2539123
why don't you use the API?
0
 
LVL 2

Expert Comment

by:orbitaltech
ID: 2539243
Either or would work
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:pennyroyal
ID: 2539686
What I really wanted is my first question. How to retrieve the site address and the topic from another PC who is browsing using Netscape and IE?
I appreciate the answers to my second question, but I really need the monitoring internet part before I go into the multiple connection part...
Thanx.
0
 
LVL 13

Expert Comment

by:crazyman
ID: 2542269
Place a text box called DDELink on a form and a command button (command1)

Option Explicit

Private Sub Command1_Click()
    MsgBox GetCurrentIEURL
    MsgBox GetCurrentNetscapeURL
End Sub
Function GetCurrentNetscapeURL()
Dim commapos As Integer
Dim urltitle As String
With DDELink
    .LinkMode = 0
    .LinkTopic = "Netscape|WWW_GetWindowInfo"
    .LinkItem = &HFFFFFFFF
    .LinkMode = 2
    .LinkRequest
    .LinkMode = 0
    Debug.Print .Text
    Debug.Print Left(.Text, 20)
    commapos = InStr(.Text, ",")
    Debug.Print
    GetCurrentNetscapeURL = Mid(.Text, 2, commapos - 3)
    urltitle = Mid(.Text, commapos + 2, Len(.Text) - (commapos + 2))
  End With
End Function
Function GetCurrentIEURL()
Dim commapos As Integer
Dim urltitle As String
With DDELink
    .LinkMode = 0
    .LinkTopic = "Iexplore|WWW_GetWindowInfo"
    .LinkItem = &HFFFFFFFF
    .LinkMode = 2
    .LinkRequest
    .LinkMode = 0
    Debug.Print .Text
    Debug.Print Left(.Text, 20)
    commapos = InStr(.Text, ",")
    Debug.Print
    GetCurrentIEURL = Mid(.Text, 2, commapos - 3)
    urltitle = Mid(.Text, commapos + 2, Len(.Text) - (commapos + 2))
  End With
End Function

this is easily modified to send the data over the network
0
 
LVL 13

Accepted Solution

by:
crazyman earned 400 total points
ID: 2542289
Use EnumWindows to search for all IE windows.  Here is an example: (Taken from a PAQ)

                           '~~~~~Form Code~~~~~

                           Option Explicit

                           Private Sub Command1_Click()
                               Call fEnumWindows 'Look for IE
                           End Sub


                           '~~~~~Module Code~~~~~

                           Option Explicit

                           Public Const MAX_PATH = 260
                           Declare Function EnumWindows Lib "user32" (ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long
                           Declare Function GetClassName Lib "user32" Alias "GetClassNameA" (ByVal hwnd As Long, ByVal lpClassName As String, ByVal nMaxCount As Long) As Long
                           Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long

                           Public Function EnumFunc(ByVal hwnd As Long, ByVal lpData As Long) As Long
                               Dim lResult    As Long
                               Dim sWndName   As String
                               Dim szClassName As String
                           '
                           ' This callback function is called by Windows (from the EnumWindows
                           ' API call) for EVERY window that exists.  It populates the aWindowList
                           ' array with a list of windows that we are interested in.
                           '
                               EnumFunc = 1
                               szClassName = Space$(MAX_PATH)
                               sWndName = Space$(MAX_PATH)

                               lResult = GetClassName(hwnd, szClassName, MAX_PATH)
                               szClassName = Left$(szClassName, lResult)

                               If UCase(szClassName) = "IEFRAME" Then
                                   lResult = GetWindowText(hwnd, sWndName, MAX_PATH)
                                   sWndName = Left$(sWndName, lResult)
                                   'Found an IE window
                                   'Do something with the window text here
                                   Debug.Print sWndName
                               End If
                           End Function

                           Public Function fEnumWindows() As Boolean
                               Dim hwnd As Long
                           '
                           ' The EnumWindows function enumerates all top-level windows
                           ' on the screen by passing the handle of each window, in turn,
                           ' to an application-defined callback function. EnumWindows
                           ' continues until the last top-level window is enumerated or
                           ' the callback function returns FALSE.
                           '
                               Call EnumWindows(AddressOf EnumFunc, hwnd)
                           End Function
0
 
LVL 13

Expert Comment

by:crazyman
ID: 2542321
If you use any of mine please reject the current answer and accept my comment as an answer.
Cheers
0
 

Author Comment

by:pennyroyal
ID: 2551629
thanx a lot...
simply fabulous...
exactly what i need... :)
0
 

Expert Comment

by:newmembername
ID: 5042631
use winsock?
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

There is an easy way, in .NET, to centralize the treatment of all unexpected errors. First of all, instead of launching the application directly in a Form, you need first to write a Sub called Main, in a module. Then, set the Startup Object to th…
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
Suggested Courses

783 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