Jump to content

Recommended Posts

Posted

Hi,

When I run the following date control example from the help file using AutoIt 3.2.3.14, the date does not display in the specified format. On my PC, it just shows "1953" in the date control.

#include <GUIConstants.au3>

GUICreate ( "My GUI get date", 200,200,800,200)
$date = GUICtrlCreateDate ("1953/04/25", 10,10,185,20 )

; to select a specific default format
$DTM_SETFORMAT = 0x1005
$style = "yyyy/MM/dd HH:mm:s"
GuiCtrlSendMsg($date, $DTM_SETFORMAT, 0, $style)

GuiSetState()
While GuiGetMsg() <> $GUI_EVENT_CLOSE
WEnd

MsgBox(0,"Time", GUICtrlRead($date))

Does anyone else have the same problem?

Regards,

Jonny

Posted

I have just tried the help file example with the latest beta (v3.2.4.0), and the same thing happens.

Please could someone test this. Thanks.

Regards,

Jonny

Posted

Works fine at my. I have Win 2000.

i542

Thanks for testing it.

I am still having the problem on both Windows 2000 and Windows XP. It happened when I moved from AutoIt 3.2.3.2 to 3.2.3.14. If I go back to 3.2.3.2, the problem goes away.

Regards,

Jonny

Posted

The problem is with GUICtrlSendMsg. If I send the $DTM_SETFORMAT message using DllCall and the SendMessage API function, then it works.

Solution:

#include <GUIConstants.au3>

$form = GUICreate ( "My GUI get date", 200,200,800,200)
$date = GUICtrlCreateDate ("1953/04/25", 10,10,185,20 )

; to select a specific default format
$DTM_SETFORMAT = 0x1005
$style = "yyyy/MM/dd HH:mm:s"
DllCall("user32.dll", _
        "int", "SendMessage", _
        "hwnd", ControlGetHandle($form, "", $date), _
        "int", $DTM_SETFORMAT, _
        "int", 0, _
        "str", $style)

GuiSetState()
While GuiGetMsg() <> $GUI_EVENT_CLOSE
WEnd

Regards,

Jonny

Posted

The problem is with GUICtrlSendMsg. If I send the $DTM_SETFORMAT message using DllCall and the SendMessage API function, then it works.

Solution:

#include <GUIConstants.au3>

$form = GUICreate ( "My GUI get date", 200,200,800,200)
$date = GUICtrlCreateDate ("1953/04/25", 10,10,185,20 )

; to select a specific default format
$DTM_SETFORMAT = 0x1005
$style = "yyyy/MM/dd HH:mm:s"
DllCall("user32.dll", _
        "int", "SendMessage", _
        "hwnd", ControlGetHandle($form, "", $date), _
        "int", $DTM_SETFORMAT, _
        "int", 0, _
        "str", $style)

GuiSetState()
While GuiGetMsg() <> $GUI_EVENT_CLOSE
WEnd

Regards,

Jonny

Yes, looks like a bug. Have you tried reporting it?
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
  • 2 weeks later...
Posted

As I wrote in the bug-forum.

Use the unicode function value then you will be happy:

#include <GUIConstants.au3>

GUICreate ( "My GUI get date", 200,200,800,200)
$date = GUICtrlCreateDate ("1953/04/25", 10,10,185,20 )

; to select a specific default format
$DTM_SETFORMATW = 0x1032
$style = "yyyy/MM/dd HH:mm:s"
GuiCtrlSendMsg($date, $DTM_SETFORMATW, 0, $style)

GuiSetState()
While GuiGetMsg() <> $GUI_EVENT_CLOSE
WEnd

MsgBox(0,"Time", GUICtrlRead($date))

Maybe the most forgot that from beta version 3.2.3.3 on the default Autoit.exe is compiled in unicode...

  • Administrators
Posted

This works fine on unicode and ansi versions.

#include <GUIConstants.au3>

If @UNICODE Then
 const $DTM_SETFORMAT = 0x1032
Else
 const $DTM_SETFORMAT = 0x1005
Endif

GUICreate ( "My GUI get date", 200,200,800,200)
$date = GUICtrlCreateDate ("1953/04/25", 10,10,185,20 )

$style = "yyyy/MM/dd HH:mm:s"
GuiCtrlSendMsg($date, $DTM_SETFORMAT, 0, $style)

GuiSetState()
While GuiGetMsg() <> $GUI_EVENT_CLOSE
WEnd

MsgBox(0,"Time", GUICtrlRead($date))


 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...