Programming Considerations for Sensors on Ultrabook™ Convertibles

I recently had the chance to interview Mark Davis about a Map Panning Application that he wrote that takes advantage of Windows 8* Ultrabook(tm) Sensors.  He ran into some interesting issues along the way.

Ultrabook convertibles come in a variety of configurations.  Some are similar to a "clam-shell" that convert to a slate (but still attach to the keyboard); some are "detachable" where the keyboard can be completely removed.

Mark demonstrates what happens when this convertible is transitioned to a slate.

Mark demonstrates what happens when this convertible becomes a slate.

In each case, even if the keyboard does not detach, the system may think it is always a slate or always a clam-shell.  Some systems can detect when they have been converted to slate mode and an event will be sent so that the software can make adjustments to function correctly in whichever mode the system is in.

Watch this video and see what Mark has to say about his application and what software developers need to take into considerations when designing sensor apps for Ultrabook Convertibles.

If you cannot access You Tube watch it here.

View Gael Hofemeier's profile on LinkedIn

For more complete information about compiler optimizations, see our Optimization Notice.


wagenheimer's picture

Is there now a correct way of detecting this? I was using  GetSystemMetrics()  but my game failed on "Windows Store Validation" because of this!

Please, any help would be very appreciated! Thanks!

ghhofeme's picture

Thank you for your very quick response, Mark!

Hey Peter,

Convertible detection is tricky and I’ve been holding off on releasing sample code until I can find a general purpose solution. The method I used in the video was a PInvoke call to GetSystemMetrics() in User32.dll but there are two issues with this method. The first issue requires the OEM to use a particular video driver that supports system metric 0x2003. The second issue involves Windows Store certification. Win32 interop with User32.dll is not supported and any app submitted will not pass certification. I’m investigating other more generic solutions using the Windows Runtime sans PInvoke and will certainly post a sample when these issues have been resolved. As convertibles continue to gain in popularity, we can only hope that Microsoft will add support for detecting form factor change on par with orientation change. Knowing these issues exist, any app you develop should employ alternate methods mentioned in the video. Giving the user a manual way to switch (and then remember the chosen setting as it relates to current sensor data) is mandatory. Adding additional logic to reorient if they are staring at the sky or the ground is also a good idea. Consider all these things (as well as the complete lack of sensors as they are not required in windows 8) when developing your apps.

Disclaimer: I’m an outsourced independent contractor. My comments do not represent Intel.


ghhofeme's picture

Hi - just to be sure, did you click on the "Map Panning Application" link in the first paragraph? That is where you can download the code.

Also - I have been in contact with the author of the code and he is hoping to respond very soon.

The linked article about the map panning app says it's written using WinJS, but doesn't include details on detecting slate mode from Javascript. I couldn't find anywhere to download the source. Did you use WinJS to detect slate mode? If so, how? If not, what did you do instead?

Edit: OK, I found the source code, but it has nothing about detecting slate/clamshell mode. The article on detecting slate/clamshell uses C++, so it would be nice to see a code sample that does that and also uses WinJS for the other stuff.

Add a Comment

Have a technical question? Visit our forums. Have site or software product issues? Contact support.