11-25-2009 10:31 AM
I am developing a touchscreen application, where touching the screen acts as a "Mouse Down" at a particular screen location. While this VI is running, I naturally want the mouse cursor to disappear.
I originally coded this using a technique I picked up within the NI site that involved making User32 library call to the Microsoft ShowCursor routine (I think that's what it was called). During development on my PC, I simply didn't call this routine (otherwise I had a lot of trouble clicking with an "invisible" mouse!).
When I entered the Testing phase with the real touchscreen, it worked fine during short demos. But I started to get reports that the routine would "hang" (mind you, it's got a lot of internal timing and should beep and complain if you don't respond by touching the screen), and could only be "fixed" by a Ctrl-Alt-Del and killing the program. Turning off the "Hide cursor" routine seemed to fix the hanging problem, suggesting a subtle "bug/feature" that I suspect is difficult to find.
I turned to a different technique that (so far) seems to work, namely using the LabVIEW "Cursor" routines (found on the Dialog and User Interface palette) and loading a blank cursor (do a search for "Null.cur" on the Web). While it is pretty easy to turn the cursor off, getting it to come back on took some experimentation. In addition, I wanted to encapsulate this functionality in a sub-VI, but the "hidden cursor" property is window-specific. Since my application runs at the top level, I added code to specifically turn the cursor on and off on the top level VI.
I've attached a .ZIP file with the blank cursor, my "hide cursor" VI, and a test VI that simply calls the hide cursor VI several times, turning the cursor on and off so you can see the effect. I want to acknowledge the help of NI's Bob Hoffman who helped me find the cursor routines in LabVIEW.
Bob Schor
12-08-2009 06:58 AM