Sver
Full Member
Posts: 145
|
Post by Sver on Nov 27, 2023 3:44:36 GMT -5
'onscreen keyboard
C:\Windows\System32\osk.exe doesn't work with RUN
but you can make a shortcut, then (name: Onscreen keyboard )
run "explorer Onscreen keyboard.lnk"
|
|
|
Post by tsh73 on Nov 27, 2023 4:59:24 GMT -5
Disclaimer: I officially do not know what I am doing while calling API. Use at your own discretion. Some googling - stack overflow - stackoverflow.com/questions/50510093/using-windows-10-on-screen-keyboard-in-qt-app/50510526#50510526Relevant quote: So. Apparently LB is 32 bit, but Windows nowadays 64. So this snippet works for me (but I do not know what harm Wow64DisableWow64FsRedirection could cause) '#include <shellapi.h>
'void *was; 'Wow64DisableWow64FsRedirection (&was); 'ShellExecuteA (NULL, "open", "osk.exe", NULL, NULL, SW_SHOWNORMAL); 'Wow64RevertWow64FsRedirection (was);
'run "osk.exe"
'was$=string$(4000); 'buf
'Wow64DisableWow64FsRedirection (&was); CallDLL #Kernel32, "Wow64DisableWow64FsRedirection", was$ as ptr, ret as ulong print "ret=", ret
'ShellExecuteA (NULL, "open", "osk.exe", NULL, NULL, SW_SHOWNORMAL); showWindow = 1 CallDLL #shell32, "ShellExecuteA",_ 0 as ulong, "open" as ptr,_ "osk.exe" as ptr, 0 as ulong,_ 0 as ulong, showWindow as long, ret as ulong
print "ret2=", ret
'Wow64RevertWow64FsRedirection (was); ' CallDLL #Kernel32, "Wow64RevertWow64FsRedirection", was$ as ptr, ret as ulong print "ret3=", ret
|
|
|
Post by Brandon Parker on Nov 28, 2023 23:02:41 GMT -5
Unless you explicitly open the kernel32.dll as "#Kernel32" in your code, you will have to change the handle to "#kernel32" for the calls to the redirect functions to work.
For the Wow64DisableWow64FsRedirection and Wow64DisableWow64FsRedirection functions, I would use a "long" as their return type.
Other than that, it looks like it works as intended and is a great use for the two functions since I think it has been some time since the 32-bit version of osk.exe was in the SysWOW directory.
{:0)
Brandon Parker
|
|
|
Post by meerkat on Nov 29, 2023 7:02:19 GMT -5
I'm using Run Basic. There are lots of Virtual keyboard interfaces available. For example: Virtual KeyboardI prefer to use a Javascript interface since it's easy to create your own keyboard actions via program control.
|
|
|
Post by xxgeek on Nov 29, 2023 15:15:11 GMT -5
'onscreen keyboard C:\Windows\System32\osk.exe doesn't work with RUN but you can make a shortcut, then (name: Onscreen keyboard ) run "explorer Onscreen keyboard.lnk"
It works! Thanks Been looking for a good way to open the Onscreen Keyboard in code. 'Make Desktop Shortcut to OnScreen Keyboard and RUN it - using VB Script 'Does NOT leave the shortcut behind after opening Onscreen KeyBoard 'by xxgeek 'Nov 2023 'an example to use in code to create desktop shorcuts nomainwin filepath$ = "c:\Windows\System32\osk.exe" 'or use the filedialog line above to choose nameOffile$ = "Onscreen Keyboard" ' Give the Shorcut a Desired Name call MDS 'call sub MakeDesktopShortcut(MDS) to write a VB Script that creates the shortcut run "explorer ";nameOffile$;".lnk" 'opens the file with asscociated program kill DefaultDir$;"\desktopShortcut.vbs" end
'write/run a vbs script to create a desktop shortcut to selected file and open it in an asscociated program. sub MDS q$=chr$(34) global filepath$, nameOffile$ desktopShortcut$ = "desktopShortcut.vbs" open desktopShortcut$ for output as #1 #1 "Set Shell = CreateObject(";q$;"WScript.Shell";q$;")" #1 "DesktopPath = Shell.SpecialFolders(";q$;"Desktop";q$;")" #1 "Set link = Shell.CreateShortcut(DesktopPath & ";q$;"\";nameOffile$;".lnk";q$;")" #1 "link.Description = ";q$;"Shortcut to ";filepath$;q$ #1 "link.TargetPath = ";q$;filepath$;q$ #1 "link.Save" #1 "Set link = nothing" #1 "Set Shell = nothing" close #1 run "wscript ";desktopShortcut$ call pause 500 end sub
'sub to create pauses in program sub pause mil t=time$("ms")+mil while time$("ms")<t scan wend end sub
|
|
|
Post by Chris Iverson on Nov 30, 2023 2:01:01 GMT -5
The SysNative special folder is supposed to be able to do this, but it doesn't seem to work quite right in LB. Or maybe it's an issue with the system? I can't get it to work properly in C, either.
The SysNative special folder is exactly that: a non-existent folder that signals to the Wow64 redirection layer that you're trying to access the actual 64-bit executables in C:\Windows\System32. It ONLY works if you're running as a 32-bit process under Wow64. It won't work if you're running it on 32-bit Windows, or if a 64-bit process tries to use it.
run "C:\Windows\SysNative\osk.exe"
This doesn't work, but from my understanding of the SysNative folder, it should.
However, you CAN use the SysNative special folder to invoke the 64-bit command prompt, and launch the OSK from there.
run "C:\Windows\SysNative\cmd.exe /c start osk.exe"
(I use "start" so that the CMD window disappears)
The SysNative folder definitely works for other things, so I don't know why it doesn't work for OSK.
|
|
|
Post by tsh73 on Nov 30, 2023 4:50:32 GMT -5
This solution
run "C:\Windows\SysNative\cmd.exe /c start osk.exe" is really nice.
Does it work for Win 11?
|
|
|
Post by xxgeek on Nov 30, 2023 8:39:47 GMT -5
Well that sure beats writing and running a VB Script, thanks for posting Chris. Something I have not heard mentioned before.
It opens the door to many other 64 bit programs in System32.
|
|
Sver
Full Member
Posts: 145
|
Post by Sver on Dec 1, 2023 5:33:58 GMT -5
Thanks all ! Hide the cmd window. run "C:\Windows\SysNative\cmd.exe /c start osk.exe" ,HIDE
|
|