- NSIS Discussion
- Please, test this code
Archive: Please, test this code
Joel
8th July 2003 18:27 UTC
Please, test this code
Hi you all... Please test this code in your PC...
It's suppost to retrive the user's country.. thanks...
OutFile "UserCountry.exe"
Name "Detect User Country"
Caption "Detect user Country"
XPStyle "on"
Function GetCountry
ReadRegStr $1 HKCU "Control Panel\International" "sCountry"
MessageBox MB_OK|MB_ICONINFORMATION $1
FunctionEnd
Function ".onInit"
Call "GetCountry"
Quit
FunctionEnd
Section "-boo"
;
SectionEnd
Afrow UK
8th July 2003 18:31 UTC
That works great for me - running WinXP-Pro
"United Kingdom"
-Stu :)
Joel
8th July 2003 18:33 UTC
Thanks Afrow :)
Hope to work in Win9x and WinME
Tested in Windows 2000 Pro, already :D
Afrow UK
8th July 2003 18:35 UTC
I will test on Win98.
Afrow UK
8th July 2003 18:37 UTC
Ack.
It doesn't work on Win98.
I will search the registry...
-Stu
Afrow UK
8th July 2003 18:41 UTC
HKEY_CURRENT_USER\Software\Microsoft\User Location Service\Client
That's another one I found, but the value was GB not Great Britain.
-Stu
Joel
8th July 2003 18:43 UTC
It's suppose to be the complete String...
Maybe I'll work only at NT OS machines...
I'll search more...
Afrow UK
8th July 2003 18:45 UTC
I'm sure System would work somewhere for this?
-Stu
Joel
8th July 2003 18:47 UTC
Try this:
ReadRegStr $1 HKU ".DEFAULT\Control Panel\International" "sCountry"
Afrow UK
8th July 2003 18:49 UTC
Sorry no :(
Joel
8th July 2003 18:54 UTC
Well...I'll submit but warning that only will work on
NT Systems
Afrow UK
8th July 2003 19:09 UTC
You could add a bit:
StrCmp $R0 "" 0 +2
StrCpy $R0 "Unknown Country"
-Stu
Joel
8th July 2003 19:20 UTC
I wait a little bit...
I try another way...
If not, I'll do that...
Thanks dude :)
MoNKi
8th July 2003 20:13 UTC
Lobo Lunar, try with this:
Function GetCountry
System::Call 'kernel32::GetLocaleInfoA(i 1024, i 6, t .r1, i ${NSIS_MAX_STRLEN}) i r0'
MessageBox MB_OK|MB_ICONINFORMATION "$1"
FunctionEnd
Joel
8th July 2003 23:05 UTC
Yes it Works.. :)
But I was trying without the plugin...
I'm testing...if not working, I'll submit with the plugin...
Thanks....
Joel
22nd August 2003 01:43 UTC
Trying Monki code with few adds...
Please try it...
MoNKi
22nd August 2003 11:22 UTC
Works ok for me