Re: Notification of timezone change
From: Gsw.Zero (gswzero_at_hotmail.com)
Date: 03/14/04
- Next message: verbartime: "RS232"
- Previous message: Asaf Seri: "Re: Changing working directory in NT service"
- In reply to: sbrooks: "Notification of timezone change"
- Next in thread: sbrooks: "Re: Notification of timezone change"
- Reply: sbrooks: "Re: Notification of timezone change"
- Messages sorted by: [ date ] [ thread ]
Date: Sun, 14 Mar 2004 10:24:28 +0200
Either if the application is GUI or console, you can use a handler for
WM_SETTINGCHANGE message.
Of course, this has to rely on "good behavior" application(s), so if a code
sequence will call SetLocaleInfo, SetTimeZoneInformation etc. it needs also to
broadcast a message using a PostMessage(HWND_BROADCAST, WM_SETTINGCHANGE,...).
You can cache the time zone information when you start the application, and
inside the message handler to retrieve it again and compare with cached value,
and, if there are differences, do the apropriate action and update the cached
value.
>From what I know, there is no wParam indication when you change time zone:
wParam will be 0 and lParam will point to a string.
MSDN quote:
Parameters:
wParam:
....
When the system sends this message as a result of a change in locale
settings, this parameter is zero.
....
lParam
...
When the system sends this message as a result of a change in locale
settings, this parameter points to the string "intl".
...
For a console application, you may implement a "listener" thread (this is the
first solution that comes in my mind); the thread will create an invisible
window (only to receive the WM_SETTINGCHANGE message) and implement its own
message loop. When this receiver window gets the message, again you can
implement the appropriate actions (signal an event to the main thread, write to
a pipe, your IPC choice).
Note. I'm not sure if the CRT _putenv/_tzset also broadcast this system message.
Cristian Amarie
"sbrooks" <s.brooks@nospam.net> wrote in message
news:utTcEcQCEHA.1028@TK2MSFTNGP11.phx.gbl...
> Anybody know how I can (without polling) get a notification into my
> application from windows whenever the user changes his/her timezone?
>
>
- Next message: verbartime: "RS232"
- Previous message: Asaf Seri: "Re: Changing working directory in NT service"
- In reply to: sbrooks: "Notification of timezone change"
- Next in thread: sbrooks: "Re: Notification of timezone change"
- Reply: sbrooks: "Re: Notification of timezone change"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|