Visual C++ (MFC)


デバイス"AIO000"に対して、アプリを通常サイズで起動し、アプリの起動と終了処理を行います。

long Ret; //戻り値

ICWaveformGeneratorPtr c_fgen;

 

try

{

    HRESULT hr;

    hr = c_fgen.GetActiveObject(__uuidof(CCWaveformGenerator));

    if (FAILED(hr))

    {

        hr = c_fgen.CreateInstance(__uuidof(CCWaveformGenerator));

        if (FAILED(hr))

        {

            _com_issue_error(hr);

        }

    }

}

catch (_com_error& e)

{

    return ;

}

catch (...)

{

    AfxMessageBox(_T("Unanticipated exception initializing ICWaveformGeneratorPtr object."));

}

 

//----------------------------------------

// デバイスの初期化処理

//----------------------------------------

Ret = c_fgen->OpenApplication(1, L"AIO000", L"");

if(Ret != 0)

{

    AfxMessageBox(_T("OpenApplication function call error.") );

}

 

//----------------------------------------

// デバイスの終了処理

//----------------------------------------

Ret = c_fgen->CloseApplication(0);

if(Ret != 0)

{

    AfxMessageBox(_T("CloseApplication function call error.") );

}