Hello everyone.

We have decided to phase out the Mixed Reality Forums over the next few months in favor of other ways to connect with us.

The first way we want to connect with you is our mixed reality developer program, which you can sign up for at https://aka.ms/IWantMR.

The plan between now and the beginning of May is to clean up old, unanswered questions that are no longer relevant. The forums will remain open and usable.

On May 1st we will be locking the forums to new posts and replies. They will remain available for another three months for the purposes of searching them, and then they will be closed altogether on August 1st.

So, where does that leave our awesome community to ask questions? Well, there are a few places we want to engage with you. For technical questions, please use Stack Overflow, and tag your questions using either hololens or windows-mixed-reality. If you want to join in discussions, please do so in the HoloDevelopers Slack, which you can join by going to https://aka.ms/holodevelopers. And always feel free to hit us up on Twitter @MxdRealityDev.

HMD SpatialLocator in Win32 app requires UAC using Windows 10 April 2018 Update 1803


I have successfully gotten HMD pose from Windows.Perception.Spatial.SpatialLocator class in a Win32 app. I did this by compiling the project with C++/Cx enabled and pointing my VS project property pages to the the right #using folders:

C:\Program Files (x86)\Windows Kits\10\UnionMetadata\10.0.17134.0;
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\VC\vcpackages

When I build, I can sample HMD pose using the following code on 1703 (2018 Fall Creators Update Windows 10):


Windows::Globalization::Calendar^ c = ref new Windows::Globalization::Calendar;
SpatialLocator ^m_locator = SpatialLocator::GetDefault();
SpatialStationaryFrameOfReference^ m_referenceFrame = m_locator->CreateStationaryFrameOfReferenceAtCurrentLocation();

while (true)
    if (m_locator->Locatability == SpatialLocatability::PositionalTrackingActive)
        SpatialLocation^ head_pose = m_locator->TryLocateAtTimestamp(Windows::Perception::PerceptionTimestampHelper::FromHistoricalTargetTime(c->GetDateTime()), m_referenceFrame->CoordinateSystem);

        if (head_pose != nullptr)
            std::cout << "ROT: {" << head_pose->Orientation.w << ", " << head_pose->Orientation.x << ", " << head_pose->Orientation.y << ", " << head_pose->Orientation.z << "}" << std::endl;
            std::cout << "POS: {" << head_pose->Position.x << ", " << head_pose->Position.y << ", " << head_pose->Position.z << "}" << std::endl;



On version 1803, this code does not work as expected. I can see that the Locatability property changes, but every time it changes to "PositionActive" for example, it immediately changes Locatability back to "Unavailable" and TryLocateAtTimestamp() always returns null.

After trying a few things, I found out that if I launch my .exe using "Run as Administrator..." in the explorer, the code behaves as expected and I am able to get the pose of the HMD.

Is this a bug? Is there a way to grant permission to use the HMD in a win32 .exe without having to run the .exe as administrator?


Sign In or Register to comment.