• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 137
  • Last Modified:

How to know other application running

Now i have to manual to check in Task Manager weather this BIIBER.exe is running or not.
How to use the VB Code to detect the application running or not and is not running we have to automatic to start
the services.
1 Solution
If BIIBER.exe is ActiveExe so You can use

Private Function IsRun() As Boolean

On Error Goto ErrHand
Dim o As Object

Set o = GetObject(,"BIIBER.PublicClass")
If o Is Nothing Then
   IsRun = True
End If

Exit Function
End Function

Hope this will help
If this helps you, please reject the current answer and select this comment as the answer...

You can try this... In a new project, add a listbox to the form and then add the following code:

    Private Declare Function GetWindow Lib "user32" (ByVal hwnd As Long, ByVal wCmd As Long) As Long
    Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
    Private Declare Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (ByVal hwnd As Long) As Long
    Const GW_CHILD = 5
    Const GW_HWNDFIRST = 0
    Const GW_HWNDLAST = 1
    Const GW_HWNDNEXT = 2
    Const GW_HWNDPREV = 3
    Const GW_OWNER = 4
   Sub LoadTaskList()
      CurrWnd = GetWindow(Form1.hwnd, GW_HWNDFIRST)
      While CurrWnd <> 0
         Length = GetWindowTextLength(CurrWnd)
         ListItem$ = Space$(Length + 1)
         Length = GetWindowText(CurrWnd, ListItem$, Length + 1)
         If Length > 0 Then
            List1.AddItem ListItem$
         End If
         CurrWnd = GetWindow(CurrWnd, GW_HWNDNEXT)
         x = DoEvents()
   End Sub
Private Sub Form_Load()
End Sub

Run the program and all of the running tasks will appear in the listbox... You can modify this code to look for your specific task....

Hope this helps!


kelvin99Author Commented:
Adjusted points to 40
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Tackle projects and never again get stuck behind a technical roadblock.
Join Now