In my WinRT application running on an ARM tablet (ie Surface), I'm trying to get events from the accelerometer sensor but it's not working. I attach to it this way, basically from Microsoft's example:
mAccelerometer = Accelerometer::GetDefault();
mListenerToken = mAccelerometer->ReadingChanged::add(ref new TypedEventHandler<Accelerometer^, AccelerometerReadingChangedEventArgs^>(this, &AccelerometerWin8Delegate::ReadingChanged));
Unfortunately, this doesn't work. When an accelerometer event occurs, instead of getting my handler called, I get an error message in the output.
First-chance exception at 0x7539396B (KernelBase.dll) in EAMTestApp.exe: 0x40080202: WinRT transform error (parameters: 0x80004002, 0x00000000, 0x00000027, 0x04B1F280).
The exception is thrown in KernelBase.dll!7539396a()
Any idea what could be causing this? The error message is very cryptic.
I've run the Microsoft example here with no problems on the Surface.
User contributions licensed under CC BY-SA 3.0