• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ COleDateTime函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中COleDateTime函数的典型用法代码示例。如果您正苦于以下问题:C++ COleDateTime函数的具体用法?C++ COleDateTime怎么用?C++ COleDateTime使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了COleDateTime函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: dt

void CBCGPRecurrenceRuleYearly::CorrectStart ()
{
	COleDateTime dt (GetDateStart ());

	int y = dt.GetYear ();
	int m = m_Type == BCGP_REC_RULE_YEARLY_TYPE_DAY ? m_dwDayMonth : m_dwDayTypeMonth;
	int d = GetPossibleDay (y);

	int nDays = CBCGPCalendar::GetMaxMonthDay (m, y);

	dt = COleDateTime (y, m, nDays < d ? nDays : d, 0, 0, 0);

	if (dt < GetDateStart ())
	{
		y++;
		
		d = GetPossibleDay (y);
		nDays = CBCGPCalendar::GetMaxMonthDay (m, y);

		dt = COleDateTime (y, m, nDays < d ? nDays : d, 0, 0, 0);
	}

	if (dt != GetDateStart ())
	{
		SetDateStart (dt);
	}
}
开发者ID:cugxiangzhenwei,项目名称:WorkPlatForm,代码行数:27,代码来源:BCGPRecurrenceRules.cpp


示例2: ASSERT

DWORD COXDateTimeCtrl::GetRange(COleDateTime* pMinTime,
								COleDateTime* pMaxTime) const
{
#if _MFC_VER<=0x0421
	ASSERT(::IsWindow(m_hWnd));

	SYSTEMTIME sysTimes[2];
	memset(sysTimes, 0, sizeof(sysTimes));

	DWORD dwResult = ::SendMessage(m_hWnd, DTM_GETRANGE, 0, (LPARAM) &sysTimes);
	if (pMinTime != NULL)
	{
		if (dwResult & GDTR_MIN)
			*pMinTime = COleDateTime(sysTimes[0]);
		else
			pMinTime->SetStatus(COleDateTime::null);
	}

	if (pMaxTime != NULL)
	{
		if (dwResult & GDTR_MAX)
			*pMaxTime = COleDateTime(sysTimes[1]);
		else
			pMaxTime->SetStatus(COleDateTime::null);
	}

	return dwResult;
#else
	return CDateTimeCtrl::GetRange(pMinTime,pMaxTime);
#endif	//	_MFC_VER>0x0421
}
开发者ID:Spritutu,项目名称:AiPI-1,代码行数:31,代码来源:OXDateTimeCtrl.cpp


示例3: GetSystemLanguagePrimaryID

BOOL CCalendarDateDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
/*	
	LANGID dwLanguageID = GetSystemLanguagePrimaryID();
	switch( dwLanguageID)
	{
	case LANG_SPANISH:
		CWnd::SetWindowText(_T("Cuadro de selección"));
		GetDlgItem(IDC_STATIC_PICKDATE)->SetWindowText(_T("Seleccione una fecha:"));
		GetDlgItem(IDOK)->SetWindowText(_T("Aceptar"));
		GetDlgItem(IDCANCEL)->SetWindowText(_T("Cancelar"));
		break;
	default:
		CWnd::SetWindowText(_T("Selection dialog"));
		GetDlgItem(IDC_STATIC_PICKDATE)->SetWindowText(_T("Select a date:"));
		GetDlgItem(IDOK)->SetWindowText(_T("OK"));
		GetDlgItem(IDCANCEL)->SetWindowText(_T("Cancel"));
		break;
	}

*/	
	// TODO: Add extra initialization here
	COleDateTime DateMin = COleDateTime(2000,1,1,0,0,0);
	COleDateTime DateMax = COleDateTime(2035,12,31,0,0,0);
	m_DateCtrl.SetRange(&DateMin, &DateMax);
	m_DateCtrl.SetFocus();
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
开发者ID:malpharo,项目名称:AiPI,代码行数:31,代码来源:CalendarDlg.cpp


示例4: ASSERT

