This check can be checked using SetTime(&stValidTime) and unchecked
with SetTime(NULL). When you click it manually, the time value is NOT
changed even though "no time" is unchecked. When doing this
programmatically with SetTime() the time is reset (NULL = no time).
This yields a problem when serializing the state of the control from a
given source (like the Registry).
Q: How do you set a valid time AND uncheck the control
programmatically?
(I've tried simulating a mouse-click, but that yields weird effects.)
When the checkbox is emptied, it implies the time is not valid. So why do you care if the old
invalid time is restored from the registry?
The way to handle this, if you really must, is to find the checkbox control which is a child window
of the DTP control. Send a BM_SETCHECK message:
http://msdn.microsoft.com/en-us/library/bb775989(VS.85).aspx) with BST_UNCHECKED.
"znakeeye" <kdn0...@student.mdh.se> wrote in message
news:8fbd175b-3fff-47fa...@3g2000yqk.googlegroups.com...
Thanks for your reply. Your idea seems nice, but after playing a bit
with Spy++ I'm quite sure the checkbox is not a real checkbox window.
At least, it's not a child of the date time control!
"znakeeye" <kdn0...@student.mdh.se> wrote in message
news:9dff6cb9-fc94-4c21...@v15g2000yqn.googlegroups.com...
I haven't tried SendInput yet (I used SendMessage + WM_LBUTTON*).
SendInput might work.
It's important to show the GUI just the way the user left it. When the
application closes a valid date is set in the date control, and the
checkbox unchecked. This state must then be set when the application
is opened again.