Solved

How to fill USER_INFO_2 for calling NetUserAdd

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
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…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

757 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

21 Experts available now in Live!

Get 1:1 Help Now