esotericRa
asked on
Setting new country with SetLocaleInfo
Hello, I am trying to set a new country using SetLocaleInfo() but it's not cooperating. Here's the code:
#include "windows.h"
#include "stdio.h"
int main(int argc, char* argv[])
{
BOOL sli;
LCID US = GetUserDefaultLCID();
sli = SetLocaleInfo(US, LOCALE_ICOUNTRY, "613\0");
if(sli != 0){
puts("Should have changed the localeInfo...");
}
else{
printf("There was a problem...", GetLastError());
}
return 0;
}
GetLastError() doesn't return any value so I'm not sure what the problem is -- thank you
#include "windows.h"
#include "stdio.h"
int main(int argc, char* argv[])
{
BOOL sli;
LCID US = GetUserDefaultLCID();
sli = SetLocaleInfo(US, LOCALE_ICOUNTRY, "613\0");
if(sli != 0){
puts("Should have changed the localeInfo...");
}
else{
printf("There was a problem...", GetLastError());
}
return 0;
}
GetLastError() doesn't return any value so I'm not sure what the problem is -- thank you
You forgot the format specifier in the 'printf()' statement, make that
printf("There was a problem... %d", GetLastError());
and you'll get
There was a problem... 1004
which refers to
//
// MessageId: ERROR_INVALID_FLAGS
//
// MessageText:
//
// Invalid flags.
//
#define ERROR_INVALID_FLAGS 1004L
printf("There was a problem... %d", GetLastError());
and you'll get
There was a problem... 1004
which refers to
//
// MessageId: ERROR_INVALID_FLAGS
//
// MessageText:
//
// Invalid flags.
//
#define ERROR_INVALID_FLAGS 1004L
BTW, as for the last parameter, the docs state "The information must be in the specified LCTYPE's particular format.". The values listed there do not include 'LOCALE_ICOUNTRY', see http://msdn.microsoft.com/en-us/library/ms776312(VS.85).aspx ("SetLocaleInfo")
ASKER
Ah, OK I tried it with SCURRENCY and it worked fine...
do you know of a way to change ICOUNTRY
would changing the GeoID change ICOUNTRY ?
do you know of a way to change ICOUNTRY
would changing the GeoID change ICOUNTRY ?
Sorry, not that way. This value seems to be a 'read-only' property: http://search.microsoft.com/results.aspx?q=LOCALE_ICOUNTRY
ASKER
Ah I see. Is there any possible way? If not I'll just reward you the points
Well, that value pretty much means nothing at all, so why should MS offer a way to change it. It represents jut the info that you enter when installing Windows - you can as well install a french Windows in the US and vice versa. 'SetThreadLocale()' (http://msdn.microsoft.com/en-us/library/ms776285(VS.85).aspx) changes locale specific settings for the calling thread.
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
Thanks I'll go with that
ASKER
Not sure what to do with that
any help would be great