Just to let people know, there seems to be a problem with Windows ME
regarding the GetLocaleInfo, it doesn't return the size when you pass it
a zero as the size parameter. Luckily on the code below it only returns
a single value. I checked and found in fact everyone with this problem
had upgrades to ME. (fools rush in)

Regards
Jason Coley
Manawatu Software Solutions
http://www.software-solutions.co.nz 

-----Original Message-----
From: Jason L. Coley 
Sent: Thursday, 21 September 2000 1:11 p.m.
To: Multiple recipients of list delphi
Subject: RE: Re: [DUG]: Locale Measure


I just read another article on the delphi develpers journal that reads
more like this:

var
        Size: Integer;
        TempString: String;
        LocaleID: Integer;

begin
        Size := GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_IMEASURE,
MyPcharLocale, 0);
        SetLength(TempString, Size - 1);
        GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_IMEASURE,
PChar(TempString), Size);
        LocaleID := strtoint(TempString);
end;

Is this a better way than using the GetMem etc. commands?

Jason


-----Original Message-----
From: Neven MacEwan [mailto:[EMAIL PROTECTED]]
Sent: Thursday, 21 September 2000 1:00 p.m.
To: Multiple recipients of list delphi
Subject: Re: [DUG]: Locale Measure


 Jason 

The error is LocaleID := strtoint(MyPcharLocale);
being passed a blank string

Now why MyPcharLocale is blank is an M$ mystery

HTH
Neven

----- Original Message ----- 
From: Jason L. Coley <[EMAIL PROTECTED]>
To: Multiple recipients of list delphi <[EMAIL PROTECTED]>
Sent: Thursday, 21 September 2000 12:53
Subject: [DUG]: Locale Measure


Does anyone know what's wrong with this small piece of code? It works on
most machines, but some of my users get errors, and there seems to be no
solid reason or verison of windows that brings the error up. Usually the
error is "" is not a valid integer.

var
MyPCharSize: Integer;
MyPCharLocale: PChar;
LocaleID: Integer;

begin
MyPcharSize := GetLocaleInfo(LOCALE_USER_DEFAULT,
LOCALE_IMEASURE, MyPcharLocale, 0);
Getmem(MyPCharLocale, MyPCharSize);
GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_IMEASURE,
MyPcharLocale, MyPCharSize);
LocaleID := strtoint(MyPcharLocale);
Freemem(MyPCharLocale);
end;
------------------------------------------------------------------------
---
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"


------------------------------------------------------------------------
---
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"
------------------------------------------------------------------------
---
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"
---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of "unsubscribe delphi"

Reply via email to