MistakesWereMade
Board Regular
- Joined
- May 22, 2019
- Messages
- 103
I use osk.exe on my tablet when using a combobox. If I close the on-screen keyboard application in the midst of typing in the combobox, the combobox gets buggy. I can open the on-screen keyboard again but it will not show what I am typing in the combobox. I open the osk.exe application by clicking on an invisible label over my combobox. I also use combobox1.SetFocus after the osk is opened, but this setfocus doesn't work more than once. Any ideas on how I can possibly make it so that each time I click on the label, the combobox will reaffirm its focus?
Code:
Option Explicit
Private Declare PtrSafe Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpszOp As String, ByVal lpszFile As String, ByVal lpszParams As String, ByVal LpszDir As String, ByVal FsShowCmd As Long) As Long
Private Declare PtrSafe Function Wow64EnableWow64FsRedirection Lib "kernel32.dll" (ByVal Enable As Boolean) As Boolean
Private Declare PtrSafe Function GetProcAddress Lib "kernel32" (ByVal hModule As Long, ByVal lpProcName As String) As Long
Private Declare PtrSafe Function GetModuleHandle Lib "kernel32" Alias "GetModuleHandleA" (ByVal lpModuleName As String) As Long
Private Declare PtrSafe Function GetCurrentProcess Lib "kernel32" () As Long
Private Declare PtrSafe Function IsWow64Process Lib "kernel32" (ByVal hProc As Long, bWow64Process As Long) As Long
Public Function Is64bit() As Long
If GetProcAddress(GetModuleHandle("kernel32"), "IsWow64Process") > 0 Then
IsWow64Process GetCurrentProcess(), Is64bit
End If
End Function
Private Sub Label1_Click()
ComboBox1.SetFocus
If Is64bit Then
Wow64EnableWow64FsRedirection False
ShellExecute 0, "open", "osk.exe", "", "", vbNormalFocus
Wow64EnableWow64FsRedirection True
ComboBox1.SetFocus
Else
ShellExecute 0, "open", "osk.exe", "", "", vbNormalFocus
ComboBox1.SetFocus
End If
ComboBox1.SetFocus
End Sub