Results 1 to 2 of 2

Thread: This is a bit of a strange problem. One that I need you guys to help me out with.

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Oct 2000
    Posts
    68

    Unhappy

    Dear All,

    I have a program that I have written in VB6 under the Win 2000 operating system.

    However when I try and run the program in Win NT 4 SP5 or Win '95 the program has a Run Time error.

    Win '95
    Runtime error '432'
    File name or class name not found during Automation operation.

    Win NT
    Runtime error
    Automation error
    Invalid Syntax

    Both these errors occur at the same time in the startup procedure of the program although I don't have VB on the machines with the other operating systems I belive the errors occure when the program gets information about the users login (the current login from the pc)

    This is part of the code:
    (I have not included all of the code so there are no End Sub etc... statements)

    This code comes from another source adapted for my purpose.

    Public Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long

    lblloginname.Caption = getusr()

    Dim User As IADsUser
    Dim Group As IADsGroup
    'Assigning the current user to a label on the screen.


    'Accept the Domain name
    strDomain = "Segensworth"

    'Use the WinNT Directory Services
    strDomain = "WinNT://" & strDomain

    'Create the Domain object
    Set TheDomain = GetObject(strDomain)
    Set theuser = TheDomain.GetObject("user", getusr())

    'Displays the Users Full Name
    TheDomain.Filter = Array("User")
    frmview.lblname.Caption = theuser.FullName


    ' Function to get the current user login name
    Function getusr()
    Dim usr As String
    usr = Space(256)
    aa = GetUserName(usr, 256)
    getusr = Left(RTrim(usr), Len(RTrim(usr)) - 1)
    End Function

    Firstly could anyone please see why this doesn't work in '95 / NT and secondary let me know if it is possible to fix it.

    Thanks

    Simon


  2. #2
    Fanatic Member
    Join Date
    Oct 2000
    Location
    London
    Posts
    1,008
    Simon,

    It might be nothing but I have always used Space(255) which I believed was the maximum allowed - maybe W2K allows more so 256 doesn't cause a problem? Worth a try. Otherwise is advapi32.dll available on those other machines?

    Cheers,

    P.
    Not nearly so tired now...

    Haven't been around much so be gentle...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width