HomeQuestions and AnswersArticlesSamplesLibrariesForumsNewsLinks

How to use date time picker in a Smartphone application?

By Alexander Shargin, April 02, 2002.

Question

I have inserted a date time picker control in my dialog. But when I try to create my dialog it fails. What shall I do?

Answer

When the dialog is created WIndows attempts to create all child controls for it. Each control has its own window class ("BUTTON" for button, "SysDateTimePick32" for date time picker etc.). Control's class must be registered before the control is created. To register date time picker window class, use InitCommonControlsEx function like this.

INITCOMMONCONTROLSEX comctrex; comctrex.dwSize = sizeof(comctrex); comctrex.dwICC = ICC_DATE_CLASSES; InitCommonControlsEx(&comctrex);

A good place to insert this code is at the very begining of your WinMain function.

Discuss

Discuss this QA. Here you can write your comments and read comments of other developers.

  © 2002 Smartphone Developer Network | Want to be an author? | Contact Us