DWORD CDateTimeCtrl::GetRange(COleDateTime* pMinTime,
                              COleDateTime* pMaxTime) const
{
    ASSERT(::IsWindow(m_hWnd));

    SYSTEMTIME sysTimes[2];
    memset(sysTimes, 0, sizeof(sysTimes));

    //IA64: Assume retval of DTM_GETRANGE is still 32-bit
    DWORD dwResult = DWORD(::SendMessage(m_hWnd, DTM_GETRANGE, 0, (LPARAM) sysTimes));
    if (pMinTime != NULL)
    {
        if (dwResult & GDTR_MIN)
            *pMinTime = COleDateTime(sysTimes[0]);
        else
            pMinTime->SetStatus(COleDateTime::null);
    }

    if (pMaxTime != NULL)
    {
        if (dwResult & GDTR_MAX)
            *pMaxTime = COleDateTime(sysTimes[1]);
        else
            pMaxTime->SetStatus(COleDateTime::null);
    }

    return dwResult;
}
开发者ID:pixelspark,项目名称:corespark,代码行数:28,代码来源:winctrl5.cpp


示例5: ASSERT_VALID

void CBCGPPlannerViewWorkWeek::OnActivate(CBCGPPlannerManagerCtrl* pPlanner, const CBCGPPlannerView* pOldView)
{
	ASSERT_VALID(pPlanner);

	if (pOldView != NULL)
	{
		m_Date = pOldView->GetDate ();
	}

	m_DateStart = CalculateDateStart (
		COleDateTime(m_Date.GetYear (), m_Date.GetMonth (), m_Date.GetDay (), 0, 0, 0));
	m_DateEnd   = m_DateStart + COleDateTimeSpan (pPlanner->GetWorkWeekInterval () - 1, 23, 59, 59);

	COleDateTime sel1 (m_Date);
	COleDateTime sel2 (m_Date);

	if (pOldView != NULL)
	{
		sel1 = pOldView->GetSelectionStart ();
		sel2 = pOldView->GetSelectionEnd ();
	}

	const int nMinuts = CBCGPPlannerView::GetTimeDeltaInMinuts (pPlanner->GetTimeDelta ());

	sel1 = COleDateTime (m_DateStart.GetYear (), m_DateStart.GetMonth (), m_DateStart.GetDay (),
		pPlanner->GetFirstSelectionHour (), (int)(pPlanner->GetFirstSelectionMinute () / nMinuts) * nMinuts, 0);
	sel2 = sel1 + COleDateTimeSpan (0, 0, nMinuts - 1, 59);

	//SetSelection (sel1, sel2, FALSE);

	CBCGPPlannerView::OnActivate (pPlanner, NULL);

	SetSelection (sel1, sel2);
}
开发者ID:iclosure,项目名称:jframework,代码行数:34,代码来源:BCGPPlannerViewWorkWeek.cpp


示例6: COleDateTime

CBCGPDateTimeCtrl::CBCGPDateTimeCtrl()
{
	m_checkButton = TRUE;
	m_dropCalendar = TRUE;
	m_showDate = TRUE;
	m_showTime = TRUE;
	m_spinButton = TRUE;

	m_type2DigitsInYear = TRUE;
	m_maxYear2Digits = 2090;

	m_bCheckBoxIsAvailable = FALSE;
	m_iPartNum = 0;
	m_iPartsNumber = 0;
	m_bIsChecked = TRUE;
	m_Date = COleDateTime::GetCurrentTime ();
	m_iPrevDigit = -1;

	m_rectText.SetRectEmpty ();

	m_bShowSelection = FALSE;
	m_bDropButtonIsPressed = FALSE;

	m_pPopup = NULL;

	m_bDropButtonIsPressed = FALSE;
	m_bMouseOnDropButton = FALSE;

	for (int i = 0; i < MAX_PARTS; i ++)
	{
		m_arPartRects [i].SetRectEmpty ();
	}

	m_rectText.SetRectEmpty ();
	m_bAutoResize = TRUE;

	m_iControlWidth = 0;
	m_iControlHeight = 0;

	m_iYearPos = 0;
	m_monthFormat = 0;

	m_MinDate = COleDateTime (iFirstAllowedYear, 1, 1, 0, 0, 0);
	m_MaxDate = COleDateTime (iLastAllowedYear, 12, 31, 23, 59, 59);

	m_weekStart = 1;
	m_b24HoursByLocale = TRUE;

	m_hFont	= NULL;
	m_bIsInitialized = FALSE;

	m_bDrawDateTimeOnly = FALSE;

	m_colorText = (COLORREF)-1;
	m_colorBackground = (COLORREF)-1;
}
开发者ID:cugxiangzhenwei,项目名称:WorkPlatForm,代码行数:56,代码来源:BCGPDateTimeCtrl.cpp


