Live-Forum - Die aktuellen Beiträge
Datum
Titel
28.03.2024 21:12:36
28.03.2024 18:31:49
Anzeige
Archiv - Navigation
1624to1628
Aktuelles Verzeichnis
Verzeichnis Index
Übersicht Verzeichnisse
Vorheriger Thread
Rückwärts Blättern
Nächster Thread
Vorwärts blättern
Anzeige
HERBERS
Excel-Forum (Archiv)
20+ Jahre Excel-Kompetenz: Von Anwendern, für Anwender
Inhaltsverzeichnis

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

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

Links zu Excel-Dialogen

Beliebteste Forumthreads (12 Monate)

Anzeige

Beliebteste Forumthreads (12 Monate)

Anzeige
Anzeige
Anzeige