Solved

How to fill USER_INFO_2 for calling NetUserAdd

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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

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 accepts files dropped from the Windows Explorer.  It also illustrates how to give your gadget a non-rectangular shape and how to add some nifty visual effects to text displayed in a your gadget.…
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…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

710 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