BBC BASIC for Windows
« Regional date format & fonts »

Welcome Guest. Please Login or Register.
Apr 5th, 2018, 10:57pm



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

If you require a dump of the post on your message board, please come to the support board and request it.


Thank you Conforums members.

BBC BASIC for Windows Resources
Online BBC BASIC for Windows documentation
BBC BASIC for Windows Beginners' Tutorial
BBC BASIC Home Page
BBC BASIC on Rosetta Code
BBC BASIC discussion group
BBC BASIC for Windows Programmers' Reference

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: Regional date format & fonts  (Read 289 times)
dynamic35
New Member
Image


member is offline

Avatar




PM

Gender: Male
Posts: 34
xx Regional date format & fonts
« Thread started on: Aug 21st, 2012, 11:59am »

In Europe dates are in order: dd/mm/yy
In USA dates are mm/dd/yy. And in some EU countries there are two dots or small circle above a, o A O.
In some cases date order makes an important role since date like 02/12/2012 can be interpreted as 2nd of Dec 2012 (EU) or 12th of Feb 2012 (USA).

What is the method to clarify -as part of the bbc4w codes -the 'region' setting of windows computers, into which one wants to install bbc4w programs.
Ref
There are code written by Richard that tells to you for example locations of op sys "special files" or there is a code to find out name of the Win op sys that user employs.
I cannot find from helps advice, how to feed into a real time BBC4W program flow the relevant format of user's Windows region &date, ie the computer into into which I need to install an application , that is dependent on the order of the users' regional date format.
Also similar problem might be investications on desimal separator a user has -for example "," or "." .

Greetings
Dynamic35
User IP Logged

dynamic35
New Member
Image


member is offline

Avatar




PM

Gender: Male
Posts: 34
xx Re: Regional date format & fonts
« Reply #1 on: Aug 22nd, 2012, 05:47am »

Code referenced in above story So, I would like also to find the date format of the PC . If you have that wisedom please modify my program down here
MODE 12
CLS
PRINT " PC type and special Microsoft folders"
PROCgetversion2
PRINT " OpSys="; D$; " (MS-id=";A%;B%;C%;")"

PRINT " Windows Directory =";FNwindowsdirectory
PRINT " System Directory=";FNsystemdirectory
PRINT " FolderId"
REM my XP sp3 22.08.12
id%=-1
REPEAT
id%=id%+1
spex$=FNspecialfolder(id%)
IF LENspex$ > 2 PRINT id%,TAB(14); spex$
UNTIL id% = 99
REM missing: a function to search date format (dd/mm/yy or mm/dd/yy) that is active now
END

REM 3 routines based on RR public samples
DEF FNwindowsdirectory
LOCAL T%
DIM T% LOCAL 260
SYS "GetWindowsDirectory", T%, 260
= $$T% + "\"

DEF FNsystemdirectory
LOCAL T%
DIM T% LOCAL 260
SYS "GetSystemDirectory", T%, 260
= $$T% + "\"

DEF PROCgetversion2
LOCAL osvi{}
DIM osvi{Size%, \ Size of structure
\ Major%, \ Major version number
\ Minor%, \ Minor Version number
\ Build%, \ Build number
\ Platform%, \ Platform ID
\ SP&(127) \ Service Pack string
\ }
osvi.Size% = 148
SYS "GetVersionEx", osvi{}
A% = osvi.Major%
B% = osvi.Minor%
C% = osvi.Platform%
D$="Unknown OpSystem"
IF A%=4 AND B%=0 AND C%=1 THEN D$="Windows 95"
IF A%=4 AND B%=10 AND C%=1 THEN D$= "Windows 98"
IF A%=4 AND B%=90 AND C%=1 THEN D$= "Windows Me"
IF A%=4 AND C%=2 THEN D$="Windows NT4"
IF A%=5 AND B%=1 AND C%=2 THEN D$="Windows XP"
IF A%=5 AND B%=0 AND C%=2 THEN D$="Windows 2000"
IF A%=6 AND B%=1 AND C%=2 THEN D$= "Windows 7"
IF A%=6 AND B%=0 AND C%=2 THEN D$= "Windows Vista"
ENDPROC


DEF FNspecialfolder(id%)
LOCAL ppidl%, folder%, malloc%
DIM folder% LOCAL 255
SYS "SHGetSpecialFolderLocation", @hwnd%, id%, ^ppidl%
SYS "SHGetPathFromIDList", ppidl%, folder%
SYS "SHGetMalloc", ^malloc%
SYS !(!malloc%+20), malloc%, ppidl%
= $$folder% + "\"
User IP Logged

admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: Regional date format & fonts
« Reply #2 on: Aug 22nd, 2012, 08:35am »

on Aug 21st, 2012, 11:59am, dynamic35 wrote:
What is the method to clarify -as part of the bbc4w codes -the 'region' setting of windows computers, into which one wants to install bbc4w programs.

Use the GetLocaleInfo API:

Code:
      _LOCALE_SDECIMAL = &E
      _LOCALE_SLONGDATE = 32
      _LOCALE_USER_DEFAULT = &400
      
      DIM DateFormat{text&(80)}
      SYS "GetLocaleInfo", _LOCALE_USER_DEFAULT, _LOCALE_SLONGDATE, \
      \                    DateFormat{}, DIM(DateFormat{})
      PRINT "The user's date format is " DateFormat.text&()
      
      DIM DecimalSep{text&(4)}
      SYS "GetLocaleInfo", _LOCALE_USER_DEFAULT, _LOCALE_SDECIMAL, \
      \                    DecimalSep{}, DIM(DecimalSep{})
      PRINT "The user's decimal separator is " DecimalSep.text&() 

GetLocaleInfo will return all sorts of other region-dependent settings. Check MSDN for details.

Quote:
I cannot find from helps advice, how to feed into a real time BBC4W program flow the relevant format of user's Windows region &date

The GetDateFormat API by default formats the date according to the user's preferences:

Code:
      DATE_LONGDATE = 2
      _LOCALE_USER_DEFAULT = &400

      DIM Date{text&(80)}
      SYS "GetDateFormat", _LOCALE_USER_DEFAULT, DATE_LONGDATE, 0, 0, \
      \                    Date{}, DIM(Date{})
      PRINT Date.text&() 

You can alternatively specify DATE_SHORTDATE.

Richard.
User IP Logged

dynamic35
New Member
Image


member is offline

Avatar




PM

Gender: Male
Posts: 34
xx Re: Regional date format & fonts
« Reply #3 on: Aug 22nd, 2012, 10:41am »

Excellent. Thank you very much , again
Dyna
User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls