Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Get my user id using MFC in NT / ethernet

Posted on 1998-03-26
5
Medium Priority
?
379 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 60 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…

864 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