home *** CD-ROM | disk | FTP | other *** search
/ Chip 1999 November / Chip_1999-11_cd.bin / zkuste / VBasic / Data / ActiveX / msdns10.exe / dns_demo.frm next >
Text File  |  1998-02-11  |  4KB  |  131 lines

  1. VERSION 5.00
  2. Object = "{14AC9F3F-A2C1-11D1-8C45-0080AD1CD4EA}#15.0#0"; "MSDNS.OCX"
  3. Begin VB.Form Form1 
  4.    Caption         =   "DNS Lookup example for msDNS"
  5.    ClientHeight    =   3060
  6.    ClientLeft      =   60
  7.    ClientTop       =   345
  8.    ClientWidth     =   4575
  9.    LinkTopic       =   "Form1"
  10.    ScaleHeight     =   3060
  11.    ScaleWidth      =   4575
  12.    StartUpPosition =   3  'Windows-Standard
  13.    Begin msDNS.DNS DNS1 
  14.       Left            =   3720
  15.       Top             =   2280
  16.       _ExtentX        =   1085
  17.       _ExtentY        =   1085
  18.    End
  19.    Begin VB.TextBox Text1 
  20.       Height          =   285
  21.       Index           =   1
  22.       Left            =   720
  23.       TabIndex        =   5
  24.       Top             =   1270
  25.       Width           =   3615
  26.    End
  27.    Begin VB.CommandButton Query 
  28.       Caption         =   "&Query"
  29.       Default         =   -1  'True
  30.       Height          =   495
  31.       Left            =   1800
  32.       TabIndex        =   1
  33.       Top             =   2400
  34.       Width           =   1215
  35.    End
  36.    Begin VB.TextBox Text1 
  37.       Height          =   285
  38.       Index           =   0
  39.       Left            =   720
  40.       TabIndex        =   0
  41.       Text            =   "www.basicworld.com"
  42.       Top             =   1750
  43.       Width           =   3615
  44.    End
  45.    Begin VB.Label Label2 
  46.       Alignment       =   1  'Rechts
  47.       Caption         =   "Name:"
  48.       Height          =   255
  49.       Index           =   1
  50.       Left            =   120
  51.       TabIndex        =   4
  52.       Top             =   1800
  53.       Width           =   495
  54.    End
  55.    Begin VB.Label Label2 
  56.       Alignment       =   1  'Rechts
  57.       Caption         =   "IP:"
  58.       Height          =   255
  59.       Index           =   0
  60.       Left            =   120
  61.       TabIndex        =   3
  62.       Top             =   1320
  63.       Width           =   495
  64.    End
  65.    Begin VB.Label Label1 
  66.       Caption         =   "Please enter either an IP address or a servername and press ""Query"" to query your DNS server for the missing information:"
  67.       Height          =   975
  68.       Left            =   240
  69.       TabIndex        =   2
  70.       Top             =   240
  71.       Width           =   4215
  72.    End
  73. End
  74. Attribute VB_Name = "Form1"
  75. Attribute VB_GlobalNameSpace = False
  76. Attribute VB_Creatable = False
  77. Attribute VB_PredeclaredId = True
  78. Attribute VB_Exposed = False
  79. Option Explicit
  80. Private UnusedField As Integer
  81.  
  82. Private Sub DNS1_Ready(ByVal Status As Integer)
  83.     
  84.     Select Case Status
  85.         Case dnsReady
  86.             Text1(0) = DNS1.HostName
  87.             Text1(1) = DNS1.HostIP
  88.         Case dnsError
  89.             If Text1(0) = "" Then Text1(0) = "(DNS error)" Else Text1(1) = "(error)"
  90.         Case dnsNotFound
  91.             If Text1(0) = "" Then Text1(0) = "(address not found)" Else Text1(1) = "(not found)"
  92.     End Select
  93.     Screen.MousePointer = 0
  94.     
  95. End Sub
  96.  
  97. Private Sub DNS1_SocketError(ByVal Number As Integer, ByVal Description As String)
  98.     MsgBox "A socket error occured:" & vbCrLf & Description, "Sorry!"
  99.     Screen.MousePointer = 0
  100. End Sub
  101.  
  102. Private Sub Form_Load()
  103.     UnusedField = 1
  104. End Sub
  105.  
  106. Private Sub Query_Click()
  107.     
  108.     Text1(UnusedField) = ""
  109.     
  110.     Screen.MousePointer = vbHourglass
  111.     
  112.     If Text1(1) = "" Then
  113.         DNS1.HostName = Text1(0)
  114.     Else
  115.         DNS1.HostIP = Text1(1)
  116.     End If
  117.     
  118. End Sub
  119.  
  120.  
  121. Private Sub Text1_GotFocus(Index As Integer)
  122.     With Text1(Index)
  123.         .SelStart = 0
  124.         .SelLength = Len(.Text)
  125.     End With
  126. End Sub
  127.  
  128. Private Sub Text1_KeyPress(Index As Integer, KeyAscii As Integer)
  129.     UnusedField = IIf(Index = 0, 1, 0)
  130. End Sub
  131.