jweather / slimdx

Automatically exported from code.google.com/p/slimdx
MIT License
0 stars 0 forks source link

Raw input does not work with multiple windows. #892

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I'm using the HEAD version from the SVN.
I believe that the following solution is better.

DeviceRI.cpp

void Device::RegisterDevice( SlimDX::Multimedia::UsagePage usagePage, 
SlimDX::Multimedia::UsageId usageId, DeviceFlags flags, IntPtr target, bool 
addThreadFilter )
    {
        RAWINPUTDEVICE device;
        device.usUsagePage = static_cast<USHORT>( usagePage );
        device.usUsage = static_cast<USHORT>( usageId );
        device.dwFlags = static_cast<DWORD>( flags );
        device.hwndTarget = static_cast<HWND>( target.ToPointer() );

        if( RegisterRawInputDevices( &device, 1, sizeof(RAWINPUTDEVICE) ) <= 0 )
            throw gcnew Win32Exception();

        if (addThreadFilter)
        {
            if( filter == nullptr)
                filter = gcnew InputMessageFilter();

            Application::AddMessageFilter( filter );
        }
    }

Original issue reported on code.google.com by hirotona...@hotmail.com on 1 Feb 2013 at 10:15