3

I see the following in the Explorer:

enter image description here

Now I try to run it using

Shell "C:\Windows\System32\osk.exe", vbNormalFocus

It fails, saying "File not found".

I am confused.

I call:

Shell "C:\Windows\SysWOW64\osk.exe", vbNormalFocus

The same error occurs.

When I use the following function to check for the existance, it also returns False.

Public Function FileExists(ByVal uPath As String) As Boolean

    Const NotFile = vbDirectory Or vbVolume
    
    On Error Resume Next
    FileExists = (GetAttr(uPath) And NotFile) = 0
    On Error GoTo -1
  
End Function

I am really baffled what might be going on here.

tmighty
  • 10,734
  • 21
  • 104
  • 218
  • No idea what you're seeing, but since this is a system file, you shouldn't need to specify a path. Try just "osk.exe". – Jim Mack Jun 10 '22 at 14:06
  • 2
    Perhaps this could help? https://stackoverflow.com/questions/56227658/how-to-start-the-on-screen-keyboard-program-from-within-a-vb-6-legacy-applicatio – User51 Jun 10 '22 at 14:25

1 Answers1

0

Windows has a feature for 32 bit programs only. To 32 bit programs C:\Windows\SysWOW64\osk.exe is exactly the same file as C:\Windows\System32\osk.exe (but not to 64 bit) and both refer to C:\Windows\SysWOW64\osk.exe.

So for a 32 bit program to access System32 it needs to use a special name - C:\Windows\SysNative\osk.exe. Note the file redirector will look after it - there is no folder of that name.

Using that path on a 64 bit program will cause an error. Only 32 bit programs need it and only they can use it.

user18521918
  • 102
  • 1
  • 1
  • 3