⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 writing_control.html

📁 支持监控包括传输控制协议和 UDP 的所有的互联网传输协议。同时程序具有实时文件防修改监控功能
💻 HTML
字号:
<html>
<head>
	<title>Writing DNS Control</title>
</head>

<body bgcolor="white">
<table border="0" cellpadding="0" cellspacing="0" width="980"><tr>
<td width="14%" valign="top">
<!--index-->
  <img src="ostro_logo.gif" alt="OstroSoft Logo" width="170" border="0" hspace="0" vspace="0"><p>
  <table border="5" cellpadding="0" cellspacing="0" bordercolor="silver" width="100%"><tr><td>
  <table border="0" cellpadding="2" cellspacing="0" width="100%">
    <tr><td>
      <a href=http://www.ostrosoft.com/><font face="arial,helvetica,verdana" size="2"><b>Corporate</b></font></a>
    </td></tr>
    <tr><td>
      <font face="arial,helvetica,verdana" size="2"><b>Products</b></font>
      <table border="0" cellpadding="0" cellspacing="0">
      <tr><td>&nbsp;&nbsp;&nbsp;&nbsp;<a href=http://www.ostrosoft.com/ostronet.html><font face="arial,helvetica,verdana" size="2">Internet Tools</font></a></td></tr>
      <tr><td>&nbsp;&nbsp;&nbsp;&nbsp;<a href=http://www.ostrosoft.com/formoed.html><font face="arial,helvetica,verdana" size="2">FormoEd</font></a></td></tr>
      <tr><td>&nbsp;&nbsp;&nbsp;&nbsp;<a href=http://www.ostrosoft.com/smtp.html><font face="arial,helvetica,verdana" size="2">SMTP control</font></a></td></tr>
      <tr><td>&nbsp;&nbsp;&nbsp;&nbsp;<a href=DNS.html><font face="arial,helvetica,verdana" size="2">DNS control</font></a></td></tr>
      <tr><td><table border="0" cellpadding="0" cellspacing="0"><tr><td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td><td>
        <font face="arial,helvetica,verdana" size="1"><a href="DNS.html">Main page</a></font><br>
        <font face="arial,helvetica,verdana" size="1"><a href="writing_control.html">Writing DNS control</a></font><br>
        <font face="arial,helvetica,verdana" size="1"><a href="using_vb.html">Using with VB</a></font><br>
        <font face="arial,helvetica,verdana" size="1"><a href="using_asp.html">Using with MTS/COM+</a></font><br>
        <font face="arial,helvetica,verdana" size="1"><a href="using_office.html">Using with VBScript</a></font><br>
        <font face="arial,helvetica,verdana" size="1"><a href="FAQ.html">DNS FAQ</a></font><br>
      </td></tr></table></td></tr>
      <tr><td>&nbsp;&nbsp;&nbsp;&nbsp;<a href=http://www.ostrosoft.com/whois.html><font face="arial,helvetica,verdana" size="2">WhoIs control</font></a></td></tr>
      <tr><td>&nbsp;&nbsp;&nbsp;&nbsp;<a href=http://www.ostrosoft.com/oswinsck.html><font face="arial,helvetica,verdana" size="2">oswinsck.dll</font></a></td></tr>
      <tr><td>&nbsp;&nbsp;&nbsp;&nbsp;<a href=http://www.ostrosoft.com/backtrace.asp><font face="arial,helvetica,verdana" size="2">Backtrace</font></a></td></tr>
      <tr><td>&nbsp;&nbsp;&nbsp;&nbsp;<a href=http://www.ostrosoft.com/buy.html><font face="arial,helvetica,verdana" size="2">Buy on-line</font></a></td></tr>
      <tr><td>&nbsp;&nbsp;&nbsp;&nbsp;<a href=http://www.ostrosoft.com/download.html><font face="arial,helvetica,verdana" size="2">Download</font></a></td></tr>
      </table>
    </td></tr>
    <tr><td>
      <a href=http://www.ostrosoft.com/login.asp><font face="arial,helvetica,verdana" size="2"><b>Customer Support</b></font></a>
    </td></tr>
    <tr><td>
      <a href=http://www.ostrosoft.com/vb><font face="arial,helvetica,verdana" size="2"><b>Editorial</b></font></a>
    </td></tr>
  </table>
  </td></tr></table>
