Article View: borland.public.cppbuilder.nativeapi
Article #7883Re: Obtaining the Currency Symbol
From: Bob Gonder
Date: Sun, 12 Dec 2004 18:11
Date: Sun, 12 Dec 2004 18:11
73 lines
3193 bytes
3193 bytes
Thomas Maeder [TeamB] wrote:
>Bob Gonder <notbg@notmindspring.invalid> writes:
>
>This looks like a good start, but it doesn't seem to work.
Ok, here you go.
For fun, you might try the commented LOCALE_SNATIVELANGNAME
Win32 Console App in C
#include <stdio.h>
#include <windows.h>
#define hexs(c) (0x0f & (c>'9'? c-('A'-10) : c) )
static char* _stdcall unhex( BYTE*dest, char*src, DWORD len)
{ while( len-- )
{ *dest = (hexs(src[0])<<4) | hexs(src[1]);
++dest;
++src;
++src;
};
return src;
}
void dump_currency_symbol(char const *locname)
{ CHAR buffer[128];
WORD loc;
unhex( &loc, &locname[4], 2 );
if( GetLocaleInfo( loc,
LOCALE_SENGLANGUAGE/*LOCALE_SNATIVELANGNAME*/,
buffer,128 ) )
printf("\r\nLocale: %s %s", locname, buffer );
if( GetLocaleInfo( loc, LOCALE_SCURRENCY, buffer,128 ) )
printf("\t Curency: %s", buffer );
if( GetCurrencyFormat( loc, LOCALE_NOUSEROVERRIDE,
"-12345.78", NULL, buffer,128) )
printf("\t %s", buffer );
}
BOOL CALLBACK EnumLocalesProc( LPTSTR lpLocaleString )
{
dump_currency_symbol(lpLocaleString);
return TRUE;
}
int main(void)
{
dump_currency_symbol("00000000");
EnumSystemLocales( EnumLocalesProc,LCID_INSTALLED );
// EnumSystemLocales( EnumLocalesProc,LCID_SUPPORTED );
return 0;
}
C:\TEST>locale
Locale: 00000000 English Curency: $ ($12,345.78)
Locale: 00000404 Chinese Curency: NT$ -NT$12,345.78
Locale: 00000408 Chinese Curency: �� ��-12,345.78
Locale: 0000040c Chinese Curency: HK$ (HK$12,345.78)
Locale: 00000410 Chinese Curency: $ ($12,345.78)
Locale: 00000414 Chinese Curency: P (P12,345.78)
Locale: 00000804 Greek Curency: � -12.345,78 �
Locale: 00000c04 French Curency: � -12�345,78 �
Locale: 00000c0c French Curency: $ (12�345,78 $)
Locale: 00001004 Italian Curency: � -� 12.345,78
Locale: 00001404 Norwegian (Bokmsl) Curency: kr kr
-12�345,78
C:\TEST>
Technical Details
Message-ID:
<cq1pr0dael8uvf8dujeeib17m0fobvv5di@4ax.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<41b9992f$1@newsgroups.borland.com> <m2hdmtu7gh.fsf@madbox2.local> <20dkr0los4gnkm95m6ovgq1l1m69hgp5gd@4ax.com> <m2k6rnws3z.fsf@madbox2.local>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,5c552075733153e4 X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII From: Bob Gonder <notbg@notmindspring.invalid> Newsgroups: borland.public.cppbuilder.nativeapi Subject: Re: Obtaining the Currency Symbol Date: Sun, 12 Dec 2004 10:11:07 -0800 Organization: MindSpring Enterprises, Inc. Reply-To: notbg@notmindspring.invalid Message-ID: <cq1pr0dael8uvf8dujeeib17m0fobvv5di@4ax.com> References: <41b9992f$1@newsgroups.borland.com> <m2hdmtu7gh.fsf@madbox2.local> <20dkr0los4gnkm95m6ovgq1l1m69hgp5gd@4ax.com> <m2k6rnws3z.fsf@madbox2.local> X-Newsreader: Forte Agent 1.93/32.576 English (American) MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit NNTP-Posting-Host: 69.69.90.133 X-Trace: newsgroups.borland.com 1102875065 69.69.90.133 (12 Dec 2004 10:11:05 -0800) Lines: 74 Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail