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?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

deightonprogCommented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
kplonkAuthor Commented:
thanks for the help
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.