Visual C++ (MFC)


Start the app in normal size for device "AIO000" and perform the app startup and termination processing.

long Ret; //For return code

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."));

}

 

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

// Device initialization processing

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

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

if(Ret != 0)

{

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

}

 

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

// Device termination processing

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

Ret = c_fgen->CloseApplication(0);

if(Ret != 0)

{

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

}