Thanks!
I was trying to use a pointer to do the Control Send with...

Scott
------------------
Scott
mailto:[email protected][email protected]</A>
'¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤ ' A small DDT example of how to create and use Commctrl's Calendar. ' Written by Borje Hagsten. Updated by Scott Turchin for easier formatting of output ' Public Domain = free To use And modify. ' Ideas for usage: Databases of all kinds, "Insert date" functions ' in text editors, diaries, PIMs, etc.. :-) Or setting the expiration date on an application '¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤ #Compile Exe #Include "WIN32API.INC" #Include "COMMCTRL.INC" %ID_LABEL = 10 %ID_CALENDAR = 20 Declare CallBack Function DlgCallback() Declare Function GetTimeandDate(sTime As SYSTEMTIME) As String '¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤ ' PBMAIN - build dialog and controls '¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤ Function PbMain Dim hDlg As Long Local iccex As INIT_COMMON_CONTROLSEX 'Initialize the calendar iccex.dwSize = SizeOf(iccex) iccex.dwICC = %ICC_DATE_CLASSES Call InitCommonControlsEx(iccex) Dialog New 0, "Calendar demo",,, 196, 60, %WS_SYSMENU To hDlg Control Add Label, hDlg, %ID_LABEL, "Click at the Combo's down arrow.", 6, 30, 180, 14 Control Add Button, hDlg, %IDCANCEL, "&Close", 134, 6, 50, 14 Control Add "SysDateTimePick32", hDlg, %ID_CALENDAR, "", 6, 6, 120, 14, %WS_CHILD Or _ %WS_TABSTOP Or %WS_VISIBLE Or %DTS_LONGDATEFORMAT, , Call DlgCallback 'Note: You can also use "SysMonthCal32", to get the calendar only, ' but then you also have to set the height to e.g. 100 .. :-) 'See Commctrl.inc for other useful Constants and Type structures Dialog Show Modal hDlg Call DlgCallback End Function '¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤ 'Format your output as you like '¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤ Function GetTimeandDate(sTime As SYSTEMTIME) Export As String Local tDay As Asciiz * 64 Local tTime As Asciiz * 64 GetDateFormat %LOCALE_USER_DEFAULT, %NULL, sTime, "MMM dd',' yyyy", tDay, 64 'Use this to format the date GetTimeFormat %LOCALE_SYSTEM_DEFAULT, %TIME_NOSECONDS,sTime, ByVal %NULL, tTime, 64 'Use this to format the time Function = tDay + " " + tTime End Function '¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤ ' The main callback function for all controls '¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤ CallBack Function DlgCallback() Local hdrX As NMDATETIMECHANGE Ptr, ST As SystemTime, lRet As Long Select Case CbMsg Case %WM_INITDIALOG GetLocalTime ST Incr ST.wYear Control Send CbHndl, %ID_CALENDAR, %DTM_SETSYSTEMTIME, 0, VarPtr(ST) To LRet ' Case %WM_COMMAND If CbCtl = %IDCANCEL Then Dialog End CbHndl, (CbCtl = %IDOK) Case %WM_NOTIFY 'Use this to detect changes in the calendar hdrX = CbLparam Select Case @hdrX.hdr.code Case %DTN_CLOSEUP Case %DTN_DROPDOWN Case %DTN_DATETIMECHANGE 'Get selected date/time If @hdrx.dwFlags <> %GDT_VALID Then Exit Function 'Trust but verify SYSTEMTIME STRUCTURE Control Set Text CbHndl, %ID_LABEL, "Selected Date: " & GetTimeandDate(@hdrX.st) End Select End Select End Function '¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤ ' The End '¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
We process personal data about users of our site, through the use of cookies and other technologies, to deliver our services, and to analyze site activity. For additional details, refer to our Privacy Policy.
By clicking "I AGREE" below, you agree to our Privacy Policy and our personal data processing and cookie practices as described therein. You also acknowledge that this forum may be hosted outside your country and you consent to the collection, storage, and processing of your data in the country where this forum is hosted.
Leave a comment: