Solved

Get my user id using MFC in NT / ethernet

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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Have you ever set up your wireless router at home or in the office to find that you little pop-up bubble in the bottom right-hand corner of Windows read "IP Conflict - One of more computers on the network have been assigned the following IP address"…
Resolve DNS query failed errors for Exchange
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

746 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now