Greetings.
Thank you in advance for replying to my question.
The code below (courtesy of Erel) checks if Notepad is running, and if is not running, it runs it via the shell command.
QUESTION
How do I give Notepad focus and "bring to front" if it is running?
Best regards.
Sandy
Thank you in advance for replying to my question.
The code below (courtesy of Erel) checks if Notepad is running, and if is not running, it runs it via the shell command.
QUESTION
How do I give Notepad focus and "bring to front" if it is running?
Best regards.
Sandy
B4X:
Sub BShell_MouseClicked (EventData As MouseEvent)
Dim shellexe As String
shellexe="notepad.exe"
Dim exerunning As Boolean =ProcessExists(shellexe)
Log ("exerunning "&exerunning)
If exerunning = False Then
shell1.initialize("shell1","c:\Windows\System32\notepad.exe",list1)
shell1.Run(-1)
End If
End Sub
Sub ProcessExists(ExeName As String) As Boolean
Dim Result As ShellSyncResult
Dim Sh As Shell
Sh.InitializeDoNotHandleQuotes("", "tasklist", Null)
Result = Sh.RunSynchronous(5000)
Return Result.StdOut.ToLowerCase.Contains(ExeName.ToLowerCase)
End Sub