示例7: CDialogEx

CDlgStock::CDlgStock(CWnd* pParent /*=NULL*/)
	: CDialogEx(IDD_DIALOG1, pParent)
{
	m_strMarket = _T("SZ");
	m_strLable = _T("000002");
	m_Cycle = STKCYCLE::DAY;
	m_bCumDividendPrice = TRUE;
	m_Time.start = COleDateTime(2004, 5, 19, 0, 0, 0);
	m_Time.end = COleDateTime(2004, 5, 31, 23, 59, 59);
}
开发者ID:houguozhi,项目名称:FortuneIt,代码行数:10,代码来源:DlgStock.cpp


示例8: switch

COleDateTime	CDBField::AsDate()	const
{
	COleDateTime	date;
	if( IsNull() ) {
		date.SetStatus( COleDateTime::null );
		return	date;
	}

	switch( m_dwType ) {
	case	DBVT_NULL:
			date.SetStatus( COleDateTime::null );
			return	date;

	case	DBVT_BOOL:
			date.SetStatus( COleDateTime::invalid );
			return	date;

	case	DBVT_UCHAR:
			date.SetStatus( COleDateTime::invalid );
			return	date;

	case	DBVT_SHORT:
			return	COleDateTime( (time_t)m_iVal );

	case	DBVT_LONG:
			return	COleDateTime( (time_t)m_lVal );

	case	DBVT_SINGLE:
			return	COleDateTime( (time_t)m_fltVal );

	case	DBVT_DOUBLE:
			return	COleDateTime( (time_t)m_dblVal );

	case	DBVT_DATE:
			ASSERT( m_pdate != NULL );
			return	COleDateTime(	m_pdate->year, m_pdate->month, m_pdate->day,
									m_pdate->hour, m_pdate->minute, m_pdate->second );

	case	DBVT_STRING:
			ASSERT( m_pstring != NULL );
			date.ParseDateTime( *m_pstring );
			return	date;

	case	DBVT_BINARY:
			//	Cannot conver long binary to date
			ASSERT( FALSE );
			break;
	}
	//	Undefined data type
	ASSERT( FALSE );
	date.SetStatus( COleDateTime::invalid );
	return	date;
}
开发者ID:open2cerp,项目名称:Open2C-ERP,代码行数:53,代码来源:ODBCRecordset.cpp


示例9: Time2AdjustedDate

// ///////////////////////////////////////////////////////////////////////////
//
COleDateTime Time2AdjustedDate( const CString& sTime, const COleDateTime& startDate )
{
	int hr,min;
	String2HourMin(sTime, hr, min);

	// If the given time is before the startDate's time, then the target date is one day further
	//
	if ((hr < startDate.GetHour()) || ((hr == startDate.GetHour()) && (min < startDate.GetMinute())))
	{
		COleDateTime dt = startDate + COleDateTimeSpan(1,0,0,0);
		return COleDateTime(dt.GetYear(), dt.GetMonth(), dt.GetDay(), hr, min, 0);
	}

	return COleDateTime(startDate.GetYear(), startDate.GetMonth(), startDate.GetDay(), hr, min, 0);
}
开发者ID:lbrucher,项目名称:timelis,代码行数:17,代码来源:Utils.cpp


示例10: ASSERT

