DWORD WINAPI ExecuteThread( LPVOID pParam )
{
    USES_CONVERSION;
    CPARAM_THREADPROC* pThreadParam = (CPARAM_THREADPROC*) pParam;

    if (pThreadParam == NULL)
    {
        return ((DWORD)-1);
    }

    CTSExecutorChildFrame* pExecutionFrame = (CTSExecutorChildFrame*)pThreadParam->m_pBuffer;

    if (pExecutionFrame == NULL)
    {
        return ((DWORD)-1);
    }

    bool bLoopON = true;
    pThreadParam->m_unActionCode = INVOKE_FUNCTION;

    while (bLoopON)
    {
        WaitForSingleObject(pThreadParam->m_hActionEvent, INFINITE);

        switch (pThreadParam->m_unActionCode)
        {
            case INVOKE_FUNCTION:
            {
                pExecutionFrame->m_ouTSExecutor.Execute();
                pExecutionFrame->SendMessage(WM_EXECUSTIONOVER, 0, 0);
            }
            break;

            case EXIT_THREAD:
            {
                bLoopON = false;
            }
            break;

            default:
            {
            }
            break;
        }
    }

    SetEvent(pThreadParam->hGetExitNotifyEvent());
    return S_OK;
}
예제 #2
0
void CTreeViewEx::OnCommandRange(UINT unCommandID)
{
    CTSExecutorChildFrame *ouExecutorWnd = GetExecutorWindow();
    if(ouExecutorWnd != NULL)
    {
        CTreeCtrl &omTempTreeCtrl = GetTreeCtrl();
        HTREEITEM hSelectedItem = omTempTreeCtrl.GetSelectedItem();
        DWORD_PTR dwID = omTempTreeCtrl.GetItemData(hSelectedItem);
        HRESULT hResult = (HRESULT)ouExecutorWnd->SendMessage(unCommandID, dwID, 0);
        if(unCommandID == IDM_TESTSETUP_DELETE && hResult == S_OK)
        {
            omTempTreeCtrl.DeleteItem(hSelectedItem);
        }
    }
}