How to get the identification information.

I am writing a program to run on a small network. The network is built on win 95 and 98 what i want to do is get the logged on user information and the identification of the computer. Where is this held
kplonkAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
deightonConnect With a Mentor Commented:
bas module


Private Declare Function SetComputerName Lib "kernel32" Alias "SetComputerNameA" (ByVal lpComputerName As String) As Long


Private Declare Function GetComputerName Lib "kernel32" Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize 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 ShowWindow Lib "user32" (ByVal hWnd As Long, ByVal nCmdShow As Long) As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function EnableWindow Lib "user32" (ByVal hWnd As Long, ByVal fEnable As Long) As Long

Public Const SW_HIDE = 0
Public Const SW_SHOW = 5

Type OSVERSIONINFO
    dwOSVersionInfoSize As Long
    dwMajorVersion As Long
    dwMinorVersion As Long
    dwBuildNumber As Long
    dwPlatformId As Long
    szCSDVersion As String * 128
End Type

Private Declare Function GetVersionEx Lib "kernel32" Alias "GetVersionExA" (ByRef lpVersionInformation As OSVERSIONINFO) As Long

Public Function VersioneWindows() As String
    Dim myOS As OSVERSIONINFO

    myOS.dwOSVersionInfoSize = Len(myOS)
    GetVersionEx myOS
    If myOS.dwMajorVersion = 4 Then
        If myOS.dwPlatformId = VER_PLATFORM_WIN32_NT Then
            VersioneWindows = "Windows NT version: "
        ElseIf myOS.dwPlatformId = VER_PLATFORM_WIN32_WINDOWS Then
            VersioneWindows = "Windows 95 version: "
        End If
    Else
        VersioneWindows = "Windows version: "
    End If
    VersioneWindows = VersioneWindows & myOS.dwMajorVersion & "." & myOS.dwMinorVersion
End Function
Public Sub ApplicationBar(Visible As Boolean)
    Dim hWnd As Long

    hWnd = FindWindow("Shell_TrayWnd", "")
    If Visible Then
        ShowWindow hWnd, SW_SHOW
    Else
        ShowWindow hWnd, SW_HIDE
    End If
    EnableWindow hWnd, Visible
End Sub

Public Sub Desktop(Visible As Boolean)
    Dim hWnd As Long

    hWnd = FindWindow("Progman", "Program Manager")
    If Visible Then
        ShowWindow hWnd, SW_SHOW
    Else
        ShowWindow hWnd, SW_HIDE
    End If
    EnableWindow hWnd, Visible
End Sub
Public Function UserName() As String
    Dim cn As String
    Dim ls As Long
    Dim res As Long

    cn = String(1024, 0)
    ls = 1024
    res = GetUserName(cn, ls)
    If res <> 0 Then
        UserName = Mid(cn, 1, InStr(cn, Chr(0)) - 1)
    Else
        UserName = ""
    End If
End Function


Public Function fSetComputerName(Name As String) As Boolean
    Dim res As Long

    res = SetComputerName(Name)
    SetComputerName = (res <> 0)
End Function
Public Function ComputerName() As String
    Dim cn As String
    Dim ls As Long
    Dim res As Long

    cn = String(1024, 0)
    ls = 1024
    res = GetComputerName(cn, ls)
    If res <> 0 Then
        ComputerName = Mid(cn, 1, InStr(cn, Chr(0)) - 1)
    Else
        ComputerName = ""
    End If
End Function
0
 
kplonkAuthor Commented:
thanks for the help
0
All Courses

From novice to tech pro — start learning today.