Skip to main content

AccessTr.neT


Kullanıcı ve Bilgisayar Adı Bulduruyoruz

Kullanıcı ve Bilgisayar Adı Bulduruyoruz

#1
formumuza iki adres textbox koyuyoruz kodu yapıştırıyoruz. bu kadar

Kod:
Option Explicit
Private S1 As String
Private Declare Function GetUser Lib "mpr.dll" Alias "WNetGetUserA" (ByVal lpName As String, ByVal lpUserName As String, lpnLength As Long) As Long
Private Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Private Declare Function GetComputerName Lib "kernel32" Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Public Function FindUserName() As String
S1 = Space(512)
GetUserName S1, Len(S1)
FindUserName = Trim$(S1)
End Function
Public Function FindNetUserName() As String
S1 = Space(512)
GetUser vbNullString, S1, Len(S1)
FindNetUserName = Trim$(S1)
End Function
Public Function FindComputerName() As String
S1 = Space(512)
GetComputerName S1, Len(S1)
FindComputerName = Trim$(S1)
End Function
Private Sub Form_Load()
Dim ComputerName, ComputerUser
ComputerUser = FindNetUserName
Text1.Text = ComputerUser
Text2.Text = FindComputerName
End Sub

™Hiç Birimiz, Hepimiz Kadar Akıllı Olamayız...®

Cevapla

Bir hesap oluşturun veya yorum yapmak için giriş yapın

Yorum yapmak için üye olmanız gerekiyor

ya da

Bu Konudaki Yorumlar
Kullanıcı ve Bilgisayar Adı Bulduruyoruz - Yazar: chopper07 - 28/11/2008, 23:17