Solved

How to fill USER_INFO_2 for calling NetUserAdd

Posted on 1998-05-18
4
453 Views
Last Modified: 2013-12-03
I haven't found a programatically way to fill the user2_country_code and user2_code_page fields in the USER_INFO_2 structure.  How could I get the default settings for country code and code page of the machine where the NetUserAdd is running ?
0
Comment
Question by:edsont
  • 3
4 Comments
 
LVL 11

Accepted Solution

by:
alexo earned 50 total points
ID: 1402422
Check the setlocale() function.  Use NULL as the second argument to query instead of set the locale.
0
 
LVL 11

Expert Comment

by:alexo
ID: 1402423
Or, even better: GetLocaleInfo()


0
 

Author Comment

by:edsont
ID: 1402424
Alexo's proposed answer worked, but it wasn't as easy as I'd like to implement because the parameters needed to call the GetLocaleInfo() API wasn't given in the answer.

I used the following lines in my program:

GetLocaleInfo(LOCALE_SYSTEM_DEFAULT, LOCALE_IDEFAULT_COUNTRY, Buf, sizeof( Buf ) );
Info.usri2_country_code=atol( Buf );

GetLocaleInfo(LOCALE_SYSTEM_DEFAULT, LOCALE_IDEFAULT_CODEPAGE, Buf, sizeof( Buf ) );
Info.usri2_code_page=atol( Buf );


0
 
LVL 11

Expert Comment

by:alexo
ID: 1402425
Yep.  That's how MS implemented it :-(
0

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

Suggested Solutions

As more and more people are shifting to the latest .Net frameworks, the windows presentation framework is gaining importance by the day. Many people are now turning to WPF controls to provide a rich user experience. I have been using WPF controls fo…
With most software applications trying to cater to multiple user needs nowadays, the focus is to make them as configurable as possible. For e.g., when creating Silverlight applications which will connect to WCF services, the service end point usuall…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
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…

821 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