Beispiel #1
0
void CDlgAlarmAnalysis::OnDtnCloseupEndTime(NMHDR *pNMHDR, LRESULT *pResult)
{
	int nBegin, nEnd;
	GetSetTime(&nBegin, &nEnd);
	CTime curTime;
	curTime = CTime::GetCurrentTime();
	int nCurTime = 1000000 * curTime.GetMonth() + 10000 * curTime.GetDay() + 100 * 23 + 59;

	if( m_nOldEndTime < 0 || m_nOldBeginTime < 0 )
	{
		m_nOldBeginTime = nBegin;
		m_nOldEndTime = nEnd;
	}

	if( nBegin >= nEnd || nCurTime < nEnd )
	{
		SetTime(m_nOldBeginTime, m_nOldEndTime);
	}
	else
	{
		m_nOldBeginTime = nBegin;
		m_nOldEndTime = nEnd;
	}

	ReDrawListData(m_strCondition, m_stkCode, m_nOldBeginTime, m_nOldEndTime);
	*pResult = 0;
}
Beispiel #2
0
int 
main(void)
{
    int     ch;
    unsigned int     i = 0;
    char    x[] = "|/-\\";

    initscr();              /* Start curses mode        */
    raw();                  /* Line buffering disabled  */
    nodelay(stdscr, TRUE);  /* getch() returns immediately      */
    noecho();               /* no cursor */
    curs_set(0);			/* no cursor */

	DrawBox();
	GetSetTime();
    mvprintw(3,5,"press a key ('q' to quit)");
    
    ch = getch();           /* If raw() hadn't been called
                             * we have to press 'enter' before it
                             * gets to the program      
                             */
	
    while (ch != 'q')
    {
		usleep(9000);	// wait a while
        ch = getch();
        if (ch == ERR)
        {
            // no key pressed: show that the while-loop is busy
            i++;
            if (i > strlen (x))
            {
                i = 0;
            }
            mvprintw(7,11,"%c %12lld", x[i], GetMilli());
        }
        else
        {
            // show pressed key
            mvprintw(5,13,"%c (%02x)     ", ch, ch);
        }
    }
    
    endwin();           /* End curses mode        */

    return (0);
}
Beispiel #3
0
BOOL CDlgAlarmAnalysis::OnInitDialog()
{
	CDialog::OnInitDialog();

	const CTime tMin(1978,1,1,0,0,0);
	const CTime tMax(2038,1,1,0,0,0);

	m_wndBeginTime.SetFormat(_T("yyyy年MM月dd日 dddd"));
	m_wndBeginTime.SetRange(&tMin, &tMax);

	m_wndEndTime.SetFormat(_T("yyyy年MM月dd日 dddd"));
	m_wndEndTime.SetRange(&tMin, &tMax);

	InitList();
	ReDrawListData();
	ReDrawListBox();

	GetSetTime(&m_nOldBeginTime, &m_nOldEndTime);

	return TRUE;  // return TRUE unless you set the focus to a control
}
Beispiel #4
0
void CDlgAlarmAnalysis::OnDtnCloseupBeginTime(NMHDR *pNMHDR, LRESULT *pResult)
{
	int nBegin, nEnd;
	GetSetTime(&nBegin, &nEnd);
	if( m_nOldEndTime < 0 || m_nOldBeginTime < 0 )
	{
		m_nOldBeginTime = nBegin;
		m_nOldEndTime = nEnd;
	}

	if( nBegin > nEnd )
	{
		SetTime(m_nOldBeginTime, m_nOldEndTime);
	}
	else
	{
		m_nOldBeginTime = nBegin;
		m_nOldEndTime = nEnd;
	}

	ReDrawListData(m_strCondition, m_stkCode, m_nOldBeginTime, m_nOldEndTime);
	*pResult = 0;
}