msdn:Date and time picker controls are implemented in version 4.70 and later of Comctl32.dll. To create a DTP control call CreateWindowEx and specify DATETIMEPICK_CLASS as the window class. The class is registered when the date and time picker class is loaded from the common control dynamic-link library (DLL). Register this class by calling the InitCommonControlsEx function, while specifying the ICC_DATE_CLASSES bit flag in the accompanying INITCOMMONCONTROLSEX structure.
///////////////////////////////////
HWND WINAPI CreateDatePick(hwndMain)
{
HWND hwndDP = NULL;
HWND hwndDlg = NULL;
INITCOMMONCONTROLSEX icex; icex.dwSize = sizeof(icex);
icex.dwICC = ICC_DATE_CLASSES; InitCommonControlsEx(&icex); hwndDlg = CreateDialog (g_hinst,
MAKEINTRESOURCE(IDD_DIALOG1),
hwndMain,
DlgProc); if(hwnDlg)
hwndDP = CreateWindowEx(0,
DATETIMEPICK_CLASS,
"DateTime",
WS_BORDER|WS_CHILD|WS_VISIBLE|DTS_SHOWNONE,
20,50,220,20,
hwndDlg,
NULL,
g_hinst,
NULL);
return (hwndDP);
}
///////////////////////////////////
HWND WINAPI CreateDatePick(hwndMain)
{
HWND hwndDP = NULL;
HWND hwndDlg = NULL;
INITCOMMONCONTROLSEX icex; icex.dwSize = sizeof(icex);
icex.dwICC = ICC_DATE_CLASSES; InitCommonControlsEx(&icex); hwndDlg = CreateDialog (g_hinst,
MAKEINTRESOURCE(IDD_DIALOG1),
hwndMain,
DlgProc); if(hwnDlg)
hwndDP = CreateWindowEx(0,
DATETIMEPICK_CLASS,
"DateTime",
WS_BORDER|WS_CHILD|WS_VISIBLE|DTS_SHOWNONE,
20,50,220,20,
hwndDlg,
NULL,
g_hinst,
NULL);
return (hwndDP);
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货