Solved

How to fill USER_INFO_2 for calling NetUserAdd

Posted on 1998-05-18
4
451 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

This article shows how to make a Windows 7 gadget that extends its U/I with a flyout panel -- a window that pops out next to the gadget.  The example gadget shows several additional techniques:  How to automatically resize a gadget or flyout panel t…
What my article will show is if you ever had to do processing to a listbox without being able to just select all the items in it. My software Visual Studio 2008 crystal report v11 My issue was I wanted to add crystal report to a form and show…
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…
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…

813 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

10 Experts available now in Live!

Get 1:1 Help Now