Microsoft Office Excel ® Kod Kılavuzu

Microsoft Office Excel® Code Guide

10 Eylül 2007 Pazartesi

IP No


'Module1

Option Explicit
Type WSADATA

wversion As Integer
wHighVersion As Integer
szDescription(256) As Byte
szSystemStatus(128) As Byte
wMaxSockets As Long
wMaxUDPDG As Long
dwVendorInfo As Long
End Type
Type HOSTENT

hName As Long
hAliases As Long
hAddrType As Integer
hLength As Integer
hAddrList As Long
End Type
Declare Function GetHostByName Lib "wsock32" Alias "gethostbyname" (ByVal hostname As String) As Long
Declare Function WSAStartup Lib "wsock32" (ByVal wVersionRequired As Integer, Data As WSADATA) As Long
Declare Function WSACleanup Lib "wsock32" () As Long
Declare Sub CopyMem Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long)
Dim Out As Integer
Dim Data As WSADATA
Dim Host As Long
Dim Entry As HOSTENT
Dim Address As Long
Dim IPcol() As Byte
Dim Result As String
Dim i As Integer
Sub IP_No()

On Error GoTo ExitSub:
Call CopyMem(Out, 2, 1)
If WSAStartup(Out, Data) = 0 Then
Host = GetHostByName(Empty)
If Host > 0 Then
Call CopyMem(Entry, ByVal Host, Len(Entry))
Call CopyMem(Address, ByVal Entry.hAddrList, Len(Address))
ReDim IPcol(Entry.hLength - 1)
Call CopyMem(IPcol(0), ByVal Address, Entry.hLength)
For i = 0 To Entry.hLength - 1
Result = Result & Format(IPcol(i), "# ")
Next
End If
End If
MsgBox "IP adresi : " & Trim(Result)
ExitSub:
Call WSACleanup
End Sub

Hiç yorum yok:

Blog Arşivi

Bu gadget'ta bir hata oluştu

Bu Blogda Ara

Contributor

Contributor
Mustafa ULUSARAÇ İstanbul, TÜRKİYE
free counters
T. C. Central Bank Indicative Exchange Rates
Currency Exchange Rate Widget,Currency Converter Widget
Borsa İstanbul