Boost logo

Boost Users :

From: Eric Hill (eric_at_[hidden])
Date: 2006-11-07 17:49:29


> I'm wonder what could be a schema to connect boost::progress_timer to
> MFC CProgressBar (msvc) gui?
> Thanks in advance.
> gok

Here's what I came up with:

afx_msg void CYourDlg::OnTimer(UINT nIDEvent) {
        switch (nIDEvent) {
                case 5: // Private timer identifier
                        using namespace boost::posix_time;
                        using namespace boost::gregorian;

                        date d(2000, Jan, 1);
                        ptime t1(d, seconds(0));
                        ptime t2(d, seconds(elapsed_timer.elapsed()));
                        time_duration td = t2 - t1;
                        std::string text("Elapsed Time: ");
                        text += to_simple_string(td);
                        ctlElapsed.SetWindowText(text.c_str());
                        break;
        }
}

If anyone has any better/shorter/other solutions, feel free to correct
me...

Eric


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net