Ceci est une page optimisée pour les mobiles. Cliquez sur ce texte pour afficher la vraie page.

XL 2021 clavier tactile en vba

tony rital

XLDnaute Nouveau
Supporter XLD
Bonjour à tous,

je souhaiterais savoir comment faire pour avoir accès à un clavier virtuel de ma tablette dans mon userform ci joint merci de votre aide
 

Pièces jointes

  • APPLI2425.xlsm
    532.1 KB · Affichages: 6

fanch55

XLDnaute Barbatruc
Comme vous avez de nombreux userforms , je vous laisse décider duquel modifier :
VB:
Const Kb_Pgm = "Osk.exe"
Private Sub UserForm_Initialize()
    CreateObject("Shell.Application").shellexecute _
        CreateObject("Scripting.FileSystemObject").GetSpecialFolder(1) & "\" & Kb_Pgm
    Me.Repaint
   ' ......
   ' ......
End Sub

Private Sub UserForm_Terminate()
    Set Svc = GetObject("winmgmts:root\cimv2")
        For Each Oproc In Svc.execQuery( _
            "select * from win32_process " & _
            " where name like '" & Kb_Pgm & "'")
            Oproc.Terminate
        Next
        Set Oproc = Nothing
    Set Svc = Nothing
End Sub
 

patricktoulon

XLDnaute Barbatruc
re
@fanch55
ca ne fonctionne pas chez moi
il arrive parfois que vous ayez l'erreur "chemin introuvable"
même si le chemin est correct
c'est peut être là a cause du statut grant administrator
même avec la mienne shell cmd
Code:
Private Sub OpenVirtualKeyboard1()
   keyboard = Shell("CMD /C " & """" & "C:\Windows\System32\osk.exe" & """")
End Sub
Alors aux grand mot les grands remèdes
VB:
Option Explicit

Type SHELLEXECUTEINFO
    cbSize As Long: fMask As Long: hwnd As Long: lpVerb As String: lpFile As String: lpParameters As String: lpDirectory As String: nShow As Long
    hInstApp As Long: lpIDList As Long: lpClass As String: hkeyClass As Long: dwHotKey As Long: hIcon As Long: hProcess As Long
End Type

#If VBA7 Then
    Public Declare PtrSafe Function ShellExecuteEx Lib "shell32.dll" (lpExecInfo As SHELLEXECUTEINFO) As LongPtr
    Declare PtrSafe Function Wow64DisableWow64FsRedirection Lib "kernel32.dll" (ByRef ptr As LongPtr) As Boolean
    Declare PtrSafe Function Wow64RevertWow64FsRedirection Lib "kernel32.dll" (ByRef ptr As LongPtr) As Boolean
#Else
    Public Declare Function ShellExecuteEx Lib "shell32.dll" (lpExecInfo As SHELLEXECUTEINFO) As Long
    Declare Function Wow64DisableWow64FsRedirection Lib "kernel32.dll" (ByRef ptr As Long) As Boolean
    Declare Function Wow64RevertWow64FsRedirection Lib "kernel32.dll" (ByRef ptr As Long) As Boolean
#End If

Sub OpenVirtualKeyboardApi()
    Dim shInfo As SHELLEXECUTEINFO, lngPtr As Long
    With shInfo
        .cbSize = Len(shInfo)
        .lpFile = "C:\Windows\Sysnative\cmd.exe"    'best to use Known folders here
        .lpParameters = "/c start osk.exe"
        .lpDirectory = "C:\windows\system32"    'best to use Known folders here
        .lpVerb = "open"
        .nShow = 0
    End With
    Call Wow64DisableWow64FsRedirection(lngPtr)
    Call ShellExecuteEx(shInfo)
    Call Wow64RevertWow64FsRedirection(lngPtr)
End Sub

on appelera "OpenVirtualKeyboardApi" ou on veut dans l'userform
 

Discussions similaires

Réponses
8
Affichages
547
Les cookies sont requis pour utiliser ce site. Vous devez les accepter pour continuer à utiliser le site. En savoir plus…