F需要等于2194? 目前,我正在努力获得一个变体的安全射线,以在下面的C++代码中工作。如您所见,我调用了QueueInputReport,其签名为(SAFEARRAY*PSAIInputReport,UNIT timeoutduration): < >

F需要等于2194? 目前,我正在努力获得一个变体的安全射线,以在下面的C++代码中工作。如您所见,我调用了QueueInputReport,其签名为(SAFEARRAY*PSAIInputReport,UNIT timeoutduration): < >,c++,windows,device-driver,variant,C++,Windows,Device Driver,Variant,F需要等于2194? 目前,我正在努力获得一个变体的安全射线,以在下面的C++代码中工作。如您所见,我调用了QueueInputReport,其签名为(SAFEARRAY*PSAIInputReport,UNIT timeoutduration): < >但是,当我尝试在C++中复制这个函数时,它就不起作用了。< /P>你有三个不同的拼写,我假设的是相同的标识符: FFECTIONS , FFECTIOS< /COD>,和 FueSimult。是的,我正在使用设备仿真框架,需要将一个输入报告传递

F需要等于2194?

目前,我正在努力获得一个变体的安全射线,以在下面的C++代码中工作。如您所见,我调用了QueueInputReport,其签名为(SAFEARRAY*PSAIInputReport,UNIT timeoutduration):


< >但是,当我尝试在C++中复制这个函数时,它就不起作用了。< /P>你有三个不同的拼写,我假设的是相同的标识符:<代码> FFECTIONS <代码>,<代码> FFECTIOS< /COD>,和 FueSimult<代码>。是的,我正在使用设备仿真框架,需要将一个输入报告传递给QuealeInPoTeCuffic函数。它非常烦人,因为只要传递的数据的Ffeatures是2197(FADF_FIXEDSIZE、FADF_STATIC、FADF_HAVEVARTYPE,我认为是FADF_VARIANT),它就可以正常工作。另外,在十六进制中,我想它应该是892。在十六进制中,
2197
0x895
。我的坏毛病是十六进制中的0x892和十进制中的2194。我知道我需要一个安全的变异数组,虽然是VT_UI1亚型。2194这个数字有什么意义?听起来像是
ffeatures
这东西可能是一个位字段,所以你看过它的二进制表示,看看设置了哪些不需要的位吗?这些位表示什么(根据位字段的文档)?
    CComSafeArray<VARIANT> savt;  
     //LONG j[5];
    LONG length = 4;
    //SafeArrayLock(psaValues);

        for(LONG i = 0; i <= length; ++i)
     {
        //j[i] = i;
     MessageBox(NULL,L"inputreport assigned to variable",NULL,NULL);

     //VariantInit(&pDescriptorData[i]);
        //pDescriptorData[i].vt = VT_UI1;
        //pDescriptorData[i].bVal = inputreport[i];
        //SafeArrayPutElement(psaValues,&i,&pDescriptorData[i]);
       //  VariantClear(&pDescriptorData[i]);

       savt.Add(CComVariant(inputreport[i]));  
    }

    //SafeArrayUnlock(psaValues);

MessageBox(NULL,L"data is successfully assigned to safearray",L"correct data format",NULL);
//FADF_STATIC+FADF_FIXEDSIZE+FADF_HAVEVARTYPE+FADF_VARIANT;
/* _TCHAR szBuffer2[100];
_stprintf_s(szBuffer2, _T("%i"),&psaValues->fFeatures);
MessageBox(NULL,L"safe array type",szBuffer2,NULL);*/

piSoftHidDevice1[devindex]->QueueInputReport(savt,8);
piSoftHidDevice1[devindex]->StartProcessing();
piSoftHidDevice1[devindex]->StopProcessing();
 STDMETHODIMP CHIDDevice::QueueInputReport( SAFEARRAY* psaInputReport, UINT timeoutDuration )
/*++
Routine Description: Queues additional input reports

Arguments:
IdleTimeout - used to set the value of the log level

Return value:
S_OK
--*/
{

VARIANT *  pArrayData  = NULL;
UINT               cbData      = 5;
LONG                lLBound     = 0;
LONG                lUBound     = 0;
HRESULT             hr          = S_OK;
HID_INPUT_REPORT    inputReport;
BOOLEAN             result      = TRUE;

// Initialize Structure
inputReport.timeout = timeoutDuration;
inputReport.cbInputReport = 0;
inputReport.pbInputReport = NULL;
    MessageBox(NULL,L"report initialized",L"initial report",NULL);
// Get SAFEARRAY size
IfFailHrGo(SafeArrayGetLBound(psaInputReport, 1, &lLBound));
IfFailHrGo(SafeArrayGetUBound(psaInputReport, 1, &lUBound));
IfFalseHrGo(lUBound > lLBound, E_UNEXPECTED);
cbData = lUBound - lLBound + 1;
//psaInputReport->fFeatures = 0x892;
//psaInputReport->fFeatures = 0x892;
inputReport.pbInputReport = (BYTE*)CoTaskMemAlloc( cbData * sizeof(BYTE) );
 _TCHAR szBuffer3[100];
_stprintf_s(szBuffer3, _T("%i"), &psaInputReport->fFeatures);
MessageBox(NULL,L"array content features",szBuffer3,NULL);
// If the memory Allocation fails, then fail and exit
if( inputReport.pbInputReport == NULL )
{
    hr = E_UNEXPECTED;
    goto Exit;
}
//void HUGEP** cast orginally
IfFailHrGo( SafeArrayAccessData( psaInputReport, 
                                 reinterpret_cast<void HUGEP**>(&pArrayData) ) );

// Step through the SAFEARRAY and populating only BYTE input report
// and bail out if the type is not correct
for( LONG i = 0; i <= lUBound; ++i )
{
    if (pArrayData[i].vt == VT_UI1)
    {

        inputReport.pbInputReport[i] = pArrayData[i].bVal;

    }
    else
    {
        hr = E_FAIL;
        goto Exit;
    }
}
  SafeArrayUnaccessData(psaInputReport);
inputReport.cbInputReport = cbData;
    //MessageBox(NULL,L"report being sent next",L"sent report",NULL);
// Add the report to the input queue (does a shallow copy so no need to free the array data)
result = m_InputReportQueue.insert( inputReport );

if (result == FALSE)
{
    MessageBox(NULL,L"failed to queue the input",NULL,NULL);
    hr = E_FAIL;
}
return hr;
Exit:
SafeArrayUnaccessData(psaInputReport);
if( FAILED(hr) )
{
    CoTaskMemFree(inputReport.pbInputReport);
}
return hr;
}
     Dim inputreport(5)
     inputreport(0) = CByte(0)
     inputreport(1) = CByte(100)
     inputreport(2) = CByte(100)
     inputreport(3) = CByte(0)
     inputreport(4) = Cbyte(0)
     pisofthiddevice1(i).QueueInputReport(inputreport, 8)