Dynamic Update the Format of DateGadget

Just starting out? Need help? Post your questions and find answers here.
HannesH
User
User
Posts: 14
Joined: Fri Dec 09, 2011 5:54 pm

Dynamic Update the Format of DateGadget

Post by HannesH »

The DateGadget formating is automatically done when the Gadget is created and the format mask is ommited.

It matches the DATE_SHORTDATE specification of the LOCALE_USER_DEFAULT as set in the Windows configuration tool.

However, if this setting is changed, the DateGadget does keep the initial setting for the shown date.
I've read that the system sends a WM_SETTINGCHANGE on the event that setting has changed. This way
an asynchronous action to change the format of the DateGadget could be done.

The GetDateFormat_(...) API would convert my date to a string according to the system setting.
Nevertheless, the SetGadgetText function requires a "format string" and not a date string.

How can I dynamically update the formatting of the DateGadget according to the system setting LOCALE_USER_DEFAULT and DATE_SHORTDATE ?

Would SetGadgetText(#DateGadgetId,"") have a similar effect as omitting the format mask during the gadget creation?