<!--end index-->
</td>
<td width="1%">&nbsp;&nbsp;&nbsp;</td>
<td valign="top">
<!--content-->
  <center><font face="arial,helvetica,verdana" size="5">Writing DNS Control</font><p>
  <font face="arial,helvetica,verdana" size="2">
<b><a href="DNS.html">Main page</a>&nbsp;&nbsp;&nbsp;&nbsp;
<a href="writing_control.html">Writing DNS control</a>&nbsp;&nbsp;&nbsp;&nbsp;
<a href="using_vb.html">Using with VB</a>&nbsp;&nbsp;&nbsp;&nbsp;
<a href="using_asp.html">Using with MTS/COM+</a>&nbsp;&nbsp;&nbsp;&nbsp;
<a href="using_office.html">Using with VBScript</a>&nbsp;&nbsp;&nbsp;&nbsp;
<a href="FAQ.html">DNS FAQ</a></b></center><p>
<font color="#008040">Description: </font>OCX control, resolving host name to IP address and IP address to host name.<br>
<font color="#008040">Minimum requirements: </font>Visual Basic 4<br>
<font color="#008040">Download:</font> <a href="writing_control.zip">source code</a><br>
<font color="#008040">Project: </font>ActiveX Control<br>
<font color="#008040">Code:</font><br>
Const WSADescription_Len = 256<br>
Const WSASYS_Status_Len = 128<br>
Private Type HOSTENT<br>
&nbsp;&nbsp; hName As Long<br>
&nbsp;&nbsp; hAliases As Long<br>
&nbsp;&nbsp; hAddrType As Integer<br>
&nbsp;&nbsp; hLength As Integer<br>
&nbsp;&nbsp; hAddrList As Long<br>
End Type<br>
Private Type WSADATA<br>
&nbsp;&nbsp; wversion As Integer<br>
&nbsp;&nbsp; wHighVersion As Integer<br>
&nbsp;&nbsp; szDescription(0 To WSADescription_Len) As Byte<br>
&nbsp;&nbsp; szSystemStatus(0 To WSASYS_Status_Len) As Byte<br>
&nbsp;&nbsp; iMaxSockets As Integer<br>
&nbsp;&nbsp; iMaxUdpDg As Integer<br>
&nbsp;&nbsp; lpszVendorInfo As Long<br>
End Type<br>
<br>
Private Declare Function WSAStartup Lib &quot;wsock32&quot; _<br>
&nbsp;&nbsp; (ByVal VersionReq As Long, WSADataReturn As WSADATA) As Long<br>
Private Declare Function WSACleanup Lib &quot;wsock32&quot; () As Long<br>
Private Declare Function WSAGetLastError Lib &quot;wsock32&quot; () As Long<br>
Private Declare Function gethostbyaddr Lib &quot;wsock32&quot; (addr As Long, addrLen As
Long, _<br>
&nbsp;&nbsp; addrType As Long) As Long<br>
Private Declare Function gethostbyname Lib &quot;wsock32&quot; (ByVal hostname As String)
As Long<br>
Private Declare Sub RtlMoveMemory Lib &quot;kernel32&quot; (hpvDest As Any, ByVal
hpvSource As Long, _<br>
&nbsp;&nbsp; ByVal cbCopy As Long)<br>
<br>
Public Event Error(ByVal Number As Long, Description As String)<br>
Public Event ResolveCompleted()<br>
<br>
'checks if string is valid IP address<br>
Private Function IsIP(ByVal strIP As String) As Boolean<br>
&nbsp;&nbsp; On Error Resume Next<br>
&nbsp;&nbsp; Dim t As String: Dim s As String: Dim i As Integer<br>
&nbsp;&nbsp; s = strIP<br>
&nbsp;&nbsp; While InStr(s, &quot;.&quot;) &lt;&gt; 0<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; t = Left(s, InStr(s, &quot;.&quot;) - 1)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If IsNumeric(t) And Val(t) &gt;= 0 And Val(t) &lt;= 255 Then s = Mid(s,
InStr(s, &quot;.&quot;) + 1) _<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Else Exit Function<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i = i + 1<br>
&nbsp;&nbsp; Wend<br>
&nbsp;&nbsp; t = s<br>
&nbsp;&nbsp; If IsNumeric(t) And InStr(t, &quot;.&quot;) = 0 And Len(t) = Len(Trim(Str(Val(t))))
And _<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Val(t) &gt;= 0 And Val(t) &lt;= 255 And strIP &lt;&gt;
&quot;255.255.255.255&quot; And i = 3 Then IsIP = True<br>
&nbsp;&nbsp; If Err.Number &gt; 0 Then<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; RaiseEvent Error(Err.Number, Err.Description)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Err.Clear<br>
&nbsp;&nbsp; End If<br>
End Function<br>
<br>
'converts IP address from string to sin_addr<br>
Private Function MakeIP(strIP As String) As Long<br>
&nbsp;&nbsp; On Error Resume Next<br>
&nbsp;&nbsp; Dim lIP As Long<br>
&nbsp;&nbsp; lIP = Left(strIP, InStr(strIP, &quot;.&quot;) - 1)<br>
&nbsp;&nbsp; strIP = Mid(strIP, InStr(strIP, &quot;.&quot;) + 1)<br>
&nbsp;&nbsp; lIP = lIP + Left(strIP, InStr(strIP, &quot;.&quot;) - 1) * 256<br>
&nbsp;&nbsp; strIP = Mid(strIP, InStr(strIP, &quot;.&quot;) + 1)<br>
&nbsp;&nbsp; lIP = lIP + Left(strIP, InStr(strIP, &quot;.&quot;) - 1) * 256 * 256<br>
&nbsp;&nbsp; strIP = Mid(strIP, InStr(strIP, &quot;.&quot;) + 1)<br>
&nbsp;&nbsp; If strIP &lt; 128 Then<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; lIP = lIP + strIP * 256 * 256 * 256<br>
&nbsp;&nbsp; Else<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; lIP = lIP + (strIP - 256) * 256 * 256 * 256<br>
&nbsp;&nbsp; End If<br>
&nbsp;&nbsp; MakeIP = lIP<br>
&nbsp;&nbsp; If Err.Number &gt; 0 Then<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; RaiseEvent Error(Err.Number, Err.Description)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Err.Clear<br>
&nbsp;&nbsp; End If<br>
End Function<br>
<br>
'resolves IP address to host name<br>
Private Function NameByAddr(strAddr As String) As String<br>
&nbsp;&nbsp; On Error Resume Next<br>
&nbsp;&nbsp; Dim nRet As Long<br>
&nbsp;&nbsp; Dim lIP As Long<br>
&nbsp;&nbsp; Dim strHost As String * 255: Dim strTemp As String<br>
&nbsp;&nbsp; Dim hst As HOSTENT<br>
&nbsp;&nbsp; <br>
&nbsp;&nbsp; If IsIP(strAddr) Then<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; lIP = MakeIP(strAddr)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; nRet = gethostbyaddr(lIP, 4, 2)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If nRet &lt;&gt; 0 Then<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; RtlMoveMemory hst, nRet, Len(hst)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; RtlMoveMemory ByVal strHost, hst.hName, 255<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; strTemp = strHost<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If InStr(strTemp, Chr(10)) &lt;&gt; 0 Then strTemp =
Left(strTemp, InStr(strTemp, Chr(0)) - 1)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; strTemp = Trim(strTemp)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NameByAddr = strTemp<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Else<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; RaiseEvent Error(9003, &quot;Host name not found&quot;)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Exit Function<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End If<br>
&nbsp;&nbsp; Else<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; RaiseEvent Error(9002, &quot;Invalid IP address&quot;)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Exit Function<br>
&nbsp;&nbsp; End If<br>
&nbsp;&nbsp; If Err.Number &gt; 0 Then<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; RaiseEvent Error(Err.Number, Err.Description)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Err.Clear<br>
&nbsp;&nbsp; End If<br>
End Function<br>
<br>
'resolves host name to IP address<br>
Private Function AddrByName(ByVal strHost As String)<br>
&nbsp;&nbsp; On Error Resume Next<br>
&nbsp;&nbsp; Dim hostent_addr As Long<br>
&nbsp;&nbsp; Dim hst As HOSTENT<br>
&nbsp;&nbsp; Dim hostip_addr As Long<br>
&nbsp;&nbsp; Dim temp_ip_address() As Byte<br>
&nbsp;&nbsp; Dim i As Integer<br>
&nbsp;&nbsp; Dim ip_address As String<br>
&nbsp;&nbsp; If IsIP(strHost) Then<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AddrByName = strHost<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Exit Function<br>
&nbsp;&nbsp; End If<br>
&nbsp;&nbsp; hostent_addr = gethostbyname(strHost)<br>
&nbsp;&nbsp; If hostent_addr = 0 Then<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; RaiseEvent Error(9001, &quot;Can't resolve hst&quot;)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Exit Function<br>
&nbsp;&nbsp; End If<br>
&nbsp;&nbsp; RtlMoveMemory hst, hostent_addr, LenB(hst)<br>
&nbsp;&nbsp; RtlMoveMemory hostip_addr, hst.hAddrList, 4<br>
&nbsp;&nbsp; ReDim temp_ip_address(1 To hst.hLength)<br>
&nbsp;&nbsp; RtlMoveMemory temp_ip_address(1), hostip_addr, hst.hLength<br>
&nbsp;&nbsp; For i = 1 To hst.hLength<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ip_address = ip_address &amp; temp_ip_address(i) &amp; &quot;.&quot;<br>
&nbsp;&nbsp; Next<br>
&nbsp;&nbsp; ip_address = Mid(ip_address, 1, Len(ip_address) - 1)<br>
&nbsp;&nbsp; AddrByName = ip_address<br>
&nbsp;&nbsp; If Err.Number &gt; 0 Then<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; RaiseEvent Error(Err.Number, Err.Description)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Err.Clear<br>
&nbsp;&nbsp; End If<br>
End Function<br>
<br>
Public Function AddressToName(strIP As String)<br>
&nbsp;&nbsp; AddressToName = NameByAddr(strIP)<br>
&nbsp;&nbsp; RaiseEvent ResolveCompleted<br>
End Function<br>
<br>
Public Function NameToAddress(strName As String)<br>
&nbsp;&nbsp; NameToAddress = AddrByName(strName)<br>
&nbsp;&nbsp; RaiseEvent ResolveCompleted<br>
End Function<br>
<br>
Private Sub UserControl_Initialize()<br>
&nbsp;&nbsp; Dim udtWSAData As WSADATA<br>
&nbsp;&nbsp; If WSAStartup(257, udtWSAData) Then RaiseEvent Error(Err.LastDllError,
Err.Description)<br>
End Sub<br>
<br>
Private Sub UserControl_Terminate()<br>
&nbsp;&nbsp; WSACleanup<br>
End Sub
</font>
<!--end content-->
</td>
</tr>
<tr><td></td><td valign="top" colspan="2" align="center"><br><font face="arial, geneva" size="1">
<script language="javascript">
function showPrivacy() {
winHelp = window.open('http://www.ostrosoft.com/privacy.html', null, 'left=100,top=100,height=260,width=400,status=no,toolbar=no,menubar=no,location=no,resizable=yes,scrollbars=yes');
}
</script>
<b>Copyright &#169; 1996-2001 OstroSoft. All rights reserved.</b> <a href=mailto:info@ostrosoft.com><i><b>info@ostrosoft.com</b></i></a><br><a href="javascript:showPrivacy();" onmouseover="window.status='Privacy statement'; return true" onmouseout="window.status=''; return true">Privacy statement</a></font></td></tr>
</table>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -