Results 1 to 4 of 4

Thread: NetValidateName ???

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2002
    Location
    Germany
    Posts
    2

    Question NetValidateName ???

    Hallo,

    what is wrong on this code ?
    Error 1781(enumerations is out of range).

    I found this at the MS-page:
    http://msdn.microsoft.com/library/de...mapi2_589x.asp


    Private Enum NETSETUP_NAME_TYPE
    NetSetupUnknown = 0
    NetSetupMachine
    NetSetupWorkgroup
    NetSetupDomain
    NetSetupNonExistentDomain
    NetSetupDnsMachine
    End Enum

    Private Declare Function Validate Lib "NETAPI32.DLL" Alias "NetValidateName" _
    (ByVal ServerName As String, ByVal Domaene As String, ByVal _
    Account As String, Password As String, NameType As NETSETUP_NAME_TYPE) As Long


    'Aufruf:
    Result = Validate(StrConv("\\PDC", vbUnicode), StrConv("Domäne", vbUnicode), StrConv("User", vbUnicode), StrConv("Passwort", vbUnicode), NETSETUP_NAME_TYPE.NetSetupDomain)

    Who can help ??

    Wolfgang

  2. #2
    old fart Frans C's Avatar
    Join Date
    Oct 1999
    Location
    the Netherlands
    Posts
    2,926
    Not tested, but try this:

    Private Enum NETSETUP_NAME_TYPE
    NetSetupUnknown = 0
    NetSetupMachine
    NetSetupWorkgroup
    NetSetupDomain
    NetSetupNonExistentDomain
    NetSetupDnsMachine
    End Enum

    Private Declare Function Validate Lib "NETAPI32.DLL" Alias "NetValidateName" _
    (ByVal ServerName As String, ByVal Domaene As String, ByVal _
    Account As String, Password As String, NameType As Long) As Long


    'Aufruf:
    Result = Validate(StrConv("\\PDC", vbUnicode), StrConv("Domäne", vbUnicode), StrConv("User", vbUnicode), StrConv("Passwort", vbUnicode), NetSetupDomain)

  3. #3

    Thread Starter
    New Member
    Join Date
    Feb 2002
    Location
    Germany
    Posts
    2

    no, id doesn't work - i'f testet it bevore

    No, this is not the solution.

    Wolfgang

  4. #4
    old fart Frans C's Avatar
    Join Date
    Oct 1999
    Location
    the Netherlands
    Posts
    2,926
    I just noticed the mistake.

    You have to pass both password as NameType ByVal. It doesn't matter if you define the NameType as long or as NETSETUP_NAME_TYPE.

    Private Declare Function Validate Lib "NETAPI32.DLL" Alias "NetValidateName" _
    (ByVal ServerName As String, ByVal Domaene As String, ByVal _
    Account As String, ByVal Password As String, ByVal NameType As NETSETUP_NAME_TYPE) As Long

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