AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Programmieren allgemein Probleme mit FormatSettings.DecimalSeparator
Thema durchsuchen
Ansicht
Themen-Optionen

Probleme mit FormatSettings.DecimalSeparator

Ein Thema von Hunni · begonnen am 10. Jan 2017 · letzter Beitrag vom 13. Jan 2017
Antwort Antwort
Seite 2 von 2     12   
Hunni

Registriert seit: 30. Apr 2006
Ort: Rödermark
97 Beiträge
 
Delphi 11 Alexandria
 
#11

AW: Probleme mit FormatSettings.DecimalSeparator

  Alt 13. Jan 2017, 11:18
Hi,


ich habe es jetzt ers einmal so gelöst

ich lese mir beim Programmstart den Wert aus GetLocaleChar(LOCALE_USER_DEFAULT, LOCALE_SDECIMAL, ',') aus und verwende diesen im Programm

Ich hoffe das ich damit jetzt das Problem gelöst habe.

Die Zeit wird es zeigen


Gruß

Torsten
  Mit Zitat antworten Zitat
HolgerX

Registriert seit: 10. Apr 2006
Ort: Leverkusen
961 Beiträge
 
Delphi 6 Professional
 
#12

AW: Probleme mit FormatSettings.DecimalSeparator

  Alt 13. Jan 2017, 12:48
Hmm..

Ich hatte mir für das Problem mit Windows 7 eine kleine Unit erstellt, welche ich einfach in die DPR mit aufnehme und gut ist es.
Das mache ich bei allen Kunden so, welche gemischte Systeme einsetzen, sprich EN-Windows7 installieren und dann per Sprachpaket auf DE umstellen.

Delphi-Quellcode:
unit UBugFixWin7UserDefaultLCID;

interface

implementation

uses
  Windows;

//WM_SETTINGCHANGE SendMessage(HWND_BROADCAST, WM_SETTINGCHANGE, 0&, 0&)

initialization


(*
BugFix Win7

Muss in DPR an erster Stelle stehen!



http://stackoverflow.com/questions/1767946/getthreadlocale-returns-different-value-than-getuserdefaultlcid

The relevant API calls all operate on registry values that can be found at HKCU\Control Panel\International.
The value " Locale " is maintained for backward compatibility reasons and under normal circumstances is kept
in synch with its newer counterpart called " LocaleName ". Under Windows 7 at least, this synch process
however doesn't work where processes are being run as another user (i.e. RunAs or Impersonation).

This seems to be the case during installation, where the installer is launched from an existing windows
session. It does however seem to work correctly if you've booted from the install CD.

GetThreadLocale gets its value from Thread Information Block or Thread Environment Block (TIB or TEB)
See: http://en.wikipedia.org/wiki/Thread_Environment_Block For both Vista and Windows 7, the TIB is
initialised with the HKCU\Control Panel\International\Locale registry entry at logon. This becomes
the default Locale for all threads created during the session. Changing this registry value during
a session has no effect on the value returned by the GetThreadLocale API call. The user must log out
and log in again to see a change. This is the API call that Delphi uses as the basis to initialize
all its locale format strings ( See SysUtils.GetFormatSettings method), from which all date fields are formatted.

GetUserDefaultLCID: in Vista, bases its return value on the HKCU\Control Panel\International\Locale registry entry.
In Windows 7, bases its return value on the HKCU\Control Panel\International\LocaleName registry entry.
The respective registry entry can be changed during a session and the result is immediately reflected
in this API call return value.

SetThreadLocale updates the TIB to reflect the locale provided in the parameter to this call.
Note that this only ever effects the thread the API call is executed from. The API calls
SetThreadLocale(LOCALE_USER_DEFAULT) and SetThreadLocale(GetUserDefaultLCID) are functionally
equivalent. They both derive the source locale as described in the GetUserDefaultLCID API call above.

*)


  SetThreadLocale(GetUserDefaultLCID);

end.
  Mit Zitat antworten Zitat
Antwort Antwort
Seite 2 von 2     12   


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 06:06 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz