Wim Posted July 6, 2011 Report Share Posted July 6, 2011 All, I'm working on a project that will have a touchscreen in a separate room. I want to open the windows on screen keyboard. I attached a snippet. This opens the on screen keyboard in Win XP, VISTA but it does not work on Win7 Can someone help me out ? Thanks. EDIT: If I manually type the command then it opens the osk, but with LabVIEW it doesn't work. Quote Link to comment
BigAngryHillMan Posted July 6, 2011 Report Share Posted July 6, 2011 I cant tell you why it is not working on your windows 7, but I can tell you that your code snippet works on my windows 7 home edition premium. I hope that is some help. Quote Link to comment
Jordan Kuehn Posted July 6, 2011 Report Share Posted July 6, 2011 (edited) Perhaps this will be of some help. Also, your snippet fails to open it on my Win 7 Pro machine. Edited July 6, 2011 by jkuehn Quote Link to comment
Wim Posted July 7, 2011 Author Report Share Posted July 7, 2011 Perhaps this will be of some help. Also, your snippet fails to open it on my Win 7 Pro machine. I have the same problem as the last post there. For now I have a workaround. i copied the osk from WinXP and renamed the exe. I put this exe into my project and i can open it. For now this is ok. But it would be better if i can just open the osk form the operating system. Cheers Quote Link to comment
Norm Kirchner Posted July 27, 2011 Report Share Posted July 27, 2011 Although different...just tossing this out there http://screencast.com/t/PseOPTRZ LEGACY - STD Keyboard.zip Good luck ~,~ The Captain 1 Quote Link to comment
Wim Posted July 28, 2011 Author Report Share Posted July 28, 2011 Thanks Norm, looks nice. For now i'm staying with the windows XP OSK but when i have some time remaining on the project I'm going the use this one. Regards, Wim Quote Link to comment
Popular Post Saverio Posted July 28, 2011 Popular Post Report Share Posted July 28, 2011 (edited) The likely reason why it's not working is that you're probably using 32-bit LabVIEW, but running on a 64-bit OS. Windows is not allowing you to call the osk.exe that it comes with since it's 64-bit. When you copied the osk.exe from Windows XP you copied the 32-bit version, and that's why it worked. If you were running LabVIEW 64-bit you wouldn't have an issue. You could try to use the Wow64DisableWow64FsRedirection function (http://msdn.microsof...v=vs.85%29.aspx) but I've never done this myself. Follow-up: Attached is a LV2009 VI that you can try. Note that the VI is configured to run in the UI thread. I have the 32-bit version of LV2009 and am running Win 7 64-bit and this VI launched the on-screen keyboard. EDIT: I made a wiring error on my previous upload. run osk.vi Edited July 28, 2011 by Saverio 3 Quote Link to comment
Wim Posted July 29, 2011 Author Report Share Posted July 29, 2011 Saverio, this is great. Thanks. Wim Quote Link to comment
Saverio Posted August 4, 2011 Report Share Posted August 4, 2011 Did you make sure to set the VI's execution thread to "UI" as I had indicated? It won't work if you don't. 1 Quote Link to comment
Saverio Posted August 5, 2011 Report Share Posted August 5, 2011 You could simply use taskkill: Quote Link to comment
Saverio Posted August 8, 2011 Report Share Posted August 8, 2011 Yes, you may need admin privilege, depending on the task. The taskkiil command has a /u and /p parameter for specifying a username and password to use so the command can be run under that account. Of course, if it's the admin account, anybody who can see the code would also see the password... An alternative is to send the window the WM_CLOSE message, which tells it to close. You can do this with the SendMessage Windows API function, as shown in attached example. Send WM_CLOSE Message.vi Quote Link to comment
Saverio Posted August 11, 2011 Report Share Posted August 11, 2011 You cannot send messages from a process that has lower-level access (such as user-level) to a process that has higher-level (such as admin-level) access. However, I don't believe that launching osk in the fashion that I had provided would cause it run under admin privilege. I don't have time to play with this this morning, but I'll try to look at it later this afternoon. Quote Link to comment
asbo Posted August 11, 2011 Report Share Posted August 11, 2011 FWIW, the WM_CLOSE method works fine on a copy of the OSK I launched from the start menu. I do have UAC disabled, however. Quote Link to comment
asbo Posted August 12, 2011 Report Share Posted August 12, 2011 So my problem persists: spawn On-Screen Keyboard from with LabVIEW, and shut it down when the application closes. I've only done it before with calls relating to shutdown/standby/hibernation, but you should be able to acquire a security token for your application which grants you elevated privileges. I did not deal with UAC, but I know that UAC is compatible with the token system. Poke around on MSDN for some details. It's common to use application manifest files to require these privileges but you can do it programmatically with the Windows API as well. I may be writing a wrapper for the WLAN API soon, so this might be helpful to me as well. If I find some spare time, I'll have a look as well. Quote Link to comment
Saverio Posted August 18, 2011 Report Share Posted August 18, 2011 codeproject.com has several articles on doing impersonation in .NET for this sort of thing. I used one of these in the in-house application I developed at work. Here's one: http://www.codeproject.com/KB/cs/cpimpersonation1.aspx and another: http://www.codeproject.com/KB/cs/zetaimpersonator.aspx and another: http://www.codeproject.com/KB/dotnet/UserImpersonationInNET.aspx Thus, you could take that code and use the assemblies they provide. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.