Has anyone got any example code using this control? I would even take someone's opinion on which tutorial/demo would be the closest and get me going in the right direction.:) Any help would be very much appreciated. Thanks, Onyx
Posted on 2001-01-11 13:56:00 by Onyx
Two things to try: 1.) Look for a C++ example and translate the code 2.) Start with a dialog (You can place the control in the dialog) I'm sure it will be driven by sending it windows messages and you'll recieve a WM_NOTIFY message when it changes (This is just a guess, but that'd be the most likely possibility, like the listview control and all that series) See ya, Ben
Posted on 2001-01-11 20:44:00 by cyberben
Take a peek at: http://msdn.microsoft.com/library/psdk/shellcc/commctls/DateTime/DateTime.htm
Posted on 2001-01-11 23:03:00 by Ernie
I wrote a replacement for my $12 wristwatch using my $2000 PC which performs the following: 1) Alarm Function - Set date and time for alarm to go off, you can also designate a .WAV file to play as the alarm 2) Stop Watch - with primitive lap functions. 3) Countdown timer - with ability to have the timer repeat after counting down. 1) uses the date time picker control to set the alarm function and -seems- to work. I wrote this as my second WIN32 assembly language project and give thanks to: Steve Gibson for providing original encouragement to try MASM32; Hutch for providing MASM32 ; Iczelion for the tutorials which provided the light to help with my initial--and continuing--darkness. I would be willing to provide the source code to be posted somewhere, instead of sending it via email. Can I post it to Iczeion's site if there is enough interest? Again thanks for all the enthusiastic help! Joe
Posted on 2001-01-12 09:11:00 by farrier
Here are the relevant portions of my program that have to do with the DateTimePicker Control: The lines will wrap and may be hard to read. Any questions? Let me know. Joe ;**************************************** ;From rsrc.rc file ;**************************************** #define IDC_START_DATE 3004 MyDialog DIALOG 10, 10, 190, 115 STYLE 0x0004 | DS_CENTER | WS_CAPTION | WS_MINIMIZEBOX | WS_SYSMENU | WS_VISIBLE | WS_OVERLAPPED | DS_MODALFRAME | DS_3DLOOK CAPTION "Joe's Alarm/Countdown Timer!" FONT 8, "MS Sans Serif" BEGIN CONTROL "Alarm Time/Date:",65535,"STATIC",WS_VISIBLE,27,70,57,8 CONTROL "DateTimePicker1",IDC_START_DATE,"SysDateTimePick32", DTS_RIGHTALIGN | WS_TABSTOP ,7,82,115,15 END ;**************************************** ;From .asm file ;**************************************** include \masm32\include\comctl32.inc ;For DateTimePicker includelib \masm32\lib\comctl32.lib IDC_START_DATE equ 3004 ;identifier for alram time/date button .DATA lib_name db "C:\WINDOWS\SYSTEM\comctl32.dll", 0 ;library for DateTimePicker dgv db "DllGetVersion", 0 ;function to check version of DLL lib_err db "This Program Requires Version 4.70 of COMCTL32.DLL!", 0 ;warning message DateFormat db "hh':'mm' 'tt' 'ddd' 'dd' 'MMMM' 'yyyy", 0 ;Format for Time/Date in DateTimePicker .DATA? lib_handle HWND ? ;Handle to check for dll version sdc_handle HWND ? ;Hanlde for startdate control window system_time SYSTEMTIME <> ;used to gather current time alarm_time FILETIME <> ;used to keep next alarm time time_now FILETIME <> ;used to gather current time tseconds FILETIME <> ;used to store seconds left till alarm icex INITCOMMONCONTROLSEX <> ;structure for DateTimePicker dvi DLLVERSIONINFO <> ;Structure for Dll Version Info proc_add DWORD ? ;used to store address for DLL .CODE invoke LoadLibrary, ADDR lib_name ;Load comctl32.dll to see if we have at least version 4.70 mov lib_handle, eax ;save handle .IF( eax==NULL ) ;no valid handle returned invoke MessageBox, NULL, ADDR lib_err, NULL, MB_OK ret .ENDIF invoke GetProcAddress, lib_handle, ADDR dgv ;get address of DllGetVersion within comctl32.dll mov proc_add, eax .IF( eax==NULL ) ;no valid address to Proc returned invoke MessageBox, NULL, ADDR lib_err, NULL, MB_OK ret .ENDIF invoke RtlZeroMemory, ADDR dvi, SIZEOF DLLVERSIONINFO ;set DLLVERSIONINFO Stru to zeroes mov dvi.cbSize, SIZEOF DLLVERSIONINFO push OFFSET dvi ;push structure address for DLLGetVersion call proc_add ;call COMCTL32.DLL's DllGetVersion routine cmp dvi.dwMajorVersion, 4 ;major version should be at least 4 jae @F invoke MessageBox, NULL, ADDR lib_err, NULL, MB_OK ret @@: cmp dvi.dwMinorVersion, 70 ;minor version should be at least 70 jae @F invoke MessageBox, NULL, ADDR lib_err, NULL, MB_OK ret @@: mov icex.dwSize, SIZEOF INITCOMMONCONTROLSEX ;prepare common control structure mov icex.dwICC, ICC_DATE_CLASSES invoke InitCommonControlsEx, ADDR icex ;initialize common controls for DateTimePicker invoke GetDlgItem, hWnd, IDC_START_DATE ;DateTimePicker Control mov sdc_handle, eax invoke SendMessage, sdc_handle, DTM_SETFORMAT, NULL, ADDR DateFormat ;set format of DateTime control to string in DateFormat ;************************************** ;Segment where control is updated with current time when control gets focus ; .elseif iMsg==WM_NOTIFY MOV EAX,lParam ; lParam is a pointer to a NMHDR Struct MOV EAX, (NMHDR PTR ).code ; is the c
Posted on 2001-01-12 12:17:00 by farrier