//*****************************************************************************************
void CBCGPDateTimeCtrl::ChangeMonth (UINT uiMonthLetter)
{
	ASSERT (m_monthFormat == 0 || m_monthFormat == 1);

	CBCGPDefaultLocale dl;

	int iDay = m_Date.GetDay ();
	int iMonth = m_Date.GetMonth ();
	int iYear = m_Date.GetYear ();
	int iHour = m_Date.GetHour ();
	int iMin = m_Date.GetMinute ();

	BOOL bLastDayInMonth = (iDay == GetDaysInMonth (iMonth, iYear));

	BOOL bFound = FALSE;
	for (int i = iMonth + 1; i != iMonth; i ++)
	{
		if (i > 12)
		{
			i = 1;
		}

		if (i == iMonth)
		{
			break;
		}

		//--------------------------------------------------
		// Compare manth 'i' first char with the typed char:
		//--------------------------------------------------
		CString strMonth = COleDateTime (iYear, i, 1, 0, 0, 0).
			Format (m_monthFormat == 0 ? _T ("%b") : _T ("%B"));

		if (strMonth.GetLength () > 1 &&
			strMonth.GetAt (0) == (char) uiMonthLetter)
		{
			iMonth = i;
			bFound = TRUE;
			break;
		}
	}

	if (bFound)
	{
		if (bLastDayInMonth ||
			iDay > GetDaysInMonth (iMonth, iYear))
		{
			iDay = GetDaysInMonth (iMonth, iYear);
		}

		COleDateTime date (iYear, iMonth, iDay, iHour, iMin, 0);
		if (IsDateValid (date))
		{
			m_Date = date;
			RedrawWindow (m_rectText);

			OnDateChanged ();
		}
	}
}
开发者ID:cugxiangzhenwei,项目名称:WorkPlatForm,代码行数:61,代码来源:BCGPDateTimeCtrl.cpp


示例11: COleDateTime

void CWizKbSync::onAttachmentsGetInfo(const std::deque<WIZDOCUMENTATTACHMENTDATAEX>& arrayRet)
{
    size_t count = arrayRet.size();

    // new attachment
    if (count == 0) {
        WIZDOCUMENTATTACHMENTDATA data;
        data.strGUID = m_currentUploadAttachment.strGUID;
        data.strDocumentGUID = m_currentUploadAttachment.strDocumentGUID;
        data.strName = m_currentUploadAttachment.strName;
        data.tInfoModified = COleDateTime(1900, 1, 1, 0, 0, 0);
        data.tDataModified = data.tInfoModified;
        data.strInfoMD5 = "-1";
        data.strDataMD5 = "-1";

        onQueryAttachmentInfo(data);

    // server return exist
    } else if (count == 1) {
        onQueryAttachmentInfo(arrayRet[0]);

    // fatal error
    } else {
        Q_EMIT processErrorLog("Can not query document info");
        onXmlRpcError(SyncMethod_GetDocumentsInfo, errorXmlRpcFault, -1, "Fault error: Invalid document info");
    }
}
开发者ID:Mybrc91,项目名称:WizQTClient,代码行数:27,代码来源:wizKbSync.cpp


示例12: COleDateTime

// NOTE: Windows SCM more tolerant of slow starting processes than terminating processes.
void MtcOpcAdapter::start()
{
 	static char name[] = "MtcOpcAdapter::start";
	_bRunning=true; 
	if(_bResetAtMidnight)
	{
		COleDateTime now = COleDateTime::GetCurrentTime();
		COleDateTime date2 =  COleDateTime(now.GetYear(), now.GetMonth(), now.GetDay(), 0, 0, 0) +  COleDateTimeSpan(1, 0, 0, 1);
		//COleDateTime date2 =  now +  COleDateTimeSpan(0, 0, 2, 0); // testing reset time - 2 minutes

		COleDateTimeSpan tilmidnight = date2-now;
		_resetthread.Initialize();
		_resetthread.AddTimer(
			(long) tilmidnight.GetTotalSeconds() * 1000,
			&_ResetThread,
			(DWORD_PTR) this,
			&_ResetThread._hTimer  // stored newly created timer handle
			) ;

		GLogger << INFO << "Adapter will Reset At Midnight " << date2.Format() << std::endl;
	}

	if(_bOPCEnabled)
	{
		_workerthread.Initialize();
		::SetEvent (_StartThread._hEvent); // start OPC thread
		_workerthread.AddHandle(_StartThread._hEvent, &_StartThread,(DWORD_PTR) this);
	}

	// This goes last... never returns
	startServer();
}
开发者ID:CubeSpawn-Research,项目名称:MTConnectToolbox,代码行数:33,代码来源:MtcOpcAdapter.cpp


示例13: ASSERT_VALID

