Doing my part to spark the economy I recently purchased a HP TouchSmart IQ506 PC.
Fairly nice looking computer that my stable of Apple machines aren’t embarrassed to be seen next to. The best part is that the screen is capable to multi-touch. It isn’t exactly surface on the cheap since it only picks up two contact points with the current driver, but it’s fairly accurate. My friend Kurt Brockett at our distinguished competition Identity Mine posted about getting the TouchSmart up and running on Windows 7. I wanted to write that first and call it “Kevin on 7″ but he beat me to it. Although he skipped out on giving me credit for telling him to download the original drivers from HP and use WinRar to extract the .exes instead of hunting down the Vista drivers for each item. In retaliation, I will not tell him what are the drivers for his two unknown devices.
Next step is to actually build something using Multi-touch. There isn’t a ton of information out there at the moment. You can watch this session from PDC – Windows 7: Developing Multi-touch Applications. The take away is that WPF 4.0 will have multi-touch support which looked cool, the WPF and Surface teams are working together so at some point there will be common interface for building multi-touch apps on Surface & Win 7 and right now you can use the real-time stylus APIs or unmanaged code for handling multi-touch. Using unmanaged code you can either handle WM_TOUCH or WM_GESTURE windows messages. If you handle the WM_TOUCH messages then you aren’t able to use their gesture recognition.
Since unmanaged code makes Kevin the Coder cower in fear, I found some sample code in one of the PDC labs that handles creating the necessary structs and pInvoking the right functions. It’s just a simple multi-touch line drawing app. To use this in your own code you can just add the WMTouchForm.cs class and inherit your form from that. You can then add handlers for TouchUp, TouchDown, and TouchMove.
Using the two contact points doesn’t really get you much without some gestures. Andy Wilson and Yang Li created a great “$1 Gesture Recognizer” that works in JS and C#. To start out I downloaded the C# version, added the WMTouchForm as a base class for the main form and rewired the mouse event to correspond to the multi-touch events with the new location data. You can download the modified version here.
Here are some samples of gestures I made:
One Finger Swipe
Two Finger Swipe
Two Finger Swipe Rotated
The $1 recognizer works pretty good considering I only loaded 1 sample of each of the four gestures. It’s also great at recognizing regardless of the rotation of the gesture. I’m going to work on adding in support for my own scaling and rotation gestures next. I looked at porting over the scatter view control from the surface sdk,but that quickly got out of hand. I think I’d be better off starting with a simple control with similar properties.
15 comments , permalink