Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
タスクを使った非同期処理
void CSampleDlg::OnOK()
{
// いろいろ前処理
CProgressDlg dlg; // 非同期処理で対応できるように修正したプログレス表示クラス
auto task = concurrency::create_task( [&]()
{
return CountCharInFile( dlg, m_targetPath, m_numbers );
} ).then( [&]( bool result )
{
dlg.PostMessage( WM_CLOSE );
return result;
} );
dlg.DoModal();
if( task.get() )
{
// 画面更新
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.