Solved

How to fill USER_INFO_2 for calling NetUserAdd

Posted on 1998-05-18
4
461 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
[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
  • 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

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

This article shows a few slightly more advanced techniques for Windows 7 gadget programming, including how to save and restore user settings for your gadget and how to populate the "details" panel that is displayed in the Windows 7 gadget gallery.  …
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…
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 video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…

617 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