Re: Notification of timezone change

From: Gsw.Zero (gswzero_at_hotmail.com)
Date: 03/14/04


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?
>
>



Relevant Pages

  • Re: Setting Console Window Properties
    ... window and save settings, there will be subkey under that registry key. ... the console will then use default settings from parent key. ...
    (microsoft.public.windowsxp.general)
  • Re: SDI resource dialog from menu - dumb newbie question
    ... If you mean launch a modeless dialog, the easiest way is to, well, add a menu handler! ... void CMyView::LaunchControlPanel ... so you don't have to keep saving and reloading settings when you "dismiss" the window. ...
    (microsoft.public.vc.mfc)
  • RE: console application question
    ... It only happens on debug mode.. ... Just place this line of code at the end of your console app ... Are there some settings that let the window stay there after ... but I can't find any settings about ...
    (microsoft.public.vsnet.ide)
  • Re: console fonts- How to increase size?
    ... >> When I boot to 'console' mode the fonts are small. ... >> Is there a way to increse the font size? ... > terminal and changing the font in Window Settings by selecting 'Display' ... > in the top settings of the terminal inspector. ...
    (comp.sys.mac.misc)
  • Re: working set and console applications
    ... I created a windows application and then I created a child console process ... that I started from the parent process using CreateProcess. ... I minimize the child console window it also causes the working set of the ...
    (microsoft.public.win32.programmer.kernel)