void CBCGPPlannerViewMonth::OnActivate(CBCGPPlannerManagerCtrl* pPlanner, const CBCGPPlannerView* pOldView)
{
	ASSERT_VALID(pPlanner);

	if (pOldView != NULL)
	{
		m_Date = pOldView->GetDate ();
	}

	m_nDuration = 35;
	m_DateStart = CalculateDateStart (
		COleDateTime(m_Date.GetYear (), m_Date.GetMonth (), m_Date.GetDay (), 0, 0, 0));
	m_DateEnd   = m_DateStart + COleDateTimeSpan (m_nDuration - 1, 23, 59, 59);

	if (m_Date > m_DateEnd || m_Date < m_DateStart)
	{
		m_Date = m_DateStart;
	}

	COleDateTime sel1 (m_Date);
	COleDateTime sel2 (m_Date);

	if (pOldView != NULL)
	{
		sel1 = pOldView->GetSelectionStart ();
		sel2 = pOldView->GetSelectionEnd ();
	}

	SetSelection (sel1, sel2, FALSE);

	CBCGPPlannerView::OnActivate (pPlanner, NULL);
}
开发者ID:cugxiangzhenwei,项目名称:WorkPlatForm,代码行数:32,代码来源:BCGPPlannerViewMonth.cpp


示例14: dlg

// ////////////////////////////////////////////////////////////////////////////
//
void CDlgEvents::OnModify() 
{
	int n = m_Events.GetCurSel();
	if (n == -1)
		return;

	long id = (long) m_Events.GetItemData(n);

	CRecEvent rec;
	if (! rec.FindByID(id) )
		return;

	CDlgEditEvent dlg(this);

	SYSTEMTIME st;
	rec.m_trigger.GetAsSystemTime(st);
	dlg.m_Date = CTime(st);
	dlg.m_Time = CTime(st);
	dlg.m_Text = rec.m_text;

	if ( dlg.DoModal() != IDOK )
		return;

	rec.FindByID(id);
	rec.Edit();
	rec.m_time = COleDateTime( dlg.m_Date.GetYear(), dlg.m_Date.GetMonth(), dlg.m_Date.GetDay(),
							   dlg.m_Time.GetHour(), dlg.m_Time.GetMinute(), dlg.m_Time.GetSecond() );
	rec.m_trigger = rec.m_time;
	rec.m_text = dlg.m_Text;
	rec.m_fired = FALSE;
	rec.Update();

	refreshList();
}
开发者ID:lbrucher,项目名称:timelis,代码行数:36,代码来源:DlgEvents.cpp


示例15: SetTimeOfDate

// ///////////////////////////////////////////////////////////////////////////
// Build a new date object  by copying the given date object and replacing
// its time by the given one
//
COleDateTime SetTimeOfDate( const COleDateTime& date, const CString& sTime )
{
	int hr,min;
	String2HourMin(sTime, hr, min);

	return COleDateTime(date.GetYear(), date.GetMonth(), date.GetDay(), hr, min, 0);
}
开发者ID:lbrucher,项目名称:timelis,代码行数:11,代码来源:Utils.cpp


示例16: COleDateTime

COleDateTime COXCalendarEdit::GetDateFromString(LPCTSTR lpszDateString)
{
	CString strDate = lpszDateString;

	// First get the year

	// 1. Find where the year starts and where it ends
	int iYearStartIdx = m_strDateFormat.Find('Y');
	int iYearEndIdx = m_strDateFormat.ReverseFind('Y');
	CString strYearOnly = strDate.Mid(iYearStartIdx, iYearEndIdx - iYearStartIdx + 1);
	int iYear = ::_ttoi(strYearOnly);

	// 2. Find where the month starts and where it ends
	int iMonthStartIdx = m_strDateFormat.Find('M');
	int iMonthEndIdx = m_strDateFormat.ReverseFind('M');
	CString strMonthOnly = strDate.Mid(iMonthStartIdx, iMonthEndIdx - iMonthStartIdx + 1);
	int iMonth = ::_ttoi(strMonthOnly);

	// 3. Find where the day starts and where it ends
	int iDayStartIdx = m_strDateFormat.Find('D');
	int iDayEndIdx = m_strDateFormat.ReverseFind('D');
	CString strDayOnly = strDate.Mid(iDayStartIdx, iDayEndIdx - iDayStartIdx + 1);
	int iDay = ::_ttoi(strDayOnly);

	return COleDateTime(iYear, iMonth, iDay, 0, 0, 0);
}
开发者ID:Spritutu,项目名称:AiPI-1,代码行数:26,代码来源:OXCalendarEdit.cpp


