12-07-2012 04:18 PM
I am developing an application that must be always-on-top, even on top of the Metro UI.
My application is home control for disabled people. I'm developing it for my father, who has ALS, and thought it could help other people too.
I need to have a universal "start" box that can launch/hide the home control window, as well as fire events to other parts of the windows operating system.
The home control part of the program needs to be on top of everything, including metro, so that he can turn lights on and off, adjust temperature, etc without going back to the desktop.
One reason for this "start" box is that eventually he will require the use of a joystick control, then a mouth controlled mouse, then eye tracking, and finally after all of his motor neurons are toasted I am experimenting with an Emotive EEG headset to somehow control the setup.
I hope I have described sufficiently why the control interface, which has been customized not for touch or muscle dexterity, must be on top at all times. : )
I have read from several places HOW to get Metro on-top support.
http://blogs.microsoft.co.il/blogs/pavely/archive/2012/05/16/windows-8-topmost-vs-topmost.aspx
http://msdn.microsoft.com/en-us/library/ms742884.aspx
Can I demand uiAccess for the Labview exe in general, and without compiling an exe have the front panel be on top?
Can I demand uiAccess for a compiled LabView vi?
I'm hoping someone can try this out for me. I don't have Windows 8 yet. I have ordered a TouchSmart computer from HP (he can move his hands and arms NOW, but not forever) but it will not arrive until a few days before Christmas.
I imagine this question can help a lot of other people too.
12-12-2012 11:23 AM
Logjam,
What a cool application! You should be able to demand access of the front panel of a VI by using property nodes within LabVIEW. There is a KnowledgeBase article on this issue here:
http://digital.ni.com/public.nsf/allkb/39C7E3007DA284B686256B2E005C46FC
One thing that might make this interesting is that you’re using Windows 8. NI does not officially support W8 as an OS yet, but we have done some testing and LabVIEW performance has not been shown to be limited. W8 runs fine, but you may run in to unexpected behavior, especially trying to utilize W8 UI functionality. It's just unpredictable at this point, but should be fully functional.
I hope this helps!
12-13-2012 09:54 PM
The property we need to set is topmost, not frontmost. I have done this before using user32 calls.
The problem I have is that no always-on-top windows are allowed on top of the Metro/Modern UI unless they demmand UIAccess.
I think what I need to do is edit the manifest file for LabVIEW.exe and change it to UIAccess=true.
Does anyone think this will work? Will I need to self sign LabVIEW.exe?
http://zone.ni.com/reference/en-XX/help/371361J-01/lvhowto/editing_app_manifests/
I've got the Windows 8 computer now, but appreciate any help. Christmas is coming soon and I want the window on top of metro when I give it to my Dad. : )
12-14-2012 06:23 PM
OK! I got the labview window to be on top of metro!!!!!
BUT! ... When I click on the window or move it I am returned to the windows desktop, so I have a little debugging to do...
What I did:
Created a sample VI that uses user32.dll to "SetWindowPos" topmost.
Edit the LabVIEW.exe manifest using ResourceTuner to say ...UIAccess="true"...
Now LabVIEW.exe's certificate is voided... : ( This was a head banging experience for me... So, from this information:
http://www.vbforums.com/showthread.php?672429-VS-Creating-your-own-code-signing-certificates
I did:
makecert -r -pe -a sha1 -n "CN=MyCompanyNameRoot, E=myname@example.com, C=US" -b 01/01/2012 -e 01/01/2050 -ss My
makecert -pe -a sha1 -n "CN=EmpOneCodeSigning, OU=www.example.com, C=US" -b 01/01/2012 -e 01/01/2050 -eku 1.3.6.1.5.5.7.3.3 -ss My -is My -in "MyCompanyNameRoot
Then I used certmgr.exe to export my private certs to a file, and imported them into the trusted root store. The computer complained about this about 3 times.
signtool.exe sign /a labview.exe
This resigned LabVIEW for only me. : ) Programs must be signed by a trusted root whatever to get UIAccess.
So, any ideas why when the LabVIEW program gets focus it goes to the Desktop? Taskmgr doesn't do this, and it can be on top of Metro...
Next I will try to compile a a standalone application, edit its manifest, sign it, and see if it has the same problem. All I want is a small toolbar on the screen AT ALL TIMES for my dad to easily get what he wants (home control program, WMC, weather station tool, etc). He will not be successful with Windows 8. He is 62, has used an iPad for only 2 years, and has never used any other computer EVER...and is loosing muscle strength fast.
12-14-2012 08:56 PM
I compiled an EXE with the right manifest, signed it, and ran it from a secure location. Still, when I click anywhere on the labview window I am returned to the desktop.
The window is STILL "always-on-top", and I can re-enter the "Start" screen where it will still be on top...
Does anyone know what UI events may be causing the change to desktop mode? I'd really like my dad to be able to pull up the main window, adjust some lights, and then still be in metro. I suppose I should learn how to go BACK to metro from a LabView VI and just make my control program full screen. : )
Currently my plan is to place a tool bar on the screen that launches his control program, weather station program, etc.
12-14-2012 10:15 PM
Using Windows Detective I was able to find two visible windows associated with my compilied vi. One had the window title of "Always On Top.vi" with LVDChild class. The other was called "Application" with LVFrame class. I was only setting the "Always On Top.vi" window to be on top. This strange LVFrame window has a size of 0,0 and location of -1,-1
I forced the "Application" window to be on top and now I can interract with my compilied LabVIEW application when it is on top of metro. As you would expect, clicking the toggle switch shown in the image above with metro open will cause the window to dissapear until you go back to the desktop.
This LVFrame window name will be the application's exe name minus the .exe. You can just do a find window for the name of your EXE, or using labview code look for a LVFrame class window within the same parent as the main VI.
Woohoo!