* Thread for running the asynchronous task. */
| 394 | * Thread for running the asynchronous task. |
| 395 | */ |
| 396 | UINT CMessageBoxDialog::AsyncTaskThread(LPVOID lpParam) |
| 397 | { |
| 398 | CMessageBoxDialog *pThis = (CMessageBoxDialog *)lpParam; |
| 399 | std::shared_ptr<IAsyncTask> task = std::atomic_load(&pThis->m_pAsyncTask); |
| 400 | if (task) |
| 401 | { |
| 402 | HWND hWnd = pThis->m_hWnd; |
| 403 | // reset cancel flag then run the task |
| 404 | pThis->m_bAsyncTaskCancelFlag = false; |
| 405 | String result = task->RunAndGetMessage(pThis->m_bAsyncTaskCancelFlag); |
| 406 | if (!result.empty() && ::IsWindow(hWnd)) |
| 407 | ::PostMessage(hWnd, WM_USER_ASYNCRESULT, reinterpret_cast<WPARAM>(new String(result)), 0); |
| 408 | } |
| 409 | return 0; |
| 410 | } |
| 411 | |
| 412 | /* |
| 413 | * Method for retrieving the former result of the message box from the registry. |
nothing calls this directly
no test coverage detected