From: Jeremy W. <jez...@ho...> - 2003-12-01 09:29:48
|
All, I've got a couple of new methods for the datetime control that could be included in the new build. Cheers, jez. ########################################################################### # (@)METHOD:GetDateTime() # (preliminary) Returns the date and time in the DateTime control in a eight # elements array (year, month, day, dayofweek, hour, minute, second, millisecond). # Based on code from Laurent Rocher void GetDateTime(handle) HWND handle PREINIT: SYSTEMTIME st; PPCODE: if(DateTime_GetSystemtime(handle, &st) == GDT_VALID) { EXTEND(SP, 8); XST_mIV(0, st.wYear); XST_mIV(1, st.wMonth); XST_mIV(2, st.wDay); XST_mIV(3, st.wDayOfWeek); XST_mIV(4, st.wHour); XST_mIV(5, st.wMinute); XST_mIV(6, st.wSecond); XST_mIV(7, st.wMilliseconds); XSRETURN(8); } else { XSRETURN_UNDEF; } ########################################################################### # (@)METHOD:SetDateTime(YEAR,MON, DAY, HOUR, MIN, SEC, [MSEC=0]) # (preliminary) Sets the date time in the DateTime control # Based on code from Laurent Rocher BOOL SetDateTime(handle, year, mon, day, hour, min, sec, msec=0) HWND handle int year int mon int day int hour int min int sec int msec PREINIT: SYSTEMTIME st; CODE: ZeroMemory(&st, sizeof(SYSTEMTIME)); st.wYear = year; st.wDay = day; st.wMonth = mon; st.wHour = hour; st.wMinute = min; st.wSecond = sec; st.wMilliseconds = msec; RETVAL = DateTime_SetSystemtime(handle, GDT_VALID, &st); OUTPUT: RETVAL _________________________________________________________________ On the move? Get Hotmail on your mobile phone http://www.msn.co.uk/msnmobile |