API call on Windows NT 
Author Message
 API call on Windows NT

I am using code at
http://www.*-*-*.com/
to retrieve the user's short date format setting and displaying it to them
in the opening form, to ensure they know what their computer is set to.

On Windows 95 machines this works fine, but on Windows NT it lies.  A user's
machine will be set to dd/mm/yyyy, but the textbox displays M/dd/yy.

I don't have a lot of experience working with API calls.  Do I have to
modify this to work on NT?

Joan



Mon, 03 Mar 2003 03:00:00 GMT  
 API call on Windows NT
Can't you use Label = Format(Now(),"dd/mm/yyyy")
I  have looked (briefly) at the MVPS.ORG code seg. and it does not set the
regional settings, just reads them. And I doubt anyone would be happy with a
prog changing their regional settings. If so, code such as Label=Now() would
be rendered in whatever regional setting are currently set to. I always use
the above and works fine on 98/NT/et al.


Fri, 07 Mar 2003 09:40:28 GMT  
 API call on Windows NT
Hi Ken, thanks for your thoughts.  I'm not interested in changing anything
in the Regional Settings.  I just want to let the user know what the short
date format in regional settings is.

Using your suggestion of Format(Now(),"dd/mm/yyyy") will not tell you the
short date format.  If my Reg Settings are M/dd/yy and I use your label it
will still say 18/9/2000, which is not the Reg Settings.

This is what I'm after.  Users enter dates dd/mm/yy or mm/dd/yy depending on
their Regional Settings.  This group of users know nothing about Regional
Settings (nor do they want to).  They just want to know how to enter dates.
As a group, they decided to use dd/mm/yy and all the computers were set
accordingly.  Every so often, their computer settings are getting changed to
mm/dd/yy (I'm not on site, so don't know how this is happening).  So a user
may enter 3/1/2000 thinking
they have entered Jan 3, not knowing their computer is accepting Mar 1.

Instead of relying on the computer settings to remain as dd/mm/yy, I thought
I would display a textbox on the main form that said:
'Enter dates in this format: dd/mm/yy' or whatever the short date format is.
Joan

Quote:

>Can't you use Label = Format(Now(),"dd/mm/yyyy")
>I  have looked (briefly) at the MVPS.ORG code seg. and it does not set the
>regional settings, just reads them. And I doubt anyone would be happy with
a
>prog changing their regional settings. If so, code such as Label=Now()
would
>be rendered in whatever regional setting are currently set to. I always use
>the above and works fine on 98/NT/et al.



Fri, 07 Mar 2003 03:00:00 GMT  
 API call on Windows NT
I just tested this on a 95,98 and NT4 SP6 and it picks the format OK
Dim mydate As Date
    mydate = "5 / 1 / 00"
    If Day(mydate) = 5 Then
      MsgBox "date format is UK", vbCritical
    Else
      MsgBox "date format is US", vbCritical
    End If
    End


Fri, 07 Mar 2003 03:00:00 GMT  
 API call on Windows NT
Hi Joan

The Format function in Access will accept (among others) the text string
"Short Date" as an argument, so I'll stick my neck out and suggest that
you use that rather than an API call.
I don't know for certain that the result would always be exactly the
Regional Settings, but if Format(Now(),"Short Date") or
Format(Date(),"Short Date") didn't give me the Regional Settings I'd
want to know why.

I've just thrown this into Access:

Sub aaa()
Dim a$
a$ = "Today is Day " & Format(Date, "dd")
a$ = a$ & " of Month " & Format(Date, "mm")
a$ = a$ & " which your computer sees as " & Format(Date, "Short Date")
debug.? a$
End Sub

for a result of:

Today is Day 19 of Month 09 which your computer sees as 19/Sep/2000

which matches my personal Regional Settings.

Cheers,
Alan

Quote:

> Hi Ken, thanks for your thoughts.  I'm not interested in changing anything
> in the Regional Settings.  I just want to let the user know what the short
> date format in regional settings is.

> Using your suggestion of Format(Now(),"dd/mm/yyyy") will not tell you the
> short date format.  If my Reg Settings are M/dd/yy and I use your label it
> will still say 18/9/2000, which is not the Reg Settings.

> This is what I'm after.  Users enter dates dd/mm/yy or mm/dd/yy depending on
> their Regional Settings.  This group of users know nothing about Regional
> Settings (nor do they want to).  They just want to know how to enter dates.
> As a group, they decided to use dd/mm/yy and all the computers were set
> accordingly.  Every so often, their computer settings are getting changed to
> mm/dd/yy (I'm not on site, so don't know how this is happening).  So a user
> may enter 3/1/2000 thinking
> they have entered Jan 3, not knowing their computer is accepting Mar 1.

> Instead of relying on the computer settings to remain as dd/mm/yy, I thought
> I would display a textbox on the main form that said:
> 'Enter dates in this format: dd/mm/yy' or whatever the short date format is.
> Joan


> >Can't you use Label = Format(Now(),"dd/mm/yyyy")
> >I  have looked (briefly) at the MVPS.ORG code seg. and it does not set the
> >regional settings, just reads them. And I doubt anyone would be happy with
> a
> >prog changing their regional settings. If so, code such as Label=Now()
> would
> >be rendered in whatever regional setting are currently set to. I always use
> >the above and works fine on 98/NT/et al.

