Logo
English Russian German French Spanish Italian
contact usprivacy
   Support Forums
chart
• About the product
• Download (OCX only)
• Download (full setup)
• Writing WhoIs control
• Using with VB
• Using with MTS/COM+
• Using with VBScript
• RFC 954
• FAQ
Writing WhoIs Control

Description: OCX control, allowing to send queries to WhoIs servers
Minimum requirements: Visual Basic 4, oswinsck.dll
Download:source code
Project: ActiveX Control
Code:
Option Explicit

Dim strServ As String
Dim strQuery As String
Dim strResult As String
Dim strStatus As String

Dim wsTCP As oswinsck.TCP
Public Event ConnectWhoIs()
Public Event CloseWhoIs()
Public Event ErrorWhoIs(ByVal Number As Integer, Description As String)

Private sCommand As String

Public Property Let Server(ByVal strTemp As String)
    strServ = strTemp
    PropertyChanged "Server"
End Property

Public Property Let Query(ByVal strTemp As String)
    strQuery = strTemp
    PropertyChanged "Query"
End Property

Public Property Get Server() As String
    Server = strServ
End Property

Public Property Get Query() As String
    Query = strQuery
End Property

Public Property Get Result() As String
    Result = strResult
End Property

Public Property Get Status() As String
    Status = strStatus
End Property

Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
    Server = PropBag.ReadProperty("Server")
    Query = PropBag.ReadProperty("Query")
End Sub

Private Sub UserControl_WriteProperties(PropBag As PropertyBag)
    PropBag.WriteProperty "Server", Server
    PropBag.WriteProperty "Query", Query
End Sub

Public Sub Connect()
    On Error Resume Next
    Set wsTCP = CreateObject("oswinsck.TCP")
    strStatus = "Connecting to WhoIs server"
    If wsTCP.Connect(strServ, 43) = 0 Then
        strStatus = "Connected to WhoIs server"
        RaiseEvent ConnectWhoIs
        wsTCP.SendData strQuery & vbCrLf
        strResult = wsTCP.GetData
        wsTCP.Disconnect
        Set wsTCP = Nothing
        strStatus = "WhoIs session closed"
        RaiseEvent CloseWhoIs
    End If
    Exit Sub
    
ErrHandler:
    If Err.Number <> 0 Then
        strStatus = "WhoIs control error"
        RaiseEvent ErrorWhoIs(Err.Number, Err.Description)
        Err.Clear
    End If
End Sub

Copyright © 1996-2009 OstroSoft. All rights reserved. info@ostrosoft.com