Add code before initialization of units in Delphi

前端 未结 3 1113
礼貌的吻别
礼貌的吻别 2021-01-19 21:41

Is there a place where I can add code that will be executed before unit initialization?

The reason I want to do this is I need to change the DecimalSeparator, this h

3条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-19 22:31

    A word of warning here.

    I've got an application running on the desktop of a logged in user and IN THE MIDDLE of testing the app the DecimalSeparator changed for me, without me restarting the application.

    I used to set the

    DecimalSeparator := '.'; 
    

    once in the FormCreate() code, but that seems not the be enough. So now I set it once every time before I use my FormatFloat() function (used only in one place in my application).

    I do not know WHY this happens, but probably there are some system-wide parameter changes happening, that reset the char to ',' on my system.

    The best way to avoid this is probably to set the decimal separator in windows configuration to '.' to avoid strange problems...

提交回复
热议问题