Hi, this is going to be a long shot but I really need some help on an assignment I have to do. Basically Ive been given a program to look at and I need to write about it by realting to several topics.
They are - Translators & linkers, system call, & background operation. The program itself is simply to retrieve the PC's user name and computer name (the stuff youd see in system properties). Thing is I have no idea how to relate it to the above topics so I'd be eternally greatful if someone could give me some help
There are two forms, one for the computer name and one for the username, and thier code is as follows -
Computer name
code:--------------------------------------------------------------------------------
Private Declare Function getcomputername Lib "kernel32" Alias "GetComputerNameA" (ByVal sBuffer As String, lSize As Long) As Long
Private Sub Command1_Click()
Dim PCName As String
Dim P As Long
P = NameOfPC(PCName)
Text1.Text = PCName
End Sub
Public Function NameOfPC(MachineName As String) As Long
Dim NameSize As Long
Dim X As Long
MachineName = Space$(16)
NameSize = Len(MachineName)
X = getcomputername(MachineName, NameSize)
End Function
Private Sub Command2_Click()
UserName.Show
Unload Me
End Sub
--------------------------------------------------------------------------------
User name
code:--------------------------------------------------------------------------------
Private Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" _
(ByVal lpBuffer As String, nSize As Long) As Long
Private Declare Function GetCurrentThreadId Lib "kernel32" () As Long
Private Declare Function GetCurrentProcessId Lib "kernel32" () As Long
Public Property Get UserName() As Variant
Dim sBuffer As String
Dim lSize As Long
sBuffer = Space$(255)
lSize = Len(sBuffer)
Call GetUserName(sBuffer, lSize)
UserName = Left$(sBuffer, lSize)
End Property
Public Property Get ThreadID() As Variant
ThreadID = GetCurrentThreadId
End Property
Public Property Get ProcessID() As Variant
ProcessID = GetCurrentProcessId
End Property
Private Sub Command1_Click()
Text1.Text = UserName
End Sub
Private Sub Command2_Click()
Computername.Show
Unload Me
End Sub
Private Sub Text1_Change()
Text1.Text = UCase(Text1.Text)
End Sub
--------------------------------------------------------------------------------
Also the program can be downloaded here
Thanks in advance
They are - Translators & linkers, system call, & background operation. The program itself is simply to retrieve the PC's user name and computer name (the stuff youd see in system properties). Thing is I have no idea how to relate it to the above topics so I'd be eternally greatful if someone could give me some help
There are two forms, one for the computer name and one for the username, and thier code is as follows -
Computer name
code:--------------------------------------------------------------------------------
Private Declare Function getcomputername Lib "kernel32" Alias "GetComputerNameA" (ByVal sBuffer As String, lSize As Long) As Long
Private Sub Command1_Click()
Dim PCName As String
Dim P As Long
P = NameOfPC(PCName)
Text1.Text = PCName
End Sub
Public Function NameOfPC(MachineName As String) As Long
Dim NameSize As Long
Dim X As Long
MachineName = Space$(16)
NameSize = Len(MachineName)
X = getcomputername(MachineName, NameSize)
End Function
Private Sub Command2_Click()
UserName.Show
Unload Me
End Sub
--------------------------------------------------------------------------------
User name
code:--------------------------------------------------------------------------------
Private Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" _
(ByVal lpBuffer As String, nSize As Long) As Long
Private Declare Function GetCurrentThreadId Lib "kernel32" () As Long
Private Declare Function GetCurrentProcessId Lib "kernel32" () As Long
Public Property Get UserName() As Variant
Dim sBuffer As String
Dim lSize As Long
sBuffer = Space$(255)
lSize = Len(sBuffer)
Call GetUserName(sBuffer, lSize)
UserName = Left$(sBuffer, lSize)
End Property
Public Property Get ThreadID() As Variant
ThreadID = GetCurrentThreadId
End Property
Public Property Get ProcessID() As Variant
ProcessID = GetCurrentProcessId
End Property
Private Sub Command1_Click()
Text1.Text = UserName
End Sub
Private Sub Command2_Click()
Computername.Show
Unload Me
End Sub
Private Sub Text1_Change()
Text1.Text = UCase(Text1.Text)
End Sub
--------------------------------------------------------------------------------
Also the program can be downloaded here
Thanks in advance