Solved

Get my user id using MFC in NT / ethernet

Posted on 1998-03-26
5
346 Views
Last Modified: 2013-12-23
1. How can I get the user login name in the current NT machine (in ethernet)?
2. How can I get the complete user list avaiable in my ethernet?

Is there some way to do these using MFC?
0
Comment
Question by:tko092397
  • 2
  • 2
5 Comments
 
LVL 5

Expert Comment

by:tcalesa
ID: 1571520
I'm not sure if this is what you're looking for.

   net user will give you the accounts list of users
   the /domain switch will parse the domain account list

Did that help?
0
 

Author Comment

by:tko092397
ID: 1571521
Well, I will explain:

On my NT machine, when I will start my program, then my user id will be fetched from my NT machine, i.e., tomas_pd
When my program is running on another NT machine, then the another user id will be fetched from that NT machine, i.e., david_pd.

I need this functionality to say: 'Welcome tomas_pd' or 'Welcome david_pd' or 'Welcome ..?..' when my program is started on any NT.

So, I need some MFC-like ansver.
0
 
LVL 5

Expert Comment

by:tcalesa
ID: 1571522
Sorry for the delay
What are you coding in?

0
 

Author Comment

by:tko092397
ID: 1571523
I am coding in C++, and using Microsoft Visual Studio 5.0 as a development tool.
0
 

Accepted Solution

by:
woodsmj earned 20 total points
ID: 1571524
Use the Win API functions GetUserName to get the user name of the person currently logged in:

BOOL GetUserName(

    LPTSTR  lpBuffer,      // address of name buffer
    LPDWORD  nSize       // address of size of name buffer
   );

to get a list of all the users in a domain use NetUserEnum :

NET_API_STATUS
NetUserEnum (

    LPWSTR servername,      
    DWORD level,      
    DWORD filter,      
    LPBYTE * bufptr,      
    DWORD prefmaxlen,      
    LPDWORD entriesread,      
    LPDWORD totalentries,      
    LPDWORD resumehandle       
   );
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is in response to a question (http://www.experts-exchange.com/Networking/Network_Management/Network_Analysis/Q_28230497.html) here at Experts Exchange. The Original Poster (OP) requires a utility that will accept a list of IP addresses …
Resolve DNS query failed errors for Exchange
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question