Archive for August 2007

Force TDateTimePicker to drop down

August 30, 2007

Unfortunately there’s no message to send to TDateTimePicker which would cause it to drop down the calendar. Since the picker is designed to drop down by pressing either F4 or Alt-Down arrow, one can mimic the keypress and get the desired result with the following code:

  DateTimePicker1.Perform(WM_KEYDOWN, VK_F4, 0);
  DateTimePicker1.Perform(WM_KEYUP, VK_F4, 0);