?
Solved

Get my user id using MFC in NT / ethernet

Posted on 1998-03-26
5
Medium Priority
?
374 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

A brief overview to explain gateways, default gateways and static routes OR NO - you CANNOT have two default gateways on the same server, PC or other Windows-based network device. In simple terms a gateway is formed when a computer such as a serv…
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 …
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…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…

649 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