Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: NT
Expertise: Beginner
Jan 11, 1999

Net Functions

Question:
I want to programatically add a user to the Administrators group. The API NetLocalGroupAddMembers() works when adding my user to English Windows NT, but will not add the user to Spanish Windows NT because the Administrators group name is in Spanish--the API takes the group name as parameter. How can I generically add my user to the Administrators group without necessitating producing localised versions of my application?

Answer:
You can use the API call GetUserDefaultLCID to get the user-default location identifier. For example, 0409 is the LCID for US/English, 080a is Spanish (Mexico), etc. (look up "LCID Reference" in MSDN, searching titles only). You can then make a resource file with the name of the administrator group for each language that you want to support. After looking up the LCID for the current user, you can then use that as a pointer to get the correct characters from the resource file for "Administrator" in that language. If you have a number of language-specific words you need to use for the API calls, then you might want to create offsets of each supported language to form ranges of values in the resource file. So, for example, the characters that spell "Administrator" might be at the lookup value + 0, the value for "User" might be at lookup value + 1, etc.

DevX Pro
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date