IRCForumları - IRC ve mIRC Kullanıcılarının Buluşma Noktası
  sohbet

 Kayıt ol  Topluluk
Yeni Konu aç Cevapla
 
LinkBack Seçenekler Stil
Alt 19 Temmuz 2008, 16:53   #1
Çevrimiçi
Yardımcı Admin
Kullanıcıların profil bilgileri misafirlere kapatılmıştır.
IF Ticaret Sayısı: (0)
IF Ticaret Yüzdesi:(%)
Ağdaki Bilgisayarlar




alIntıdır

PHP Kod:   Kodu kopyalamak için üzerine çift tıklayın!
'// Form kodları
Forma bir adet ListBox ekleyin (List1)
Private 
Sub Form_Load()
Call GetComputers(Me.List1)
End Sub

'// Bu kısımdaki kodları bir modül içine yapıştırın
Option Explicit
 
Private Type SERVER_INFO_100
sv100_platform_id      As Long
sv100_name               As Long
End Type
 
Private Declare Function NetServerEnum Lib "netapi32" (ByVal servername As Long _
     , ByVal level As Long, buf As Any, ByVal prefmaxlen As Long _
     , entriesread As Long, totalentries As Long, ByVal servertype As Long _
     , ByVal domain As Long, resume_handle As Long) As Long
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (pTo As Any _
     , uFrom As Any, ByVal lSize As Long)
Private Declare Function NetApiBufferFree Lib "netapi32" (ByVal Buffer As Long) As Long
Private Declare Function lstrlenW Lib "kernel32" (ByVal lpString As Long) As Long
 
Private Const MAX_PREFERRED_LENGTH As Long = -1
Private Const SV_TYPE_WORKSTATION As Long = &H1
Private Const NERR_SUCCESS           As Long = 0&
Private Const ERROR_MORE_DATA      As Long = 234&
'
 
Public Sub GetComputers(lst As ListBox)
'===============================================================================
Dim lngBufPtr           As Long
Dim dwEntriesRead      As Long
Dim dwTotalEntries      As Long
Dim dwResumeHandle      As Long
Dim se100                As SERVER_INFO_100
Dim lngSuccess           As Long
Dim nStructSize           As Long
Dim lngCounter           As Long
Dim strComputer           As String
Dim blnNoComputers      As Boolean
 
nStructSize = LenB(se100)
 
'
-- Call passing MAX_PREFERRED_LENGTH to have the API allocate required memory for the
' return values.
 
'
-- The call is enumerating all machines on the network (SV_TYPE_ALL); howeverby
' Or'ing specific bit masks for defined types you can customize the returned data.
' For example, a value of 0x00000003 combines the bit masks for
SV_TYPE_WORKSTATION (0x00000001) and SV_TYPE_SERVER (0x00000002).
 
'-- dwServerName must be Null. The level parameter (100 here) specifies the data
structure being used (in this case a SERVER_INFO_100 structure).
 
'-- The domain member is passed as Null, indicating machines on the primary
domain are to be retrieved. If you decide to use this memberpass
' StrPtr("domain name"), not the string itself.
 
lngSuccess = NetServerEnum(0&, 100, lngBufPtr, MAX_PREFERRED_LENGTH, dwEntriesRead _
      , dwTotalEntries, SV_TYPE_WORKSTATION, 0&, dwResumeHandle)
 
'
-- If all goes well
If lngSuccess NERR_SUCCESS And lngSuccess <> ERROR_MORE_DATA Then
     lst
.Clear
 
     
'-- Loop through the returned data, adding each machine to the list
     For lngCounter = 0 To dwEntriesRead - 1
      '
-- Get one chunk of data and cast into an SERVER_INFO_100 struct
      
' in order to add the name to a list
      CopyMemory se100, ByVal lngBufPtr + (nStructSize * lngCounter), nStructSize
 
      strComputer = GetPointerToByteStringW(se100.sv100_name)
 
      lst.AddItem strComputer
     Next
 
     blnNoComputers = (lst.ListCount = 0)
End If
 
'
-- Clean up regardless of lngSuccess
Call NetApiBufferFree
(lngBufPtr)
End Sub
 
Private Function GetPointerToByteStringW(ByVal dwData As Long) As String
'===============================================================================
Dim bytTemp()           As Byte
Dim lngTempLen           As Long
 
If dwData <> 0 Then
     lngTempLen = lstrlenW(dwData) * 2
     If lngTempLen <> 0 Then
      ReDim bytTemp(0 To (lngTempLen - 1)) As Byte
      CopyMemory bytTemp(0), ByVal dwData, lngTempLen
      GetPointerToByteStringW = bytTemp
     End If
End If
 
Erase bytTemp()
End Function 


__________________
[Üye Olmadan Linkleri Göremezsiniz. Üye Olmak için TIKLAYIN...]

[Üye Olmadan Linkleri Göremezsiniz. Üye Olmak için TIKLAYIN...]
 
Alıntı ile Cevapla

IRCForumlari.NET Reklamlar
sohbet odaları reklam ver Benimmekan Mobil Sohbet
Cevapla

Etiketler
ağdaki, bilgisayarlar


Konuyu Toplam 1 Üye okuyor. (0 Kayıtlı üye ve 1 Misafir)
 

Yetkileriniz
Konu Acma Yetkiniz Yok
Cevap Yazma Yetkiniz Yok
Eklenti Yükleme Yetkiniz Yok
Mesajınızı Değiştirme Yetkiniz Yok

BB code is Açık
Smileler Açık
[IMG] Kodları Açık
HTML-Kodu Kapalı
Trackbacks are Kapalı
Pingbacks are Açık
Refbacks are Açık


Benzer Konular
Konu Konuyu Başlatan Forum Cevaplar Son Mesaj
Ağdaki hataların anında tespit edilmesi AngeL Ağ, Network ve Networking 0 18 Şubat 2007 20:06