Date and Time Picker Control: set date (macro functions) Topic is solved

Get help with using AutoHotkey and its commands and hotkeys
User avatar
jeeswg
Posts: 3000
Joined: 19 Dec 2016, 01:58
Location: UK

Date and Time Picker Control: set date (macro functions)

12 Nov 2017, 15:49

I have a function to set the date of an internal/external DTP control.

According to this link you can use a macro function to achieve this.
DTM_SETSYSTEMTIME message (Windows)
https://msdn.microsoft.com/en-us/library/windows/desktop/bb761782(v=vs.85).aspx

Can you use macro functions in AutoHotkey via DllCall? If so, in which dll is the DateTime_SetSystemtime macro stored? Thanks.

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

User avatar
jeeswg
Posts: 3000
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Date and Time Picker Control: set date (macro functions)

20 Nov 2017, 16:07

I wrote some code to try to find a dll with a function called DateTime_SetSystemtime, but it didn't find one:

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus



I found that DateTime_SetSystemtime is mentioned in CommCtrl.h:

Code: [Select all] [Download] GeSHi © Codebox Plus

// BOOL DateTime_SetSystemtime(HWND hdp, DWORD gd, LPSYSTEMTIME pst)
// if gd==GDT_NONE, sets datetimepick to None (DTS_SHOWNONE only)
// if gd==GDT_VALID, sets datetimepick to *pst
// returns TRUE on success, FALSE on error (such as bad params)
#define DTM_SETSYSTEMTIME (DTM_FIRST + 2)
#define DateTime_SetSystemtime(hdp, gd, pst) (BOOL)SNDMSG(hdp, DTM_SETSYSTEMTIME, (WPARAM)(gd), (LPARAM)(pst))


I thought that perhaps RtlMoveMemory and DateTime_SetSystemtime were similar, but now I notice that one uses the word 'routine' and the other uses the word 'macro'.
RtlMoveMemory routine (Windows Drivers)
https://msdn.microsoft.com/en-us/library/windows/hardware/ff562030(v=vs.85).aspx
DateTime_SetSystemtime macro (Windows)
https://msdn.microsoft.com/en-us/library/windows/desktop/bb761813(v=vs.85).aspx

It's not important to me be able to use the DateTime_SetSystemtime macro, I can use PostMessage/SendMessage, however, I was curious as to how to use it/if it was possible to use it via DllCall, and (a bit of a long shot) curious as to whether it would allow you to deal with memory in another process without using a remote buffer.

Btw I found a RtlMoveMemory function in both kernel32.dll and ntdll.dll.

Btw also I found a reference to a macro function rather than PostMessage/SendMessage, in the AHK source code, which first got me interested in this question. When searching for messages in the source code, you may actually need to search for the macro functions instead. Plus, I've done a bit of C++, and so was curious as to how to use macro functions in C++ (the AHK source code is written in C++).
Helgef
Posts: 2478
Joined: 17 Jul 2016, 01:02
Contact:

Re: Date and Time Picker Control: set date (macro functions)  Topic is solved

20 Nov 2017, 17:17

The macro is just telling the compiler to call SendMessageA/W, with some parameters, that is, it is basically nothing but text replacement at compile time. So no, there is nothing to call via dllcall, you should just call SendMessage.

Cheers.

Edit: Similarily, RtlMoveMemory is just calling memmove.

Return to “Ask For Help”

Who is online

Users browsing this forum: Bing [Bot], Dumitas, feiyue, gregster, Xeo786 and 34 guests