Page 1 of 1
OSK under Windows 10
Posted: Tue Mar 17, 2020 5:15 am
by AUGE_OHR
hi,
i have read
https://www.hmgforum.com/viewtopic.php?p=35243
i try VirtualKeyboard.OPEN SHOW under 32 Bit but it does not show
also %windir%\system32\osk.exe does not show OSK ... hm ...
under System -> Setup -> Keyboard i saw OSK was disable ... so i enable it
when now try VirtualKeyboard.OPEN SHOW or %windir%\system32\osk.exe it does DISABLE that Setting
so it try
and
and that is the Way it work now under Window 10 ...
it turn On/Off Switch under Setup -> Keyboard and OSK.EXE appear / disapear
Re: OSK under Windows 10
Posted: Tue Mar 17, 2020 11:15 pm
by AUGE_OHR
hi,
i can call OSK.EXE using my new #xtranslate ... but i have "no Handle" -> no Control
so i look for HMG_VirtualKeyboardGetHandle*** and add some Variable for Debug
*** c:\hmg.3.4.4\SOURCE\h_dialogs.prg
Code: Select all
FUNCTION __VirtualKeyboardGetHandle
__THREAD STATIC hWnd := 0
LOCAL i, nProcessID, aProcess, cProcess, cFound
LOCAL cSeek := VirtualKeyboard.FILENAME
// IF IsValidWindowHandle (hWnd) == .F.
hWnd := 0
aProcess := EnumWindows ()
ALTD()
FOR i = 1 TO HMG_LEN (aProcess)
nProcessID := 0
cProcess := aProcess[i]
GetWindowThreadProcessId (cProcess, NIL, @nProcessID)
// this line fail
cFound := GetProcessImageFileName(nProcessID)
IF HMG_UPPER (cSeek) $ HMG_UPPER (cFound)
hWnd := aProcess[i]
EXIT
ENDIF
NEXT
// ENDIF
RETURN hWnd
my "Problem" are GetProcessImageFileName() which is EMPTY() ...
i got the right nProcessID (PID) from GetWindowThreadProcessId() but i can“t get Name with GetProcessImageFileName()***
*** c:\hmg.3.4.4\SOURCE\c_winapimisc.c

- OSK_PID.JPG (172.42 KiB) Viewed 8475 times
so what i`m doing wrong
is it a "Right" Problem of GetProcessImageFileName()
https://docs.microsoft.com/en-us/window ... efilenamea
Re: OSK under Windows 10
Posted: Wed Mar 18, 2020 5:50 am
by AUGE_OHR
hi,
i found a Sample c:\MiniGUI\SAMPLES\Advanced\GETTASKS\demo.prg ... but it does not show OSK.EXE
when using Xbase++ with Ot4xb it get OSK.EXE -> "Bildschirmtastatur".

- OSK_Title.jpg (248.54 KiB) Viewed 8453 times
i "think" the Problem is that OSK.EXE have no "Process Name" so it is not shown in MiniGUI Sample.
i have try
Code: Select all
*cFound := GetProcessImageFileName(nProcessID)
*cFound := GETPROCESSNAME(nProcessID)
*cFound := GETPROCESSFULLNAME(nProcessID)
cFound := cPid2ModName(nProcessID)
hProcess := OpenProcess(PROCESS_VM_READ+PROCESS_QUERY_INFORMATION,.F.,nPid)
when PID is 6744 (in this Sample) -> hProcess = 0
work with other PID (when have Process Name like Explorer)
---
i have try Tasklist and search for OSK.EXE ... not found but "Bildschirmtastatur" work.
as it is only a Solution for German User it does not satisfy what i want.
Question : how to get Handle of OSK.EXE Windows

Re: OSK under Windows 10
Posted: Wed Mar 18, 2020 9:23 am
by dragancesu
Re: OSK under Windows 10
Posted: Thu Mar 19, 2020 3:20 am
by AUGE_OHR
hi,
thx for Tip.
i have made a Xbase++ as "Stand-alone" but only for QWERTZ.

- OSK_DE.jpg (104.33 KiB) Viewed 8022 times
it also have anmation to "fly-away"

- OSK_FlyKey.jpg (95.56 KiB) Viewed 8022 times
---
when try in CMD Box (as User)
i got Error
FEHLER: Der Prozess "osk.exe" mit PID 10040 konnte nicht beendet werden.
Ursache: Zugriff verweigert
---
https://stackoverflow.com/questions/423 ... windows-10
if you looking to manifest of osk.exe you can view here next - uiAccess="true" this is User Interface Privilege Isolation (UIPI) , also read about similar problem UIAccess in Manifest Files
because osk.exe have uiAccess="true" in manifest it have Mandatory Label\High Mandatory Level in token. but your app, if running under UAC not elevated, usual have Medium Mandatory Level. as result:
A lower-privilege process cannot:
Use SendMessage or PostMessage to application windows running with higher rights. These APIs return success but silently drop the window message.
so you need have <requestedExecutionLevel level='requireAdministrator' uiAccess='false'/> in manifest or somehow run your application as elevated
---
Designing Applications to Run at a Low Integrity Level
https://docs.microsoft.com/en-us/previou
seems some more Work to close OSK.EXE ...
Re: OSK under Windows 10
Posted: Fri Mar 20, 2020 5:27 am
by AUGE_OHR
hi,
i found a Solution with WMI
Code: Select all
FindAndCloseProcress( "OSK.EXE" )
FUNCTION FindAndCloseProcress( cApp )
LOCAL oProcesses, oProcess, oWMI, oLocator
LOCAL lRet := .F.
oLocator := CreateObject( "wbemScripting.SwbemLocator" )
IF EMPTY( oLocator )
msginfo( "can not create wbemScripting.SwbemLocator" )
RETURN .F.
ELSE
oWMI := oLocator:ConnectServer()
ENDIF
IF EMPTY( oWMI )
msginfo( "can not connect oLocator:ConnectServer()" )
RETURN .F.
ELSE
oProcesses = oWMI:ExecQuery( "SELECT * FROM Win32_Process" )
IF oProcesses:Count > 0
FOR EACH oProcess in oProcesses
IF UPPER( TRIM( oProcess:Name ) ) = cApp
// msginfo( "terminate " + cApp )
oProcess:Terminate( 0 )
lRet := .T.
EXIT
ENDIF
NEXT
ENDIF
ENDIF
oProcesses := NIL
oWMI := NIL
oLocator := NIL
RETURN lRet
it work also for other Apps
