Solved

Winsock: Networking and Internet

Posted on 2000-02-19
9
251 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
 

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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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 100 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
VB6 / DAO 3.6 / run time error: Couldn't find installable ISAM 7 79
Problem to event 3 79
Hide vba in gp 7 83
Modifying Conditional Format from VBA code 3 49
Having just graduated from college and entered the workforce, I don’t find myself always using the tools and programs I grew accustomed to over the past four years. However, there is one program I continually find myself reverting back to…R.   So …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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.

863 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

Need Help in Real-Time?

Connect with top rated Experts

26 Experts available now in Live!

Get 1:1 Help Now