How to run osk.exe in Windows\System32 folder

Posted on 2014-09-24
Last Modified: 2014-09-26
Hi experts,

I have a problem of not being able to execute osk.exe in the Windows\System32 folder (from my VB6 app).

If I copy osk.exe to my App folder and execute it (programmatically using CreateProcess or Shell) then all's good but I'd rather not do that because that means I'll either need to copy it from the target Windows folder to my App folder at install time (which I may have problems anyway) or I'd need to supply it as part of install but I should really be using the app that is appropriate for the target environment rather than one that I supply.

Any help would be appreciated.

Question by:gem56
  • 4
  • 3
LVL 68

Expert Comment

ID: 40341220
What's the issue with calling osk from System32? It should just work.

Author Comment

ID: 40341449
When I execute Shell("C:\Windows\system32\osk.exe", vbNormalFocus) I get the following message "Could not start On-SCreen keyboard".
LVL 68

Accepted Solution

Qlemo earned 500 total points
ID: 40342341
That seems to happen on 64bit OS, when used in a 32bit app. The reason is that it starts the 32bit OSK (in C:\Windows\SysWoW64) instead of the required 64bit one. OSK starts, and then has issues with the OS.

You can check if there is a C:\Windows\SysNative (better %SystemRoot%\SysNative) folder - then use that one. If that folder is not found, use System32 instead.
Don't lose your head updating email signatures!

Do your end users still have the wrong email signature? Do email signature updates bore you or fill you with a sense of dread? You can make this a whole lot easier on yourself by trusting an Exclaimer email signature management solution. Over 50 million users should you!


Author Comment

ID: 40343318
Hi Qlemo,

Thanks for that but it still does the same thing although it works OK on my colleagues PC. I created a new project and added only about 6-7 lines of code and get that error (on Win 7) but on two Win 8 PC's it works OK so I guess it must be something to do with my PC.

LVL 68

Expert Comment

ID: 40344018
Try manually to cross-check: Start Explorer, go to SysWOW64 and start OSK => error. Start from System32, and it works. SysNative is System32 on x64.

Author Comment

ID: 40346232
Hi Qlemo,

I tried both of those and there's no problems running the (osk.exe) App. I then (programmatically) copied the App to various folders and run it from there but again the same problem. It appears that an app from System32 and SysWOW64 (on my Win7) can't be executed programmatically unless a security/privilege setting is adjusted however my colleague can execute the App on his Win8. As soon as I get a chance I’ll try the same on another Win7 and see how I go.

Thanks for all your suggestions.
LVL 68

Expert Comment

ID: 40346332
Sorry, I have been wrong with my troubleshooting steps, it indeed works when following http:#a40344018.
The accepted comment is still correct. On a 64bit system, call SysNative\OSK.exe, on a 32bit system System32\OSK.exe. It doesn't matter whether the starting process is 64bit or 32bit, and you only have issues with 32bit app on 64bit OS.

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
adobe acrobat scaning 9 49
prezi for presentation 2 44
How to open a .vcf file 11 51
Wants to Upgrade fro Vista to Windows 10 9 12
NTFS file system has been developed by Microsoft that is widely used by Windows NT operating system and its advanced versions. It is the mostly used over FAT file system as it provides superior features like reliability, security, storage, efficienc…
When we want to run, execute or repeat a statement multiple times, a loop is necessary. This article covers the two types of loops in Python: the while loop and the for loop.
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.

919 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now