--
Alan Carpenter
Applied Computing, Mathematics and Statistics Group
Burns B314
Lincoln University


Sat, 08 Mar 2003 06:23:01 GMT  
 API call on Windows NT

You really should not care, actually. You should just "go with the flow" and
use the system's idea of regional settings, and trust that the user will do
the same.

In other words, your system should keep working even if they change the
regional settings.

--
MichKa

random junk of dubious value at the
multilingual http://www.trigeminal.com/ and
a new book on internationalization in VB at
http://www.i18nWithVB.com/


Quote:
> Hi Ken, thanks for your thoughts.  I'm not interested in changing anything
> in the Regional Settings.  I just want to let the user know what the short
> date format in regional settings is.

> Using your suggestion of Format(Now(),"dd/mm/yyyy") will not tell you the
> short date format.  If my Reg Settings are M/dd/yy and I use your label it
> will still say 18/9/2000, which is not the Reg Settings.

> This is what I'm after.  Users enter dates dd/mm/yy or mm/dd/yy depending
on
> their Regional Settings.  This group of users know nothing about Regional
> Settings (nor do they want to).  They just want to know how to enter
dates.
> As a group, they decided to use dd/mm/yy and all the computers were set
> accordingly.  Every so often, their computer settings are getting changed
to
> mm/dd/yy (I'm not on site, so don't know how this is happening).  So a
user
> may enter 3/1/2000 thinking
> they have entered Jan 3, not knowing their computer is accepting Mar 1.

> Instead of relying on the computer settings to remain as dd/mm/yy, I
thought
> I would display a textbox on the main form that said:
> 'Enter dates in this format: dd/mm/yy' or whatever the short date format
is.
> Joan


> >Can't you use Label = Format(Now(),"dd/mm/yyyy")
> >I  have looked (briefly) at the MVPS.ORG code seg. and it does not set
the
> >regional settings, just reads them. And I doubt anyone would be happy
with
> a
> >prog changing their regional settings. If so, code such as Label=Now()
> would
> >be rendered in whatever regional setting are currently set to. I always
use
> >the above and works fine on 98/NT/et al.



Sat, 08 Mar 2003 03:00:00 GMT  
 API call on Windows NT
Actually, my system does work regardless of the regional settings.  The
problem I have is that the users do not know what their Regional Settings
are, so I can't 'trust that they will do the same'.

The answer for me turned out to be simple.  I've added a textbox to the main
form that says:
="Todays date is " & Format(Date(),"dddd mmmm"", ""dd yyyy") & " - You would
enter this as: " & Date()

(That's what happens to me when I think too much, and the obvious and simple
escapes me.)
Joan

Quote:

>You really should not care, actually. You should just "go with the flow"
and
>use the system's idea of regional settings, and trust that the user will do
>the same.

>In other words, your system should keep working even if they change the
>regional settings.

>--
>MichKa

>random junk of dubious value at the
>multilingual http://www.trigeminal.com/ and
>a new book on internationalization in VB at
>http://www.i18nWithVB.com/



>> Hi Ken, thanks for your thoughts.  I'm not interested in changing
anything
>> in the Regional Settings.  I just want to let the user know what the
short
>> date format in regional settings is.

>> Using your suggestion of Format(Now(),"dd/mm/yyyy") will not tell you the
>> short date format.  If my Reg Settings are M/dd/yy and I use your label
it
>> will still say 18/9/2000, which is not the Reg Settings.

>> This is what I'm after.  Users enter dates dd/mm/yy or mm/dd/yy depending
>on
>> their Regional Settings.  This group of users know nothing about Regional
>> Settings (nor do they want to).  They just want to know how to enter
>dates.
>> As a group, they decided to use dd/mm/yy and all the computers were set
>> accordingly.  Every so often, their computer settings are getting changed
>to
>> mm/dd/yy (I'm not on site, so don't know how this is happening).  So a
>user
>> may enter 3/1/2000 thinking
>> they have entered Jan 3, not knowing their computer is accepting Mar 1.

>> Instead of relying on the computer settings to remain as dd/mm/yy, I
>thought
>> I would display a textbox on the main form that said:
>> 'Enter dates in this format: dd/mm/yy' or whatever the short date format
>is.
>> Joan


>> >Can't you use Label = Format(Now(),"dd/mm/yyyy")
>> >I  have looked (briefly) at the MVPS.ORG code seg. and it does not set
>the
>> >regional settings, just reads them. And I doubt anyone would be happy
>with
>> a
>> >prog changing their regional settings. If so, code such as Label=Now()
>> would
>> >be rendered in whatever regional setting are currently set to. I always
>use
>> >the above and works fine on 98/NT/et al.



Sat, 08 Mar 2003 03:00:00 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. API Calls in Windows NT as well as Windows 95/98

2. ReadEventLog WIN32 API Call for Windows NT and VB 4.0

3. Windows NT API calls from VB

4. Calling security API in Windows NT

5. Windows API call to set windows colors (HELP Please)

6. GetPrivateProfileString call under Windows NT

7. GetPrivateProfileString call under Windows NT

8. Problem calling GetOpenFileNameA under Windows NT

9. GetPrivateProfileString call under Windows NT

10. Calling dll from Windows NT Service in VB

11. API Call from Access under NT$ problem.

12. API call failing under NT

 

 
Powered by phpBB® Forum Software