clavier virutel windows

paskikic

XLDnaute Occasionnel
bonjour a vous tous les Xlnautes

je cherche a ouvrir mon clavier windows via excel lorsque je clic sur une cellules, j ai cherche sur le web mais pas de solutions trouvees.

ils partent tous de Shell "C:\WINDOWS\system32\osk.exe" mais je n arrive pas a le lancer!!!

qqn aurait il une idee

MERCI encore
 

Yurperqod

XLDnaute Occasionnel
Bonjour le forum

Quelle version de Windows utilisée?

Avec Windows 7, ces deux macros marchent.
VB:
Option Explicit
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hWnd As Long, ByVal lpOperation As String, _
ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Sub macro1()
ShellExecute 0, vbNullString, "osk.exe", vbNullString, "C:\", 1
End Sub
Sub macro2()
Dim appli
appli = Shell("c:\windows\system32\osk.exe", 1)
End Sub
 
Dernière édition:

Yurperqod

XLDnaute Occasionnel
Avec Windows 10, on peut activer ou désactiver le clavier virtuel.

Voir dans les paramètres Windows.

On trouve des explications dans Google.

Est-ce que le clavier s'affiche si tu le lances manuellement?
Touche Windows+R puis inscrire osk.exe puis appuie sur la toucher ENTREE.
 
Dernière édition:

Yurperqod

XLDnaute Occasionnel
Bonjour le forum

Pour Windows 10, tester cette macro (écrite au départ pour Windows 8)
VB:
Const SW_SHOW = 1
Const SW_SHOWMAXIMIZED = 3

#If VBA7 Then
Public Declare PtrSafe Function ShellExecute Lib "Shell32.dll" Alias "ShellExecuteA" _
  (ByVal hwnd As Long, _
   ByVal lpOperation As String, _
   ByVal lpFile As String, _
   ByVal lpParameters As String, _
   ByVal lpDirectory As String, _
   ByVal nShowCmd As Long) As Long
#Else
Public Declare Function ShellExecute Lib "Shell32.dll" Alias "ShellExecuteA" _
  (ByVal hwnd As Long, _
   ByVal lpOperation As String, _
   ByVal lpFile As String, _
   ByVal lpParameters As String, _
   ByVal lpDirectory As String, _
   ByVal nShowCmd As Long) As Long
#End If

Sub openTouchKeyboard()
  Dim RetVal As Long
  On Error Resume Next
  RetVal = ShellExecute(0, "open", "C:\Program Files\Common Files\microsoft shared\ink\TabTip.exe", _
  0, "C:\Program Files\Common Files\microsoft shared\ink\", SW_SHOWMAXIMIZED)
End Sub

Public Function closeIfOpen() As Boolean
Dim objWINMGMTS As Object
Dim objApps As Object
Dim objApp As Object
Set objWINMGMTS = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
Set objApps = objWINMGMTS.ExecQuery("select * from win32_process where name='tabtip.exe'") 'or osk.exe depending on kb in use
For Each objApp In objApps
objApp.Terminate
Next
End Function
 

david84

XLDnaute Barbatruc
Bonjour,
pour afficher le clavier en passant par ShellExecute et par WMI (testé sous Windows 10) :
Code:
Const SW_SHOW = 1

#If Win64 Then
Public Declare PtrSafe Function ShellExecute Lib "Shell32.dll" Alias "ShellExecuteA" _
  (ByVal hwnd As Long, _
   ByVal lpOperation As String, _
   ByVal lpFile As String, _
   ByVal lpParameters As String, _
   ByVal lpDirectory As String, _
   ByVal nShowCmd As Long) As Long
#Else
Public Declare Function ShellExecute Lib "Shell32.dll" Alias "ShellExecuteA" _
  (ByVal hwnd As Long, _
   ByVal lpOperation As String, _
   ByVal lpFile As String, _
   ByVal lpParameters As String, _
   ByVal lpDirectory As String, _
   ByVal nShowCmd As Long) As Long
#End If

Sub openKeyboard()
  Dim RetVal As Long
  On Error Resume Next
  RetVal = ShellExecute(0, "open", "osk.exe", 0, "%windir%\system32\osk.exe", SW_SHOW)
End Sub

Pour le fermer :
Code:
Sub closeKeyboard()
On Error Resume Next
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_Process where caption='osk.exe'", , 48)
For Each objItem In colItems
    objItem.Terminate
Next
End Sub
A+
 

Discussions similaires

Statistiques des forums

Discussions
312 938
Messages
2 093 771
Membres
105 816
dernier inscrit
TASTET B