示例17: ASSERT_VALID

//****************************************************************************************
void CBCGPDateTimeCtrl::BuidWidestDate (CDC* pDC)
{
	ASSERT_VALID (pDC);

	CBCGPDefaultLocale dl;

	//-----------------------
	// Find the widest month:
	//-----------------------
	int iMaxMonth = 1;

	if (m_monthFormat == 2)	// Numeric
	{
		iMaxMonth = 9;
	}
	else
	{
		int iMaxMonthWidth = 0;
		for (int iMonth = 1; iMonth <= 12; iMonth ++)
		{
			COleDateTime date (1998, iMonth, 1, 0, 0, 0);
			CString strMonth = date.Format (m_monthFormat == 0 ? _T ("%b") : _T("%B"));

			int iMonthWidth = pDC->GetTextExtent (strMonth).cx;
			if (iMonthWidth > iMaxMonthWidth)
			{
				iMaxMonthWidth = iMonthWidth;
				iMaxMonth = iMonth;
			}
		}
	}

	m_WidestDate = COleDateTime (2000, iMaxMonth, 20, 0, 0, 0);
}
开发者ID:cugxiangzhenwei,项目名称:WorkPlatForm,代码行数:35,代码来源:BCGPDateTimeCtrl.cpp


示例18: CSysImageList

int CRemoteFileDialog::AddFileItem(LPCTSTR szFileName, int nType, UINT nUniqueID, DWORD dwFileSize,
	const FILETIME* pLastMod, int nImage)
{
	if (nImage == -1)
	{
		nImage = CSysImageList().GetFileImageIndex(szFileName);
	}

	int nItem = m_lcFiles.InsertItem(LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM, 0, szFileName, 0, 0, nImage, nUniqueID);

	// add to map
	FILEITEM fi;
	fi.sFilename = szFileName;
	fi.nType = nType;
	fi.dwSize = dwFileSize;

	if (pLastMod)
	{
		FILETIME ftLocal;
		FileTimeToLocalFileTime(pLastMod, &ftLocal);

		fi.dLastMod = COleDateTime(ftLocal);
	}

	m_mapItems[nUniqueID] = fi;

	// add size and date item if a file
	if (nType == RFDT_FILE && m_bInitReport)
	{
		m_lcFiles.SetItemText(nItem, 1, FormatSize(fi.dwSize));
		m_lcFiles.SetItemText(nItem, 2, FormatDate(fi.dLastMod));
	}

	return nItem;
}
开发者ID:noindom99,项目名称:repositorium,代码行数:35,代码来源:RemoteFileDialog.cpp


示例19: COleDateTime

void CXTPDatePickerItemMonth::PopulateDays()
{
	if (m_dtMonth.GetYear() <= 100 && m_dtMonth.GetMonth() <= 2)
		m_dtMonth = COleDateTime(100,2,1,0,0,0);

	if (m_dtMonth.GetStatus() != COleDateTime::valid)
	{
		ASSERT(FALSE);
		m_dtMonth = CXTPCalendarUtils::ResetTime(COleDateTime::GetCurrentTime());
	}
	//if (m_dtMonth < COleDateTime(1601,4,1,0,0,0))
	//  m_dtMonth = COleDateTime(1601,4,1,0,0,0);

	// init days from 1st to last
	COleDateTime dtDay(m_dtMonth.GetYear(), m_dtMonth.GetMonth(), 1, 0, 0, 0);
	COleDateTimeSpan spDay(1, 0, 0, 0);

	// adjust first day of the week
	int nOleFirstDayOfWeek = m_pControl->GetFirstDayOfWeek();

	int iDayOfWeek = dtDay.GetDayOfWeek();
	if (iDayOfWeek != -1)
	{
		while (dtDay.GetDayOfWeek() != nOleFirstDayOfWeek && dtDay.GetDayOfWeek() != -1)
		{
			dtDay -= spDay;
		}
	}
	else
	{
		COleDateTime dtFutureDay(dtDay);
		dtFutureDay.SetDate(dtFutureDay.GetYear() + 2000, dtFutureDay.GetMonth(), dtFutureDay.GetDay());
		iDayOfWeek = dtFutureDay.GetDayOfWeek();

		while (dtFutureDay.GetDayOfWeek() != nOleFirstDayOfWeek && dtFutureDay.GetDayOfWeek() != -1)
		{
			dtFutureDay -= spDay;
			dtDay -= spDay;
		}
	}

	//while (dtDay.GetDayOfWeek() != nOleFirstDayOfWeek && dtDay.GetDayOfWeek() != -1)
	//{
	//  dtDay -= spDay;
	//}

	// populate all grid days
	for (int nWeek = 0; nWeek < XTP_MAX_WEEKS; nWeek++)
	{
		for (int nDay = 0; nDay < XTP_WEEK_DAYS; nDay++)
		{
			// create and add new day item
			CXTPDatePickerItemDay* pDay = new CXTPDatePickerItemDay(m_pControl, this, dtDay);
			m_arrDays.Add(pDay);
			// move next day
			dtDay += spDay;
		}
	}
}
开发者ID:lai3d,项目名称:ThisIsASoftRenderer,代码行数:59,代码来源:XTPDatePickerItemMonth.cpp


