void CScanDlg::SetTexts(const CString& files, const CString& dir) { if(dir.IsEmpty()) //Force Text Update { EnterCriticalSection(&m_cs); // |> KRITISCHER BEREICH m_files = files; m_dir = dir; LeaveCriticalSection(&m_cs); // <| KRITISCHER BEREICH static DWORD s_tickCount = 0; s_tickCount = -1; PostMessageEx(s_tickCount, this->GetSafeHwnd(), ID_SET_FILES, 1, 2); } else if(TryEnterCriticalSection(&m_cs)) // |> KRITISCHER BEREICH { m_files = files; m_dir = dir; LeaveCriticalSection(&m_cs); // <| KRITISCHER BEREICH static DWORD s_tickCount = 0; PostMessageEx(s_tickCount, this->GetSafeHwnd(), ID_SET_FILES, 1, 2); } }
///////////////////////////////////////////////////////////////////////////// // {partof:PostMessage} void TCUtilityThread::PostMessageV(UINT idMsg, int cParams, va_list argptr) { LPARAM* pParams = NULL; if (cParams) pParams = (LPARAM*)_alloca(cParams * sizeof(LPARAM)); for (int i = 0; i < cParams; ++i) pParams[i] = va_arg(argptr, LPARAM); PostMessageEx(idMsg, cParams, pParams); }
void CScanDlg::SetProgress2(int value, int max) { static DWORD s_tickCount = 0; PostMessageEx(s_tickCount, this->GetSafeHwnd(), ID_SET_PROGRESS2, value, max); }