|
-
Nov 14th, 2000, 04:57 AM
#1
Thread Starter
Junior Member
I want to know what kind of decimal separator is being used in a CPU from a VB6 routine.
How can I do this?
My best regards
José Nogueira
Eng. José Nogueira
Mail: [email protected]
Web: planeta.clix.pt/janogueira
Entroncamento-Santarém-PORTUGAL
-
Nov 14th, 2000, 07:39 AM
#2
Frenzied Member
I suppose the first question I should ask is "Why?"
What difference does it make how the calculation is processed in the CPU providing the figures it comes up with are correct..?
At the lowest level it's only voltage changes in a wire anyway..!!
'Buzby'
Visual Basic Developer
"I'm moving to Theory. Everything works there."
-
Nov 14th, 2000, 08:08 AM
#3
Addicted Member
Operating System
I'm sure you don't mean CPU. The CPU does not use decimal seperators, it uses floating point maths, and it is not in decimal format at all.
Only when the operating system receives the results does decimal format become relevant. The operating system will display the result with the decimal seperator of the users choice. In the case of the Windows operating system, this choice is set in the regional settings. You have to read the regional settings for the specific user to determine what the seperator is.
Shrog
-
Nov 14th, 2000, 09:16 AM
#4
Lively Member
The decimal seperator is stored in the registry on NT..
HKEY_CURRENT_USER\Control Panel\International\sDecimal
and on 98/95 you can get it from the file win.ini..
[intl]
sDecimal=.
-
Nov 14th, 2000, 09:33 AM
#5
transcendental analytic
BTW, whats the usual sDecimal you have since i have:
sDecimal=,
i've always had that and it's kind of disturbing when you get commas as results of vb calculations and have to enter points.
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Nov 14th, 2000, 09:38 AM
#6
Lively Member
UK seetings, sDecimal=.
I think everywere else uses a comma
-
Nov 14th, 2000, 09:44 AM
#7
Addicted Member
.
South Africa Setting: sDecimal=.
Africa Rules!
Shrog
-
Nov 14th, 2000, 10:47 AM
#8
transcendental analytic
damn, maybe i have to change..
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Nov 14th, 2000, 10:50 AM
#9
Frenzied Member
Yep guys, here in Holland we have the comma too!
But I just want to say it sucks that the UK wants to do every not-standard (plugs, screws, driving left, weights, mesurements, not even the Euro?! (oh.. am I right?))
I think we have to ban the UK from europe as long as they don't comply with 'the' standards 
hehe just kidding, but it can be quite annoying when you want to use your discman in london and the plug doesn't fit!?!
And if they say you can buy 1 foot of licorice I don't even know how long it is!
And when I want to know how big my monitor is, I want to hear it in CM! not Inches 
hehe ok I'm overacting.
Jop - validweb.nl
Alcohol doesn't solve any problems, but then again, neither does milk.
-
Nov 14th, 2000, 11:06 AM
#10
Lively Member
sDecimal=,
Here in Sweden !
-
Nov 14th, 2000, 11:10 AM
#11
transcendental analytic
hehe cool, maybe i change back to , since the majority have ","'s now
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Aug 9th, 2024, 08:50 AM
#12
New Member
Re: Decimal separator with VB6
Hello,
I would like to change the value
HKEY_CURRENT_USER\Control Panel\International\sDecimal
","--> "."
I work in VB6
It´s possible ?
Mauricio
-
Aug 9th, 2024, 09:22 AM
#13
Re: Decimal separator with VB6
When I had an installation in Montreal, I had some problems with exports from VB6 to Excel, and the way things were processed. It turned out they were using a comma (rather than a period) for the decimal separator, and that was causing all the problem.
To fix it, I wrote the following:
Code:
Option Explicit
Private Declare Function GetLocaleInfoA Lib "kernel32" (ByVal Locale As Long, ByVal LCType As Long, ByVal lpLCData As String, ByVal cchData As Long) As Long
Private Declare Function SetLocaleInfoA Lib "kernel32" (ByVal Locale As Long, ByVal LCType As Long, ByVal lpLCData As String) As Long
Private Sub ForceSystemDecimalToPeriod()
' We MUST use the ANSI API version so it's an ANSI character that's used for the actual decimal character.
Const LOCALE_SDECIMAL As Long = &HE&
Const LOCALE_SGROUPING As Long = &H10&
Const Eng_LCID As Long = 1033&
Dim s As String
'
s = String$(GetLocaleInfoA(Eng_LCID, LOCALE_SDECIMAL, vbNullString, 0&), 0)
GetLocaleInfoA Eng_LCID, LOCALE_SDECIMAL, s, Len(s)
If RTrimNull(s) <> "." Then
SetLocaleInfoA Eng_LCID, LOCALE_SDECIMAL, "."
SetLocaleInfoA Eng_LCID, LOCALE_SGROUPING, ","
End If
End Sub
Private Function RTrimNull(s As String) As String
RTrimNull = s
Do
If Right$(RTrimNull, 1&) <> vbNullChar Then Exit Do
RTrimNull = Left$(RTrimNull, Len(RTrimNull) - 1&)
Loop
End Function
As a caveat, this changes it for the WHOLE SYSTEM, and not just this program that changes it. For my client, that was fine. However, it may not be fine in other situations.
If you really wanted to get fancy, you could check when your program has the system focus, and activate/deactivate it based on that. But that would require a bit of subclassing in VB6. In the CodeBank, I've got code to detect when a VB6 program gets/loses the system-wide focus.
Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.
-
Aug 9th, 2024, 09:59 AM
#14
New Member
Re: Decimal separator with VB6
Thanks you..
Separador Decimal ="." = OK
NOW
Símbolo de agrupamento de dígitos = ??
-
Aug 9th, 2024, 10:35 AM
#15
Re: Decimal separator with VB6
If you look at my code, you'll see the grouping character is already handled.
Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.
-
Aug 9th, 2024, 11:22 AM
#16
New Member
Re: Decimal separator with VB6
Hello,
Sorry, but Símbolo de agrupamento de dígitos = ?? doesn´t work
I try to put ".", but nothing
Mauricio
-
Aug 10th, 2024, 02:02 AM
#17
Re: Decimal separator with VB6
Why do you need the change the local settings of a user?
Our software is used in countries with all kind locale settings and we don’t have any problems
-
Oct 26th, 2024, 12:52 AM
#18
Re: Decimal separator with VB6
For anyone reading (in the future), LOCALE_SGROUPING is for something else.
The needed for thousand separator is:
Code:
Const LOCALE_STHOUSAND As Long = &HF&
-
Oct 26th, 2024, 04:35 AM
#19
Addicted Member
Re: Decimal separator with VB6
Code:
Dim DcSp as long
DcSp = AscW(MidB$(1 / 2, 3, 2)) 'Contains the ASCII value of the decimal separator
This is the "empirical" solution suggested by Francesco Balena.
-
Nov 7th, 2024, 09:44 PM
#20
Addicted Member
Re: Decimal separator with VB6
If comma is your decimal separator then what happens when you create a CSV file containing numbers?
-
Nov 8th, 2024, 02:47 AM
#21
Re: Decimal separator with VB6
 Originally Posted by VB-only
If comma is your decimal separator then what happens when you create a CSV file containing numbers?
In this case, the field separator is ";"
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|