MistakesWereMade
Board Regular
- Joined
- May 22, 2019
- Messages
- 103
I have osk.exe running and would like to have my program execute commands when it is closed. I run into an issue with the function portion of my code which is highlighted in red.
Code:
Private Sub Label1_Click()
If Is64bit Then
Wow64EnableWow64FsRedirection False
ShellExecute 0, "open", "osk.exe", "", "", vbNormalFocus
Wow64EnableWow64FsRedirection True
Else
ShellExecute 0, "open", "osk.exe", "", "", vbNormalFocus
End If
ComboBox1.SetFocus
While IsProcessRunning("osk.EXE") = True
Wend
MsgBox ("Test.")
End Sub
Function IsProcessRunning(process As String)
Dim objListy As Object
Set objListy = GetObject("winmgmts:").ExecQuery("select * from win32 where name='" & process & "'")
If [COLOR=#ff0000]objListy.Count > 0[/COLOR] Then
IsProcessRunning = True
Else
IsProcessRunning = False
End If
End Function