Live-Forum - Die aktuellen Beiträge
Anzeige
Anzeige
HERBERS
Excel-Forum (Archiv)
20+ Jahre Excel-Kompetenz: Von Anwendern, für Anwender
Inhaltsverzeichnis

Bildschirmtastatur Windows Tablet

Forumthread: Bildschirmtastatur Windows Tablet

Bildschirmtastatur Windows Tablet
25.05.2018 13:24:11
Phil
Hallo Zusammen,
ich würde gerne automatisch die Bildschirmtastatur auf meine Windows-Tablet einblenden lassen, wenn ich in eine Textbox klicke. Leider habe ich keinen Ahnung wie ich das umsetzten soll.
Vielen Dank
Anzeige

1
Beitrag zum Forumthread
Beitrag zu diesem Forumthread

Betreff
Datum
Anwender
Anzeige
AW: Bildschirmtastatur Windows Tablet
25.05.2018 14:04:43
Nepumuk
Hallo Phil,
im Modul deiner UserForm:
Private Sub TextBox1_Enter()
    Call LoadScreenKeyboard
End Sub

Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
    Call UnloadScreenKeyboard
End Sub

In einem Standardmodul:
' **********************************************************************
' Modul: basKeyboard Typ: Allgemeines Modul
' **********************************************************************

Option Explicit
Option Private Module

Private Declare PtrSafe Function GetCurrentProcess Lib "kernel32.dll" () As LongPtr
Private Declare PtrSafe Function IsWow64Process Lib "kernel32.dll" ( _
    ByVal hProcess As LongPtr, _
    ByRef Wow64Process As LongPtr) As Long
Private Declare PtrSafe Function ShellExecuteA Lib "shell32.dll" ( _
    ByVal Hwnd As LongPtr, _
    ByVal lpOperation As String, _
    ByVal lpFile As String, _
    ByVal lpParameters As String, _
    ByVal lpDirectory As String, _
    ByVal nShowCmd As Long) As Long
Private Declare PtrSafe Function Wow64EnableWow64FsRedirection Lib "kernel32.dll" ( _
    ByVal Enable As Boolean) As Boolean

Private Const SW_SHOWNORMAL As Long = 1&

Public Sub LoadScreenKeyboard()
    Dim lngptrIsWow64 As LongPtr, lngptrProcess As LongPtr
    lngptrProcess = GetCurrentProcess
    Call IsWow64Process(lngptrProcess, lngptrIsWow64)
    If lngptrIsWow64 = 0 Then
        Call ShellExecuteA(Application.Hwnd, "open", "osk.exe", vbNullString, "C:\Windows\System32\", SW_SHOWNORMAL)
    Else
        Call Wow64EnableWow64FsRedirection(False)
        Call ShellExecuteA(Application.Hwnd, "open", "osk.exe", vbNullString, "C:\Windows\System32\", SW_SHOWNORMAL)
        Call Wow64EnableWow64FsRedirection(True)
    End If
End Sub

Public Sub UnloadScreenKeyboard()
    Dim objWMI As Object, objProcessList As Object, objProcess As Object
    Set objWMI = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
    Set objProcessList = objWMI.ExecQuery("SELECT * FROM Win32_Process WHERE Name = 'osk.exe'")
    For Each objProcess In objProcessList
        Call objProcess.Terminate
    Next
    Set objProcessList = Nothing
    Set objWMI = Nothing
End Sub

Gruß
Nepumuk
Anzeige
;

Beliebteste Forumthreads (12 Monate)

Anzeige
Anzeige
Entdecke mehr
Finde genau, was du suchst

Die erweiterte Suchfunktion hilft dir, gezielt die besten Antworten zu finden

Suche nach den besten Antworten
Unsere beliebtesten Threads

Entdecke unsere meistgeklickten Beiträge in der Google Suche

Top 100 Threads jetzt ansehen
Anzeige