示例20: while

void CCalendarDlg2::SetTextForDay(SYSTEMTIME* sysTime)
{
    static BOOL bFirst=1;
    static CString sDovesok;
    static COleDateTime dtCurrent;
    if(!bFirst && dtCurrent.GetStatus()!=COleDateTime::invalid) {
        CString sThisDayNKey=Format(sKey,dtCurrent.GetDay(),dtCurrent.GetMonth(),dtCurrent.GetYear());
        CString sCurDay;
        m_eText.GetWindowText(sCurDay);
        sCurDay.TrimLeft();
        sCurDay.TrimRight();
        if(sCurDay!="") {
            sCurDay.Replace("\r\n","\n");
            if(sDovesok!="") {
                sCurDay+=Format("[?CDATA{%s}?DATAC:)]",sDovesok);
            }
            if(!bINewLine) {
                sCurDay.Replace("\n","<br>");
            }
            CString sContent=CString("\n")+sCurDay+"\n";
            while(sContent!="") {
                CString sLine=sContent.SpanExcluding("\n");
                if(sLine!="") {
                    aItems.Add(sThisDayNKey+sLine);
                    if(sContent.GetLength()>sLine.GetLength()) {
                        sContent=sContent.Mid(sLine.GetLength()+1);
                    } else {
                        sContent="";
                    }
                }
                sContent.TrimLeft();
            }
        }
        sDovesok="";
    }
    bFirst=0;
    if(sysTime) {
        COleDateTime dtTime=COleDateTime(sysTime->wYear,sysTime->wMonth,sysTime->wDay,0,0,0);
        char szTmp[256]= {0};
        GetDateFormat(LOCALE_USER_DEFAULT,DATE_SHORTDATE,sysTime,0,szTmp,sizeof(szTmp));
        GetDlgItem(IDC_STATIC3)->SetWindowText(Format("%s: %s",_l("Current date"),szTmp));
        CString sThisDayNKey=Format(sKey,dtTime.GetDay(),dtTime.GetMonth(),dtTime.GetYear());
        dtCurrent=dtTime;
        CString sDayNote;
        for(int i=aItems.GetSize()-1; i>=0; i--) {
            if(aItems[i].Find(sThisDayNKey)==0) {
                if(sDayNote!="") {
                    sDayNote+="\r\n";
                }
                sDayNote+=aItems[i].Mid(sThisDayNKey.GetLength());
                aItems.RemoveAt(i);
            }
        }
        sDovesok=CDataXMLSaver::GetInstringPart("[?CDATA{","}?DATAC:)]",sDayNote);
        sDayNote.Replace(Format("[?CDATA{%s}?DATAC:)]",sDovesok),"");
        sDayNote.Replace("<br>","\r\n");
        m_eText.SetWindowText(sDayNote);
    }
}
开发者ID:calupator,项目名称:wiredplane-wintools,代码行数:59,代码来源:CalendarDlg2.cpp



注:本文中的COleDateTime函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ COleVariant函数代码示例发布时间:2022-05-30
下一篇:
C++ COUNT_OF函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap