wolf_II wrote:fix to work in all flavours of AHK:
Code: Select all
Set_Format := (A_IsUnicode ? 0x1032 : 0x1005) ; DTM_SETFORMAT (A/W)
NewFormat := (UserChoice ~= "/.*/" ? "dd/MM/yyyy" : "dd.MM.yyyy")
SendMessage, % Set_Format,, &NewFormat,, ahk_id %hDTM%
dear wolf
where necessary to put this code and run it;
When I double-click on Listview, it's today's date.
Can you share the code as a whole?
I'm making a mistake?
If so, as you say, should this be the case?
Code: Select all
#NoEnv
#SingleInstance, Force
Gui, Add, DateTime, x10 y+10 h20 w90 vDate1 HWNDhDTM
Gui, Add, ListView, Grid x10 w150 h170 vLV gLV, DATE1
Gui, Show, w200 h250
LV_Add("", "02/08/2018")
LV_Add("", "12/09/2002")
LV_Add("", "18.05.2007")
LV_Add("", "24.02.2013")
LV_Add("", "31/12/2011")
LV_Add("", "14.09.2018")
LV_Add("", "14/09/2018")
Return
GuiClose:
ExitApp
LV:
LV_GetText(UserChoice, LV_GetNext())
ChosenDate := SubStr(UserChoice, 7, 4) ; YYYY
. SubStr(UserChoice, 4, 2) ; MM
. SubStr(UserChoice, 1, 2) ; DD
Set_Format := (A_IsUnicode ? 0x1032 : 0x1005) ; DTM_SETFORMAT (A/W)
NewFormat := (UserChoice ~= "/.*/" ? "dd/MM/yyyy" : "dd.MM.yyyy")
SendMessage, % Set_Format,, &NewFormat,, ahk_id %hDTM%
;~ NewFormat := (UserChoice ~= "/.*/" ? "dd/MM/yyyy" : "dd.MM.yyyy")
;~ SendMessage, 0x1032, 0, &NewFormat,, ahk_id %hDTM% ; DTM_SETFORMATW
;~ GuiControl,, Date1, %ChosenDate%
Return