VOID ActionCallback(PTP_CALLBACK_INSTANCE Instance, PVOID Context) { PCALLBACK_DATA pData = (PCALLBACK_DATA)Context; // Compute a pseudo duration for the action based on its name DWORD dwDuration = (DWORD)_tcslen(pData->szAction); AddMessage( TEXT("[%u] '%s' starting for %u seconds."), GetCurrentThreadId(), pData->szAction, dwDuration); // Simulate a lot of work Sleep(dwDuration * 1000); AddMessage( TEXT("[%u] '%s' is done."), GetCurrentThreadId(), pData->szAction); // Ask the thread pool to set the synchronization event // after this callback finishes SetEventWhenCallbackReturns(Instance, pData->finishEvent); // Don't forget to clean up the given parameter data block delete (pData); }
InternalException::InternalException(const char* c) : Logic_error() { Select = BaseException::Select; AddMessage("internal error detected by Newmat: please inform author\n"); AddMessage(c); AddMessage("\n\n"); Tracer::AddTrace(); }
Runtime_error::Runtime_error(const char* a_what) : BaseException() { Select = BaseException::Select; AddMessage("Runtime error:- "); AddMessage(a_what); if (a_what) Tracer::AddTrace(); }
NVENCSTATUS NVEncFilterDenoiseGauss::init(shared_ptr<NVEncFilterParam> pParam, shared_ptr<RGYLog> pPrintMes) { NVENCSTATUS sts = NV_ENC_SUCCESS; m_pPrintMes = pPrintMes; auto pGaussParam = std::dynamic_pointer_cast<NVEncFilterParamGaussDenoise>(pParam); if (!pGaussParam) { AddMessage(RGY_LOG_ERROR, _T("Invalid parameter type.\n")); return NV_ENC_ERR_INVALID_PARAM; } if (!check_if_nppi_dll_available()) { AddMessage(RGY_LOG_ERROR, _T("vpp-gauss requires \"%s\", not available on your system.\n"), NPPI_DLL_NAME); return NV_ENC_ERR_INVALID_PARAM; } //パラメータチェック if (pGaussParam->frameOut.height <= 0 || pGaussParam->frameOut.width <= 0) { AddMessage(RGY_LOG_ERROR, _T("Invalid parameter.\n")); return NV_ENC_ERR_INVALID_PARAM; } auto cudaerr = AllocFrameBuf(pGaussParam->frameOut, 1); if (cudaerr != CUDA_SUCCESS) { AddMessage(RGY_LOG_ERROR, _T("failed to allocate memory: %s.\n"), char_to_tstring(cudaGetErrorName(cudaerr)).c_str()); return NV_ENC_ERR_OUT_OF_MEMORY; } pGaussParam->frameOut.pitch = m_pFrameBuf[0]->frame.pitch; m_sFilterInfo = strsprintf(_T("denoise(gauss): mask size: %s"), get_chr_from_value(list_nppi_gauss, pGaussParam->masksize)); m_pParam = pParam; return sts; }
BOOL CInstall::SetRegistryValue(HKEY hkey, const char *value_name, const char *value) { char buf[MAXSTR]; char qbuf[MAXSTR]; DWORD cbData; DWORD keytype; cbData = sizeof(buf); keytype = REG_SZ; if (RegQueryValueEx(hkey, value_name, 0, &keytype, (LPBYTE)buf, &cbData) == ERROR_SUCCESS) { reg_quote(qbuf, buf); fprintf(m_fLogOld, "\042%s\042=\042%s\042\n", value_name, qbuf); } reg_quote(qbuf, value); fprintf(m_fLogNew, "\042%s\042=\042%s\042\n", value_name, qbuf); AddMessage(" "); AddMessage(value_name); AddMessage("="); AddMessage(value); AddMessage("\n"); if (RegSetValueEx(hkey, value_name, 0, REG_SZ, (CONST BYTE *)value, strlen(value)+1) != ERROR_SUCCESS) return FALSE; return TRUE; }
SolutionException::SolutionException(const char* a_what) : Exception() { Select = Exception::Select; AddMessage("Error detected by solution package\n"); AddMessage(a_what); AddMessage("\n"); if (a_what) Tracer::AddTrace(); };
INT_PTR WINAPI Dlg_Proc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { switch (uMsg) { chHANDLE_DLGMSG(hwnd, WM_INITDIALOG, Dlg_OnInitDialog); chHANDLE_DLGMSG(hwnd, WM_COMMAND, Dlg_OnCommand); case WM_APP_COMPLETED: { AddMessage( TEXT("[%u] ____Whole batch is over____"), GetCurrentThreadId()); // Don't forget to clean up given synchronization data PSYNCHRO_DATA pData = (PSYNCHRO_DATA)lParam; for (DWORD current = 0; current < pData->Count; current++) { if (!CloseHandle(pData->Handles[current])) { AddMessage( TEXT("[%u] Error %u when closing handle %u"), GetCurrentThreadId(), GetLastError(), current); } } g_hEmailEvent = NULL; g_hPrintEvent = NULL; delete (pData); } break; } return(FALSE); }
void frmClient::on_btnOpen_clicked() { if (ui->btnOpen->text() == "打开") { COM = new QextSerialPort(ui->cboxPortName->currentText()); bool IsOpen = COM->open(QIODevice::WriteOnly); if (IsOpen) { COM->flush();//清空串口缓冲区 COM->setBaudRate(BAUD2400); COM->setDataBits(DATA_8); COM->setParity(PAR_NONE); COM->setStopBits(STOP_1); COM->setFlowControl(FLOW_OFF); COM->setTimeout(10); //开启定时器发送心跳数据 timerHeart->start(); ui->btnOpen->setText("关闭"); AddMessage("串口打开成功"); SendACK(); } else { AddMessage("串口打开失败"); } } else { timerHeart->stop(); COM->close(); ui->btnOpen->setText("打开"); AddMessage("串口关闭成功"); } }
OverflowException::OverflowException(const char* c) : Runtime_error() { Select = BaseException::Select; AddMessage("detected by Newmat: "); AddMessage(c); AddMessage("\n\n"); if (c) Tracer::AddTrace(); }
ProgramException::ProgramException(const char* c) : Logic_error() { Select = BaseException::Select; AddMessage("detected by Newmat: "); AddMessage(c); AddMessage("\n\n"); if (c) Tracer::AddTrace(); }
NVENCSTATUS NVEncFilterDenoiseGauss::denoiseYV12(FrameInfo *pOutputFrame, const FrameInfo *pInputFrame) { NVENCSTATUS sts = NV_ENC_SUCCESS; if (m_pParam->frameOut.csp != m_pParam->frameIn.csp) { AddMessage(RGY_LOG_ERROR, _T("csp does not match.\n")); return NV_ENC_ERR_UNSUPPORTED_PARAM; } auto pGaussParam = std::dynamic_pointer_cast<NVEncFilterParamGaussDenoise>(m_pParam); if (!pGaussParam) { AddMessage(RGY_LOG_ERROR, _T("Invalid parameter type.\n")); return NV_ENC_ERR_INVALID_PARAM; } const auto supportedCspYV12High = make_array<RGY_CSP>(RGY_CSP_YV12_09, RGY_CSP_YV12_10, RGY_CSP_YV12_12, RGY_CSP_YV12_14, RGY_CSP_YV12_16); NppStatus nppsts = NPP_SUCCESS; if (pGaussParam->frameIn.csp == RGY_CSP_YV12) { nppsts = denoise_yv12<Npp8u>(pOutputFrame, pInputFrame, nppiFilterGaussBorder_8u_C1R, pGaussParam->masksize); if (nppsts != NPP_SUCCESS) { AddMessage(RGY_LOG_ERROR, _T("failed to denoise: %d, %s.\n"), nppsts, char_to_tstring(_cudaGetErrorEnum(nppsts)).c_str()); sts = NV_ENC_ERR_GENERIC; } } else if (std::find(supportedCspYV12High.begin(), supportedCspYV12High.end(), pGaussParam->frameIn.csp) != supportedCspYV12High.end()) { nppsts = denoise_yv12<Npp16u>(pOutputFrame, pInputFrame, nppiFilterGaussBorder_16u_C1R, pGaussParam->masksize); if (nppsts != NPP_SUCCESS) { AddMessage(RGY_LOG_ERROR, _T("failed to denoise: %d, %s.\n"), nppsts, char_to_tstring(_cudaGetErrorEnum(nppsts)).c_str()); sts = NV_ENC_ERR_GENERIC; } } else { AddMessage(RGY_LOG_ERROR, _T("unsupported csp.\n")); sts = NV_ENC_ERR_UNIMPLEMENTED; } return NV_ENC_SUCCESS; }
void TGo4LogInfo::linkedObjectUpdated(const char * linkname, TObject * obj) { TList* lst = dynamic_cast<TList*>(obj); if (lst != 0) { TListIter iter(lst, kFALSE); TObject* obj = 0; while ((obj = iter()) != 0) { // first item is id of current status message, used to submit next request if (obj==lst->First()) continue; const char* msg = obj->GetName(); const char* separ = strchr(msg,':'); if ((separ==0) || (strlen(separ)<3)) continue; Long64_t tm = TString(msg, separ-msg).Atoll(); QDateTime dt; dt.setTime_t((time_t) tm); separ++; int level = 1; if (*separ=='2') level=2; else if (*separ=='3') level=3; AddMessage(dt, level, separ+2); } } else if (obj!=0) { AddMessage(QDateTime::currentDateTime(), 0, obj->GetName()); } }
BOOL CInstall::StartMenuBegin() { m_fLogNew = MakeTemp(m_szShellNew); if (!m_fLogNew) { AddMessage("Failed to create ShellNew temporary file\n"); return FALSE; } m_fLogOld = MakeTemp(m_szShellOld); if (!m_fLogOld) { AddMessage("Failed to create ShellNew temporary file\n"); return FALSE; } // make folder if needed char szLink[MAXSTR]; strcpy(szLink, m_szPrograms); strcat(szLink, "\\"); strcat(szLink, m_szTargetGroup); if (chdir(szLink) != 0) { if (mkdir(szLink) != 0) { char buf[MAXSTR+64]; wsprintf(buf, "Couldn't make Programs folder \042%s'042", szLink); AddMessage(buf); StartMenuEnd(); return FALSE; } } else { fprintf(m_fLogOld, "Group=%s\n\n", szLink); } fprintf(m_fLogNew, "Group=%s\n\n", szLink); return TRUE; }
CannotBuildException::CannotBuildException(const char* matrix) : Logic_error() { Select = BaseException::Select; AddMessage("detected by Newmat: cannot build matrix type "); AddMessage(matrix); AddMessage("\n\n"); Tracer::AddTrace(); }
void CExampleDlg::OnBnClickedConnectButton() { WCHAR awcTempBuf[100]; const int kTempBufSize = sizeof(awcTempBuf) / sizeof(awcTempBuf[0]); // Pull user input into our member variables UpdateData(TRUE); // Clear out the results list, in case this isn't the first time // we've come in here. ResultsList.ResetContent(); // Translate the Unicode text we get from the UI into the UTF-8 form // that MySQL wants. const int kInputBufSize = 100; char acServerAddress[kInputBufSize]; char acUserName[kInputBufSize]; char acPassword[kInputBufSize]; ToUTF8(acServerAddress, kInputBufSize, sServerAddress); ToUTF8(acUserName, kInputBufSize, sUserName); ToUTF8(acPassword, kInputBufSize, sPassword); // Connect to the sample database. mysqlpp::Connection con(false); if (!con.connect("mysql_cpp_data", acServerAddress, acUserName, acPassword)) { AddMessage(_T("Failed to connect to server:")); if (ToUCS2(awcTempBuf, kTempBufSize, con.error())) { AddMessage(awcTempBuf); } return; } // Retrieve a subset of the sample stock table set up by resetdb mysqlpp::Query query = con.query(); query << "select item from stock"; mysqlpp::StoreQueryResult res = query.store(); if (res) { // Display the result set for (size_t i = 0; i < res.num_rows(); ++i) { if (ToUCS2(awcTempBuf, kTempBufSize, res[i][0])) { AddMessage(awcTempBuf); } } // Retreive was successful, so save user inputs now SaveInputs(); } else { // Retreive failed AddMessage(_T("Failed to get item list:")); if (ToUCS2(awcTempBuf, kTempBufSize, query.error())) { AddMessage(awcTempBuf); } } }
IndexException::IndexException(int i, const GeneralMatrix& A) : Logic_error() { Select = BaseException::Select; AddMessage("detected by Newmat: index error: requested index = "); AddInt(i); AddMessage("\n\n"); MatrixDetails(A); Tracer::AddTrace(); }
ProgramException::ProgramException(const char* c, const GeneralMatrix& A, const GeneralMatrix& B) : Logic_error() { Select = BaseException::Select; AddMessage("detected by Newmat: "); AddMessage(c); AddMessage("\n\n"); MatrixDetails(A); MatrixDetails(B); if (c) Tracer::AddTrace(); }
NVENCSTATUS NVEncFilter::filter(FrameInfo *pInputFrame, FrameInfo **ppOutputFrames, int *pOutputFrameNum) { cudaError_t cudaerr = cudaSuccess; if (m_bCheckPerformance) { cudaerr = cudaEventRecord(*m_peFilterStart.get()); if (cudaerr != cudaSuccess) { AddMessage(RGY_LOG_ERROR, _T("failed cudaEventRecord(m_peFilterStart): %s.\n"), char_to_tstring(cudaGetErrorString(cudaerr)).c_str()); } } if (pInputFrame == nullptr) { *pOutputFrameNum = 0; ppOutputFrames[0] = nullptr; } if (m_pParam && m_pParam->bOutOverwrite //上書きか? && pInputFrame != nullptr && pInputFrame->ptr != nullptr //入力が存在するか? && ppOutputFrames != nullptr && ppOutputFrames[0] == nullptr) { //出力先がセット可能か? ppOutputFrames[0] = pInputFrame; *pOutputFrameNum = 1; } const auto ret = run_filter(pInputFrame, ppOutputFrames, pOutputFrameNum); const int nOutFrame = *pOutputFrameNum; if (!m_pParam->bOutOverwrite && nOutFrame > 0) { if (m_nPathThrough & FILTER_PATHTHROUGH_TIMESTAMP) { if (nOutFrame != 1) { AddMessage(RGY_LOG_ERROR, _T("timestamp path through can only be applied to 1-in/1-out filter.\n")); return NV_ENC_ERR_INVALID_CALL; } else { ppOutputFrames[0]->timestamp = pInputFrame->timestamp; ppOutputFrames[0]->duration = pInputFrame->duration; } } for (int i = 0; i < nOutFrame; i++) { if (m_nPathThrough & FILTER_PATHTHROUGH_FLAGS) ppOutputFrames[i]->flags = pInputFrame->flags; if (m_nPathThrough & FILTER_PATHTHROUGH_PICSTRUCT) ppOutputFrames[i]->picstruct = pInputFrame->picstruct; } } if (m_bCheckPerformance) { cudaerr = cudaEventRecord(*m_peFilterFin.get()); if (cudaerr != cudaSuccess) { AddMessage(RGY_LOG_ERROR, _T("failed cudaEventRecord(m_peFilterFin): %s.\n"), char_to_tstring(cudaGetErrorString(cudaerr)).c_str()); } cudaerr = cudaEventSynchronize(*m_peFilterFin.get()); if (cudaerr != cudaSuccess) { AddMessage(RGY_LOG_ERROR, _T("failed cudaEventSynchronize(m_peFilterFin): %s.\n"), char_to_tstring(cudaGetErrorString(cudaerr)).c_str()); } float time_ms = 0.0f; cudaerr = cudaEventElapsedTime(&time_ms, *m_peFilterStart.get(), *m_peFilterFin.get()); if (cudaerr != cudaSuccess) { AddMessage(RGY_LOG_ERROR, _T("failed cudaEventElapsedTime(m_peFilterStart - m_peFilterFin): %s.\n"), char_to_tstring(cudaGetErrorString(cudaerr)).c_str()); } m_dFilterTimeMs += time_ms; m_nFilterRunCount++; } return ret; }
IndexException::IndexException(int i, const GeneralMatrix& A, bool) : Logic_error() { Select = Exception::Select; AddMessage("detected by Newmat: element error: requested index (wrt 0) = "); AddInt(i); AddMessage("\n\n"); MatrixDetails(A); Tracer::AddTrace(); }
BOOL CInstall::InstallFile(char *filename, BOOL bNoCopy) { char existing_name[MAXSTR]; char new_name[MAXSTR]; char dir_name[MAXSTR]; strcpy(existing_name, m_szSourceDir); strcat(existing_name, "\\"); strcat(existing_name, filename); strcpy(new_name, m_szTargetDir); strcat(new_name, "\\"); strcat(new_name, filename); strcpy(dir_name, new_name); char *p = strrchr(dir_name, '\\'); if (p) { *p = '\0'; if (!MakeDir(dir_name)) { AddMessage("Failed to make directory "); AddMessage(dir_name); AddMessage("\n"); return FALSE; } } AddMessage(" "); AddMessage(new_name); AddMessage("\n"); if (bNoCopy) { // Don't copy files. Leave them where they are. // Check that all files exist FILE *f; if ((f = fopen(existing_name, "r")) == (FILE *)NULL) { AddMessage("Missing file "); AddMessage(existing_name); AddMessage("\n"); return FALSE; } fclose(f); } else { if (!CopyFile(existing_name, new_name, FALSE)) { char message[MAXSTR+MAXSTR+100]; wsprintf(message, "Failed to copy file %s to %s\n", existing_name, new_name); AddMessage(message); return FALSE; } ResetReadonly(new_name); fputs(new_name, m_fLogNew); fputs("\n", m_fLogNew); } return TRUE; }
NotDefinedException::NotDefinedException(const char* op, const char* matrix) : Logic_error() { Select = BaseException::Select; AddMessage("detected by Newmat: "); AddMessage(op); AddMessage(" not defined for "); AddMessage(matrix); AddMessage("\n\n"); Tracer::AddTrace(); }
BOOL CInstall::Init(const char *szSourceDir, const char *szFileList) { FILE *f; strcpy(m_szSourceDir, szSourceDir); // remove trailing backslash char *p; p = m_szSourceDir + strlen(m_szSourceDir) - 1; if (*p == '\\') *p = '\0'; strcpy(m_szFileList, szFileList); m_szRegistryNew[0] = m_szRegistryOld[0] = m_szShellNew[0] = m_szShellOld[0] = m_szFileNew[0] = '\0'; // Open list of files SetCurrentDirectory(m_szSourceDir); f = fopen(m_szFileList, "r"); if (f == (FILE *)NULL) { char buf[MAXSTR]; wsprintf(buf, "Failed to open \042%s\042\n", m_szFileList); AddMessage(buf); return FALSE; } // get application and directory name m_szUninstallName[0] = '\0'; if (!fgets(m_szUninstallName, sizeof(m_szUninstallName), f)) { AddMessage("Invalid file list\n"); fclose(f); return FALSE; } if (*m_szUninstallName ) m_szUninstallName[strlen(m_szUninstallName)-1] = '\0'; m_szMainDir[0] = '\0'; if (!fgets(m_szMainDir, sizeof(m_szMainDir), f)) { AddMessage("Invalid file list\n"); fclose(f); return FALSE; } if (*m_szMainDir ) m_szMainDir[strlen(m_szMainDir)-1] = '\0'; fclose(f); // Create log directory strcpy(m_szLogDir, m_szTargetDir); strcat(m_szLogDir, "\\"); strcat(m_szLogDir, m_szMainDir); MakeDir(m_szLogDir); return TRUE; }
void OnStartBatch( void ){ m_btnStart.Enable( FALSE ); AddMessage(_T("---- start a new batch ----")); SubmitThreadpoolWork( m_pWorkItem ); SubmitThreadpoolWork( m_pWorkItem ); SubmitThreadpoolWork( m_pWorkItem ); SubmitThreadpoolWork( m_pWorkItem ); AddMessage(_T("4 tasks are submitted.")); }
BOOL CInstall::StartMenuAdd(const char *szDescription, const char *szProgram, const char *szArguments) { if (!CreateShellLink(szDescription, szProgram, szArguments)) { AddMessage("Couldn't make shell link for "); AddMessage(szDescription); AddMessage("\n"); StartMenuEnd(); return FALSE; } return TRUE; }
Exception::Exception(const char* a_what) { Select++; SoFar = 0; if (!what_error) { // make space for exception message LastOne = 511; what_error = new char[512]; if (!what_error) { // fail to make space LastOne = 0; what_error = "No heap space for exception message\n"; } } AddMessage("\n\nAn exception has been thrown\n"); AddMessage(a_what); if (a_what) Tracer::AddTrace(); }
void SendAffects(int clientId) // 7.54 { if(clientId > PLAYER) return; p754_GetAffect pack_3B9 = *(p754_GetAffect*)malloc(sizeof(p754_GetAffect)); pack_3B9.Header.PacketId = 0x3B9; pack_3B9.Header.Size = 140; pack_3B9.Header.ClientID = clientId; int addr_base = clientId * 0x0410; st_Mob_754 *_mob = (st_Mob_754*)GetMobFromIndex(clientId); for(short i = 0; i < 16 && _mob != NULL; i++) { if(mobaffectbuffer[clientId].Affects[i].Time != 0) { pack_3B9.Affect[i + 1].Index = (BYTE)mobaffectbuffer[clientId].Affects[i].Index; pack_3B9.Affect[i + 1].Master = (BYTE)mobaffectbuffer[clientId].Affects[i].Master; pack_3B9.Affect[i + 1].Value = mobaffectbuffer[clientId].Affects[i].Value; pack_3B9.Affect[i + 1].Time = mobaffectbuffer[clientId].Affects[i].Time; } } //AddMessage((BYTE*)&pack_3B9, clientId); AddMessage(clientId, (char*)&pack_3B9, 128); return; }
/** ** Set message to display. ** ** @param x Message X map origin. ** @param y Message Y map origin. ** @param fmt To be displayed in text overlay. ** ** @note FIXME: vladi: I know this can be just separated func w/o msg but ** it is handy to stick all in one call, someone? */ void SetMessageEvent(int x, int y, const char *fmt, ...) { char temp[128]; va_list va; va_start(va, fmt); vsnprintf(temp, sizeof(temp) - 1, fmt, va); temp[sizeof(temp) - 1] = '\0'; va_end(va); if (CheckRepeatMessage(temp) == 0) { AddMessage(temp); } if (MessagesEventCount == MESSAGES_MAX) { ShiftMessagesEvent(); } if (x != -1) { strcpy_s(MessagesEvent[MessagesEventCount], sizeof(MessagesEvent[MessagesEventCount]), temp); MessagesEventX[MessagesEventCount] = x; MessagesEventY[MessagesEventCount] = y; MessagesEventIndex = MessagesEventCount; ++MessagesEventCount; } }
void MessagesDlg::OnEnMsgfilterMessage(NMHDR *pNMHDR, LRESULT *pResult) { MSGFILTER *pMsgFilter = reinterpret_cast<MSGFILTER *>(pNMHDR); if (pMsgFilter->msg == WM_CHAR) { if ( pMsgFilter->wParam == VK_RETURN ) { CRichEditCtrl* richEdit = (CRichEditCtrl*)GetDlgItem(IDC_MESSAGE); CString message; int len = richEdit->GetWindowTextLength(); LPTSTR ptr = message.GetBuffer(len); richEdit->GetWindowText(ptr,len+1); message.ReleaseBuffer(); message.Trim(); if (message.GetLength()) { MessagesContact* messagesContact = GetMessageContact(); if (SendMessage (messagesContact,message) ) { richEdit->SetWindowText(NULL); GotoDlgCtrl(richEdit); AddMessage(messagesContact, message, MSIP_MESSAGE_TYPE_LOCAL); } } *pResult= 1; return; } } *pResult = 0; }
int CreateGroup(const TCHAR *group, MCONTACT hContact) { if (group == NULL) return 0; size_t cbName = mir_tstrlen(group); TCHAR *tszGrpName = (TCHAR*)_alloca((cbName + 2)*sizeof(TCHAR)); tszGrpName[0] = 1 | GROUPF_EXPANDED; mir_tstrcpy(tszGrpName + 1, group); // Check for duplicate & find unused id char groupIdStr[11]; for (int groupId = 0;; groupId++) { itoa(groupId, groupIdStr, 10); ptrT tszDbGroup(db_get_tsa(NULL, "CListGroups", groupIdStr)); if (tszDbGroup == NULL) break; if (!mir_tstrcmp((TCHAR*)tszDbGroup+1, tszGrpName+1)) { if (hContact) db_set_ts(hContact, "CList", "Group", tszGrpName + 1); else AddMessage(LPGENT("Skipping duplicate group %s."), tszGrpName + 1); return 0; } } db_set_ts(NULL, "CListGroups", groupIdStr, tszGrpName); if (hContact) db_set_ts(hContact, "CList", "Group", tszGrpName + 1); return 1; }
void TaskHandler( void ){ LONG currentTask = InterlockedIncrement( &m_nCurrentTask ); TString str; str.Format(_T("[%u] Task #%u is starting."), GetCurrentThreadId(), currentTask); AddMessage( (LPCTSTR)str ); Sleep( currentTask * 1000 ); str.Format(_T("[%u] Task #%u is done."), GetCurrentThreadId(), currentTask); AddMessage( (LPCTSTR)str ); if( InterlockedDecrement(&m_nCurrentTask) == 0 ){ PostMessage( WM_APP_COMPLETED, 0, (LPARAM)currentTask ); } }