Solved

Get my user id using MFC in NT / ethernet

Posted on 1998-03-26
5
326 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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

This is the first one of a series of articles I’ll be writing to address technical issues that are always referred to as network problems. The network boundaries have changed, therefore having an understanding of how each piece in the network  puzzl…
Trying to figure out group policy inheritance and which settings apply where can be a chore.  Here's a very simple summary I've written which might help.  Keep in mind, this is just a high-level conceptual overview where I try to avoid getting bogge…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

773 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