dcsimg


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Page 1 of 3 123 LastLast
Results 1 to 15 of 41

Thread: Howto Get Windows NT Domain\Username

  1. #1
    Hal Guest

    Howto Get Windows NT Domain\Username


    Hi!
    How can I get the NT Domain name for a windows client? The user-name I get
    via GetUserName in Lib advapi32.dll.
    Does anybody nows?
    Thanks
    /Hal


  2. #2
    Sachin Guest

    Re: Howto Get Windows NT Domain\Username

    easiest way:-
    Environ$("USERDOMAIN")
    -Sachin
    "Hal" <Halu@home.se> wrote in message news:3b8abf02@news.devx.com...
    >
    > Hi!
    > How can I get the NT Domain name for a windows client? The user-name I get
    > via GetUserName in Lib advapi32.dll.
    > Does anybody nows?
    > Thanks
    > /Hal
    >




  3. #3
    Sachin Guest

    Re: Howto Get Windows NT Domain\Username

    easiest way:-
    Environ$("USERDOMAIN")
    -Sachin
    "Hal" <Halu@home.se> wrote in message news:3b8abf02@news.devx.com...
    >
    > Hi!
    > How can I get the NT Domain name for a windows client? The user-name I get
    > via GetUserName in Lib advapi32.dll.
    > Does anybody nows?
    > Thanks
    > /Hal
    >




  4. #4
    Klaus H. Probst Guest

    Re: Howto Get Windows NT Domain\Username

    Check out http://www.netfokus.dk/vbadmincode/


    --
    .. . . . . . . . . . . . . . . . . . . . . .
    Klaus H. Probst, MVP
    http://www.vbbox.com/


    Please post/reply to the newsgroup(s)


    "Hal" <Halu@home.se> wrote in message news:3b8abf02@news.devx.com...
    >
    > Hi!
    > How can I get the NT Domain name for a windows client? The user-name I get
    > via GetUserName in Lib advapi32.dll.
    > Does anybody nows?
    > Thanks
    > /Hal
    >




  5. #5
    Klaus H. Probst Guest

    Re: Howto Get Windows NT Domain\Username

    Check out http://www.netfokus.dk/vbadmincode/


    --
    .. . . . . . . . . . . . . . . . . . . . . .
    Klaus H. Probst, MVP
    http://www.vbbox.com/


    Please post/reply to the newsgroup(s)


    "Hal" <Halu@home.se> wrote in message news:3b8abf02@news.devx.com...
    >
    > Hi!
    > How can I get the NT Domain name for a windows client? The user-name I get
    > via GetUserName in Lib advapi32.dll.
    > Does anybody nows?
    > Thanks
    > /Hal
    >




  6. #6
    L.J. Johnson Guest

    Re: Howto Get Windows NT Domain\Username

    Klaus,

    Aren't those solutions NT only? Hal didn't specify, but the API he's using
    is Win95+ compatible, so I assumed Win9x.

    All the stuff I know of is NT+ only. I did find an article, "HOWTO: Retrieve
    Current User and Domain Names on Windows 95 and Windows 98", which indicated
    using 16-bit code to retrieve this info (Q155698).

    Although I almost never use Win9x, I'd be curious about a solution that
    works in these OSs. I didn't see anything interesting in the 19 Net...
    functions available on Win9x, and I'm not certain about the WNet...
    functions.

    --
    L.J. Johnson, Slightly Tilted Software
    Microsoft MVP (Visual Basic)
    LJJohnson@SlightlyTiltedSoftware.com or LJJohnson@mvps.org
    <http://www.SlightlyTiltedSoftware.com>
    Ask The NT Pro at <http://www.devx.com/gethelp>




  7. #7
    L.J. Johnson Guest

    Re: Howto Get Windows NT Domain\Username

    Klaus,

    Aren't those solutions NT only? Hal didn't specify, but the API he's using
    is Win95+ compatible, so I assumed Win9x.

    All the stuff I know of is NT+ only. I did find an article, "HOWTO: Retrieve
    Current User and Domain Names on Windows 95 and Windows 98", which indicated
    using 16-bit code to retrieve this info (Q155698).

    Although I almost never use Win9x, I'd be curious about a solution that
    works in these OSs. I didn't see anything interesting in the 19 Net...
    functions available on Win9x, and I'm not certain about the WNet...
    functions.

    --
    L.J. Johnson, Slightly Tilted Software
    Microsoft MVP (Visual Basic)
    LJJohnson@SlightlyTiltedSoftware.com or LJJohnson@mvps.org
    <http://www.SlightlyTiltedSoftware.com>
    Ask The NT Pro at <http://www.devx.com/gethelp>




  8. #8
    Monte Hansen Guest

    Re: Howto Get Windows NT Domain\Username


    Gents, you could use the NetWkstaUserGetInfo function but it only works for
    NT, and even if it worked for Win9X, it would have a different calling interface
    :/

    Look at the NetResources class/sample on my site. That code works for all
    Windoz platforms.

    +|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+
    Monte Hansen
    http://KillerVB.com
    +|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+


    "Hal" <Halu@home.se> wrote:
    >
    >Hi!
    >How can I get the NT Domain name for a windows client? The user-name I get
    >via GetUserName in Lib advapi32.dll.
    >Does anybody nows?
    >Thanks
    >/Hal
    >



  9. #9
    Monte Hansen Guest

    Re: Howto Get Windows NT Domain\Username


    Gents, you could use the NetWkstaUserGetInfo function but it only works for
    NT, and even if it worked for Win9X, it would have a different calling interface
    :/

    Look at the NetResources class/sample on my site. That code works for all
    Windoz platforms.

    +|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+
    Monte Hansen
    http://KillerVB.com
    +|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+


    "Hal" <Halu@home.se> wrote:
    >
    >Hi!
    >How can I get the NT Domain name for a windows client? The user-name I get
    >via GetUserName in Lib advapi32.dll.
    >Does anybody nows?
    >Thanks
    >/Hal
    >



  10. #10
    Monte Hansen Guest

    Re: Howto Get Windows NT Domain\Username


    I don't believe the "USERDOMAIN" environment variable will work in non-NT
    platforms (although I wish it did).

    +|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+
    Monte Hansen
    http://KillerVB.com
    +|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+


    "Sachin" <sachin.nigam@orbit-e.com> wrote:
    >easiest way:-
    >Environ$("USERDOMAIN")
    >-Sachin
    >"Hal" <Halu@home.se> wrote in message news:3b8abf02@news.devx.com...
    >>
    >> Hi!
    >> How can I get the NT Domain name for a windows client? The user-name I

    get
    >> via GetUserName in Lib advapi32.dll.
    >> Does anybody nows?
    >> Thanks
    >> /Hal
    >>

    >
    >



  11. #11
    Monte Hansen Guest

    Re: Howto Get Windows NT Domain\Username


    I don't believe the "USERDOMAIN" environment variable will work in non-NT
    platforms (although I wish it did).

    +|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+
    Monte Hansen
    http://KillerVB.com
    +|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+


    "Sachin" <sachin.nigam@orbit-e.com> wrote:
    >easiest way:-
    >Environ$("USERDOMAIN")
    >-Sachin
    >"Hal" <Halu@home.se> wrote in message news:3b8abf02@news.devx.com...
    >>
    >> Hi!
    >> How can I get the NT Domain name for a windows client? The user-name I

    get
    >> via GetUserName in Lib advapi32.dll.
    >> Does anybody nows?
    >> Thanks
    >> /Hal
    >>

    >
    >



  12. #12
    L.J. Johnson Guest

    Re: Howto Get Windows NT Domain\Username

    Monte,

    > Look at the NetResources class/sample on my site. That code works for all
    > Windoz platforms.


    Cool, didn't see that one.

    > I don't believe the "USERDOMAIN" environment variable will work in non-NT
    > platforms (although I wish it did).


    Plus, depending upon environmental vars is kinda sucky -- users can change
    'em, fairly easily

    --
    L.J. Johnson, Slightly Tilted Software
    Microsoft MVP (Visual Basic)
    LJJohnson@SlightlyTiltedSoftware.com or LJJohnson@mvps.org
    <http://www.SlightlyTiltedSoftware.com>
    Ask The NT Pro at <http://www.devx.com/gethelp>




  13. #13
    L.J. Johnson Guest

    Re: Howto Get Windows NT Domain\Username

    Monte,

    > Look at the NetResources class/sample on my site. That code works for all
    > Windoz platforms.


    Cool, didn't see that one.

    > I don't believe the "USERDOMAIN" environment variable will work in non-NT
    > platforms (although I wish it did).


    Plus, depending upon environmental vars is kinda sucky -- users can change
    'em, fairly easily

    --
    L.J. Johnson, Slightly Tilted Software
    Microsoft MVP (Visual Basic)
    LJJohnson@SlightlyTiltedSoftware.com or LJJohnson@mvps.org
    <http://www.SlightlyTiltedSoftware.com>
    Ask The NT Pro at <http://www.devx.com/gethelp>




  14. #14
    Monte Hansen Guest

    Re: Howto Get Windows NT Domain\Username

    Sachin, I would suggest first that you use the LoadLibraryEx function with
    the DONT_RESOLVE_DLL_REFERENCES flag, for resource loading.

    Next I would question if the function can even find the file; perhaps try an
    absolute path first, then worry about the relative path spec once you get it
    working.

    Hope this helps.

    ++++++++++++++++++++
    Monte Hansen
    http://KillerVB.com
    ++++++++++++++++++++

    "Monte Hansen" <monte@nospam.com> wrote in message
    news:3b8c22dc$1@news.devx.com...
    >
    > I don't believe the "USERDOMAIN" environment variable will work in non-NT
    > platforms (although I wish it did).
    >
    > +|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+
    > Monte Hansen
    > http://KillerVB.com
    > +|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+
    >
    >
    > "Sachin" <sachin.nigam@orbit-e.com> wrote:
    > >easiest way:-
    > >Environ$("USERDOMAIN")
    > >-Sachin
    > >"Hal" <Halu@home.se> wrote in message news:3b8abf02@news.devx.com...
    > >>
    > >> Hi!
    > >> How can I get the NT Domain name for a windows client? The user-name I

    > get
    > >> via GetUserName in Lib advapi32.dll.
    > >> Does anybody nows?
    > >> Thanks
    > >> /Hal
    > >>

    > >
    > >

    >




  15. #15
    Monte Hansen Guest

    Re: Howto Get Windows NT Domain\Username

    Sachin, I would suggest first that you use the LoadLibraryEx function with
    the DONT_RESOLVE_DLL_REFERENCES flag, for resource loading.

    Next I would question if the function can even find the file; perhaps try an
    absolute path first, then worry about the relative path spec once you get it
    working.

    Hope this helps.

    ++++++++++++++++++++
    Monte Hansen
    http://KillerVB.com
    ++++++++++++++++++++

    "Monte Hansen" <monte@nospam.com> wrote in message
    news:3b8c22dc$1@news.devx.com...
    >
    > I don't believe the "USERDOMAIN" environment variable will work in non-NT
    > platforms (although I wish it did).
    >
    > +|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+
    > Monte Hansen
    > http://KillerVB.com
    > +|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+
    >
    >
    > "Sachin" <sachin.nigam@orbit-e.com> wrote:
    > >easiest way:-
    > >Environ$("USERDOMAIN")
    > >-Sachin
    > >"Hal" <Halu@home.se> wrote in message news:3b8abf02@news.devx.com...
    > >>
    > >> Hi!
    > >> How can I get the NT Domain name for a windows client? The user-name I

    > get
    > >> via GetUserName in Lib advapi32.dll.
    > >> Does anybody nows?
    > >> Thanks
    > >> /Hal
    > >>

    > >
    > >

    >




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center