Results 1 to 19 of 19

Thread: same OS, same regional settings, different boolean value localization

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2014
    Posts
    8

    Unhappy same OS, same regional settings, different boolean value localization

    Hello all,
    this is a very weird issue.
    The executable is very old and was build with VB6.0.

    The code piece is like this:

    var variable = True

    Msgbox variable

    On server A, running the executable, I get displayed "Vero"

    On server B, running the same executable with the same dll dependancies I get "True"

    The OS (Win2k8 server 32 bit) and regional settings are the same, so there must be a reason or some setting that cause this different behaviour.

    What could it be?

    Best Regards,

    Alex

  2. #2
    Smooth Moperator techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,537

    Re: same OS, same regional settings, different boolean value localization

    Looks like a different language to me. If I were to run that on a French language install of windows, I'd likely get 'vrai' ...

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  3. #3
    Fanatic Member DrUnicode's Avatar
    Join Date
    Mar 2008
    Location
    Natal, Brazil
    Posts
    631

    Re: same OS, same regional settings, different boolean value localization

    Boolean variable should change with regional configurations so there must be something in regional config that is different on the OS that returns "True".
    You could also fix this problem using code like this:

    Code:
    Option Explicit
    
    Private Sub Form_Load()
       Dim myBool As Boolean
       myBool = True
       MsgBox IIf(myBool, "Vero", "Falso")
       myBool = False
       MsgBox IIf(myBool, "Vero", "Falso")
    End Sub

  4. #4

    Thread Starter
    New Member
    Join Date
    Sep 2014
    Posts
    8

    Re: same OS, same regional settings, different boolean value localization

    Thanks for your reply, unfortunately I cannot change the code.
    We have several Win2k8 servers SP2 english, with some of them I get "Vero", in others "True".
    I've compered all the tabs of regional settings panel and no differences.
    This is crazy...what could it be?

    Best Regards,
    Alex

  5. #5
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,253

    Re: same OS, same regional settings, different boolean value localization

    VB(A) does most of its formatting over OleAut32.dll - and this library contains functionality,
    to override the Systems Regional-Locale-Settings with a different one.

    I'd take a good look at the function: GetVarConversionLocaleSetting
    and what it hands back to you in its ByRef-Parameter, on the "funny behaving machines" -
    Here's the MSDN-Link: http://msdn.microsoft.com/en-us/libr...=vs.85%29.aspx

    One can also set the behaviour with its co-function: SetVarConversionLocaleSetting
    http://msdn.microsoft.com/en-us/libr...=vs.85%29.aspx

    This time the Flag-Param needs to be passed ByVal - and if you want it to behave according to
    the current System-Locale - you will apparently have to use a FlagValue of 2 (and if I read it correctly,
    followed by a reboot of your server).

    Olaf

  6. #6

    Thread Starter
    New Member
    Join Date
    Sep 2014
    Posts
    8

    Re: same OS, same regional settings, different boolean value localization

    Hello,
    thanks for your reply.
    Both server have de same OleAut32.dll version.
    I really wonder what could have happened during the installation of the same software the causes different localizations of a boolean value.
    To be sure, do I need to write a C++ program in order to run the SetVarConversionLocaleSetting?

    Best Regards,
    Alex

  7. #7
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344

    Re: same OS, same regional settings, different boolean value localization

    Code:
       myBool = True
       MsgBox IIf(myBool, "Vero", "Falso")
    Shouldn't that be

    Code:
       MsgBox IIf(myBool, "Vero", "True") 'Or whatever it is in that particular language?
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

  8. #8
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,253

    Re: same OS, same regional settings, different boolean value localization

    Quote Originally Posted by alex5r4 View Post
    I really wonder what could have happened during the installation of the same software the causes different localizations of a boolean value.
    It wont necessarily have to be your Software which caused the behaviour...
    In case you get it fixed, I would watch out (in case it happens again) - which Installer of
    or which Software was used "recently", that caused the localization to be "shifted" again.

    Quote Originally Posted by alex5r4 View Post
    To be sure, do I need to write a C++ program in order to run the SetVarConversionLocaleSetting?
    No, of course not - the oleaut32-functionality is available in a normal (StdCall)-Dll - and thus
    usable per normal VB-Declares.

    The two APIs come in a typical Getter/Setter-fashion, and could be wrapped best in a Public
    available Property, which could be defined in a *.bas Module for example...

    Code:
    Option Explicit
    
    Private Declare Function GetVarConversionLocaleSetting Lib "oleaut32" (dwFlags As Long) As Long
    Private Declare Function SetVarConversionLocaleSetting Lib "oleaut32" (ByVal dwFlags As Long) As Long
    
    Public Property Get VarConversionLocaleSetting() As Long
    Dim HResult As Long
      HResult = GetVarConversionLocaleSetting(VarConversionLocaleSetting)
      If HResult Then Err.Raise HResult
    End Property
    
    Public Property Let VarConversionLocaleSetting(ByVal dwFlags As Long)
    Dim HResult As Long
      HResult = SetVarConversionLocaleSetting(dwFlags)
      If HResult Then Err.Raise HResult
    End Property
    Before you use the Property Let as below (in a small VB-Program):
    Code:
    VarConversionLocaleSettingFlags = 2
    followed by a reboot of the machine - it would be nice to have an info
    about the setting which was in place before on the affected machines:
    Code:
    MsgBox VarConversionLocaleSettingFlags
    E.g. something like the small Sub below, which reports the former Value -
    but also asks to override the Value with 2 after pressing 'Yes'.

    Code:
    Sub ReportFormerSettingAndTryToChange()
      If MsgBox("Former Setting was: " & VarConversionLocaleSetting & vbLf & "Do you want to override it with 2?", vbYesNo) = vbYes Then
        VarConversionLocaleSetting = 2
      End If
    End Sub
    Olaf

  9. #9

    Thread Starter
    New Member
    Join Date
    Sep 2014
    Posts
    8

    Re: same OS, same regional settings, different boolean value localization

    Hello,
    thank you very much for your help. I had to work on another project so I'm late in answering.
    I've run the

    MsgBox VarConversionLocaleSettingFlags

    either on server the server thant returns 'Vero' and on the one that returns 'True' but in both the MsgBox value was '0'.

    They seem to have the same locale settings flag...

    Do you suggest me to try with setting the value equal to 2?

    Best Regards

    Quote Originally Posted by Schmidt View Post
    It wont necessarily have to be your Software which caused the behaviour...
    In case you get it fixed, I would watch out (in case it happens again) - which Installer of
    or which Software was used "recently", that caused the localization to be "shifted" again.



    No, of course not - the oleaut32-functionality is available in a normal (StdCall)-Dll - and thus
    usable per normal VB-Declares.

    The two APIs come in a typical Getter/Setter-fashion, and could be wrapped best in a Public
    available Property, which could be defined in a *.bas Module for example...

    Code:
    Option Explicit
    
    Private Declare Function GetVarConversionLocaleSetting Lib "oleaut32" (dwFlags As Long) As Long
    Private Declare Function SetVarConversionLocaleSetting Lib "oleaut32" (ByVal dwFlags As Long) As Long
    
    Public Property Get VarConversionLocaleSetting() As Long
    Dim HResult As Long
      HResult = GetVarConversionLocaleSetting(VarConversionLocaleSetting)
      If HResult Then Err.Raise HResult
    End Property
    
    Public Property Let VarConversionLocaleSetting(ByVal dwFlags As Long)
    Dim HResult As Long
      HResult = SetVarConversionLocaleSetting(dwFlags)
      If HResult Then Err.Raise HResult
    End Property
    Before you use the Property Let as below (in a small VB-Program):
    Code:
    VarConversionLocaleSettingFlags = 2
    followed by a reboot of the machine - it would be nice to have an info
    about the setting which was in place before on the affected machines:
    Code:
    MsgBox VarConversionLocaleSettingFlags
    E.g. something like the small Sub below, which reports the former Value -
    but also asks to override the Value with 2 after pressing 'Yes'.

    Code:
    Sub ReportFormerSettingAndTryToChange()
      If MsgBox("Former Setting was: " & VarConversionLocaleSetting & vbLf & "Do you want to override it with 2?", vbYesNo) = vbYes Then
        VarConversionLocaleSetting = 2
      End If
    End Sub
    Olaf

  10. #10
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,253

    Re: same OS, same regional settings, different boolean value localization

    Quote Originally Posted by alex5r4 View Post
    I've run the

    MsgBox VarConversionLocaleSettingFlags

    either on server the server thant returns 'Vero' and on the one that returns 'True' but in both the MsgBox value was '0'.

    They seem to have the same locale settings flag...

    Do you suggest me to try with setting the value equal to 2?
    Yes, on your "Vero" machine I'd run a small, new-compiled VB6-Program (in Admin-Mode),
    which only contains a *.bas-Module with the following code-content:

    Code:
    Option Explicit
    
    Private Declare Function GetVarConversionLocaleSetting Lib "oleaut32" (dwFlags As Long) As Long
    Private Declare Function SetVarConversionLocaleSetting Lib "oleaut32" (ByVal dwFlags As Long) As Long
    
    Sub Main()
      ReportFormerSettingAndTryToChange
    End Sub 
    
    Sub ReportFormerSettingAndTryToChange()
      If MsgBox("Former Setting was: " & VarConversionLocaleSetting & vbLf & "Do you want to override it with 2?", vbYesNo) = vbYes Then
        VarConversionLocaleSetting = 2
      End If
    End Sub
    
    Public Property Get VarConversionLocaleSetting() As Long
    Dim HResult As Long
      HResult = GetVarConversionLocaleSetting(VarConversionLocaleSetting)
      If HResult Then Err.Raise HResult
    End Property
    
    Public Property Let VarConversionLocaleSetting(ByVal dwFlags As Long)
    Dim HResult As Long
      HResult = SetVarConversionLocaleSetting(dwFlags)
      If HResult Then Err.Raise HResult
    End Property
    Oh, and don't forget to reboot the machine after applying the '2'.

    Olaf
    Last edited by Schmidt; Oct 14th, 2014 at 07:17 AM.

  11. #11

    Thread Starter
    New Member
    Join Date
    Sep 2014
    Posts
    8

    Re: same OS, same regional settings, different boolean value localization

    Hello,
    thanks, I wrote the code but its behaviour is this:
    Former setting is 0, after overriding is 2. If I call again the method ReportFormerSettingAndTryToChange it shows correctly the value 2 the second time.
    But, if I close the program and I start it again, the former setting is still 0. It seems the value is lost after closing the program, as it is saved in memory and not on registry.

    Kind Regards

    Quote Originally Posted by Schmidt View Post
    Yes, on your "Vero" machine I'd run a small, new-compiled VB6-Program (in Admin-Mode),
    which only contains a *.bas-Module with the following code-content:

    Code:
    Option Explicit
    
    Private Declare Function GetVarConversionLocaleSetting Lib "oleaut32" (dwFlags As Long) As Long
    Private Declare Function SetVarConversionLocaleSetting Lib "oleaut32" (ByVal dwFlags As Long) As Long
    
    Sub Main()
      ReportFormerSettingAndTryToChange
    End Sub 
    
    Sub ReportFormerSettingAndTryToChange()
      If MsgBox("Former Setting was: " & VarConversionLocaleSetting & vbLf & "Do you want to override it with 2?", vbYesNo) = vbYes Then
        VarConversionLocaleSetting = 2
      End If
    End Sub
    
    Public Property Get VarConversionLocaleSetting() As Long
    Dim HResult As Long
      HResult = GetVarConversionLocaleSetting(VarConversionLocaleSetting)
      If HResult Then Err.Raise HResult
    End Property
    
    Public Property Let VarConversionLocaleSetting(ByVal dwFlags As Long)
    Dim HResult As Long
      HResult = SetVarConversionLocaleSetting(dwFlags)
      If HResult Then Err.Raise HResult
    End Property
    Oh, and don't forget to reboot the machine after applying the '2'.

    Olaf

  12. #12
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,253

    Re: same OS, same regional settings, different boolean value localization

    Quote Originally Posted by alex5r4 View Post
    But, if I close the program and I start it again, the former setting is still 0. It seems the value is lost after closing the program, as it is saved in memory and not on registry.
    Did you try - as long as the process runs, and after setting to '2', what Value is reported for:
    MsgBox CStr(True)

    Aside from that test - did you run your small App as Administrator?
    Maybe the Registry-Setting is not going through, when this is not the case...

    Olaf

  13. #13

    Thread Starter
    New Member
    Join Date
    Sep 2014
    Posts
    8

    Re: same OS, same regional settings, different boolean value localization

    Yes, I tryed with "run as Administrator", before and after rebooting the system but nothing changed :-(
    I've also changed all the regional settings in spanish and rebooted the system but the msgbox was still "True"
    This is crazy...what causes this localization?

    Quote Originally Posted by Schmidt View Post
    Did you try - as long as the process runs, and after setting to '2', what Value is reported for:
    MsgBox CStr(True)

    Aside from that test - did you run your small App as Administrator?
    Maybe the Registry-Setting is not going through, when this is not the case...

    Olaf

  14. #14
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,253

    Re: same OS, same regional settings, different boolean value localization

    I'm out of ideas then - thought these APIs were worth a try - but apparently the cause is else-where.
    (I'd guess the setup of a certain program has overwritten some library it shouldn't have on the machines
    which now behave different - but I can only speculate - a concrete diff on the files in syswow64 -
    (over version-numbers, file-length, install-date) would perhaps be interesting.

    Good luck.

    Olaf

  15. #15
    Member
    Join Date
    Oct 2007
    Posts
    52

    Re: same OS, same regional settings, different boolean value localization

    Hi Alex,

    You said the Regional settings are the same, but did you check the "Language for non-Unicode programs" on the Administrative tab of the Region window on 8.1 on the machine where you are getting "Vero"? If not, I'd suggest you do that. Good luck!

    Chris

  16. #16

    Thread Starter
    New Member
    Join Date
    Sep 2014
    Posts
    8

    Re: same OS, same regional settings, different boolean value localization

    Hi Chris,
    thanks but I've already checked that option and on both servers is "Italian" but in one I get "True" in other "Vero"...If only I could find what causes this crazy behaviour...I'll write to Microsoft...

    Kind Regards,
    Alex

    Quote Originally Posted by chrislong2 View Post
    Hi Alex,

    You said the Regional settings are the same, but did you check the "Language for non-Unicode programs" on the Administrative tab of the Region window on 8.1 on the machine where you are getting "Vero"? If not, I'd suggest you do that. Good luck!

    Chris

  17. #17
    Member
    Join Date
    Oct 2007
    Posts
    52

    Re: same OS, same regional settings, different boolean value localization

    Another thought: MS made changes in the behavior in this area with msvbvm60.dll (the main VB6 runtime) circa SP3. So I would suggest you compare the versions of msvbvm60.dll on the servers. Generally speaking the OS protects the msvbvm60 dll from older versions, but this can be gotten around.

  18. #18

    Thread Starter
    New Member
    Join Date
    Sep 2014
    Posts
    8

    Re: same OS, same regional settings, different boolean value localization

    I finally solved the mistery!!!

    The different behaviour event with same regional settings, operating system and msvbvm60.dll was due to the presence or absence of the VB6IT.dll.
    No matter which language is set on regional settings, if you have VB6IT.dll, you will always get the True as "Vero"...

    The VB6XX.Dll where XX is the country language code.

    If this dll doesn't exist on the system the default is English.

    You can refer to this thread: http://www.tek-tips.com/viewthread.cfm?qid=268853

    Thanks everybody for your help.

    Bye.

    Quote Originally Posted by chrislong2 View Post
    Another thought: MS made changes in the behavior in this area with msvbvm60.dll (the main VB6 runtime) circa SP3. So I would suggest you compare the versions of msvbvm60.dll on the servers. Generally speaking the OS protects the msvbvm60 dll from older versions, but this can be gotten around.

  19. #19
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: same OS, same regional settings, different boolean value localization

    Makes me wonder what this would show:

    Code:
        Dim B As Boolean
    
        B = True
        MsgBox CStr(B) & vbNewLine & Format$(B)
    I'm almost positive that Format$() always uses OleAut32.dll which will follow the locale settings.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width