What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » [?] Setting the format of a DateTimeControl

[?] Setting the format of a DateTimeControl
Author: Message:
Matti
Elite Member
*****

Avatar
Script Developer and Helper

Posts: 1646
Reputation: 39
31 / Male / Flag
Joined: Apr 2004
O.P. Huh?  [?] Setting the format of a DateTimeControl
Hey there! :)

I'm having trouble once again. :P
I'm currently trying to change the format of a DateTimeControl using the DTM_SETFORMAT message like this:
code:
var DTM_SETFORMAT = 0x1032;
Wnd.SendControlMessage('DatCDDate', DTM_SETFORMAT, 0, Language.WndSettings['DateFormat']);
where:
  • Wnd is the PlusWnd object containing the control
  • DatCDDate is the name of the DateTimeControl
  • Language.WndSettings['DateFormat'] is a string containing the new format (e.g.: "dd'/'MM'/'yyyy")
And the problem? It doesn't work. :dodgy:

Information about this message can be found on this MSDN page.

S.O.S.! :D
Plus! Script Developer | Plus! Beta Tester | Creator of Countdown Live | Co-developer of Screenshot Sender 5

Found my post useful? Rate me!
09-09-2006 06:56 PM
Profile E-Mail PM Web Find Quote Report
Eljay
Elite Member
*****

Avatar
:O

Posts: 2949
Reputation: 77
– / Male / –
Joined: May 2004
RE: [?] Setting the format of a DateTimeControl
umm the page you linked to answered it 8-)

quote:
lpszFormat
    Long pointer to a null-terminated format string...

You pass a pointer to the format string not the string itself.

So you should put the string in a databloc first and pass the pointer to that:
code:
var DTM_SETFORMAT = 0x1032;
var Format = Interop.Allocate(((Language.WndSettings['DateFormat'].length) * 2) + 2);
Format.WriteString(0, Language.WndSettings['DateFormat']);
Wnd.SendControlMessage('DatCDDate', DTM_SETFORMAT, 0, Format.DataPtr);
09-09-2006 07:37 PM
Profile PM Find Quote Report
Matti
Elite Member
*****

Avatar
Script Developer and Helper

Posts: 1646
Reputation: 39
31 / Male / Flag
Joined: Apr 2004
O.P. RE: [?] Setting the format of a DateTimeControl
Yay! I already thought about a memory block pointer, but I never tried.
Thanks, Eljay! ;)

One thing left: Why can't I use tt to display AM/PM in my control? ^o)

This post was edited on 09-10-2006 at 07:28 AM by Matti.
Plus! Script Developer | Plus! Beta Tester | Creator of Countdown Live | Co-developer of Screenshot Sender 5

Found my post useful? Rate me!
09-10-2006 07:16 AM
Profile E-Mail PM Web Find Quote Report
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On