Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Sat Jan 20, 2018 5:33 pm
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: Find location
PostPosted: Thu Apr 19, 2012 7:03 pm 
Offline

Joined: Mon Apr 07, 2008 10:47 am
Posts: 45
Is there a way in RB to find the location setting, not just the language? For example I would like my prompt for Canadian users to say Province and Postal Code where the US users should get State and Zip. Any help would be appreciated. :?


Top
 Profile  
Reply with quote  
 Post subject: Re: Find location
PostPosted: Fri Apr 20, 2012 2:13 pm 
Offline
User avatar

Joined: Sun Aug 12, 2007 10:10 am
Posts: 1086
Location: Boiling Springs, SC
It's stored in msinfo32....type this ("msinfo32") into your run box to see a list of all setting strings which can be obtained. The actual string is stored in the registry and will require the use of API to obtian. If you need help, I can make an example for you later today.

Best Regards
Matthew A. Combatti

PS - The locale for US will read "United States"...for CA..."Canada" :-)

Use the following API for locale

Declare Function GetLocaleInfo Lib "kernel32" Alias "GetLocaleInfoA" (ByVal Locale As Long, ByVal LCType As Long, ByVal lpLCData As String, ByVal cchData As Long) As Long

_________________
Matthew A. Combatti
Real Studio 2012 r1.2

Visit Xojo Developer's Spot!
Systems I Use:
Windows XP/Windows Vista/Windows Server 2008 r2/Windows 7/Windows 8
Mac OSX 10.5/Mac OSX 10.6/Mac OSX Server/Ubuntu/Debian/Suse/Red Hat/
Windows Server 2011/CentOS 5.4 /ReactOS/SimOS

~All Xojo Compatible~


Top
 Profile  
Reply with quote  
 Post subject: Re: Find location
PostPosted: Fri Apr 20, 2012 3:45 pm 
Offline

Joined: Mon Apr 07, 2008 10:47 am
Posts: 45
Thanks, Matthew. Sorry to seem dense on this, but this is something I've never done before. Where should I put this and how do I call it? :?:


Top
 Profile  
Reply with quote  
 Post subject: Re: Find location
PostPosted: Sat Apr 21, 2012 11:03 am 
Offline
User avatar

Joined: Sun Aug 12, 2007 10:10 am
Posts: 1086
Location: Boiling Springs, SC
Apologies for the delay, worked late last night...and heading back in in just a few :-/ The following example I created for you uses the default Windows Region and Language ID's (numeric) as when I was testing the code this morning, realized that Vista+ only uses the numeric values where previous alphabetical ID's were used in the older Windows API's.

**Note: (You will need to lookup the numeric values for the regions/languages you wish to test against). I have made the code simple to read through and if you have trouble finding the region/language values in a google search I'll be glad to look them up for you later today :-) English and United States are already included in the code.)

Source:
http://www.realstudiodevspot.com/demos/ ... nguage.rbp

_________________
Matthew A. Combatti
Real Studio 2012 r1.2

Visit Xojo Developer's Spot!
Systems I Use:
Windows XP/Windows Vista/Windows Server 2008 r2/Windows 7/Windows 8
Mac OSX 10.5/Mac OSX 10.6/Mac OSX Server/Ubuntu/Debian/Suse/Red Hat/
Windows Server 2011/CentOS 5.4 /ReactOS/SimOS

~All Xojo Compatible~


Top
 Profile  
Reply with quote  
 Post subject: Re: Find location
PostPosted: Sat Apr 21, 2012 11:07 am 
Offline
User avatar

Joined: Sun Aug 12, 2007 10:10 am
Posts: 1086
Location: Boiling Springs, SC
**Side Note: If you goto Control Panel => Region & Language you can change the Region and Language to get the numeric values needed if you have trouble finding them....although a restart will be required before the changes are accepted system wide. (I took the liberty of Google-ing and referencing the country codes for you...see code comments)

_________________
Matthew A. Combatti
Real Studio 2012 r1.2

Visit Xojo Developer's Spot!
Systems I Use:
Windows XP/Windows Vista/Windows Server 2008 r2/Windows 7/Windows 8
Mac OSX 10.5/Mac OSX 10.6/Mac OSX Server/Ubuntu/Debian/Suse/Red Hat/
Windows Server 2011/CentOS 5.4 /ReactOS/SimOS

~All Xojo Compatible~


Top
 Profile  
Reply with quote  
 Post subject: Re: Find location
PostPosted: Sat Apr 21, 2012 11:40 am 
Offline
Real Software Engineer

Joined: Sat Dec 24, 2005 8:18 pm
Posts: 7858
Location: Canada, Alberta, Near Red Deer
garymc wrote:
Thanks, Matthew. Sorry to seem dense on this, but this is something I've never done before. Where should I put this and how do I call it? :?:


Go to the ARBP & download the Windows Functionality Suite which has this & a ton of other Windows specific declares already done and set up so you just use the code

In this case the class is named "LocaleInformation" and it already includes all the information you need / want

_________________
Norman Palardy (Real Software)


Top
 Profile  
Reply with quote  
 Post subject: Re: Find location
PostPosted: Sat Apr 21, 2012 4:52 pm 
Offline

Joined: Mon Apr 07, 2008 10:47 am
Posts: 45
I appreciate your help everyone. The LocaleInformation was very helpful and hit the spot! :D
Thanks again.
Gary


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group