>Close, but I want to know if any app is running, not just my VB app. I want to know if Word or Lotus Notes or another custom app is running, ect...
Look at this:
VERSION 5.00
Begin VB.Form frmFindApp
Caption = "Application finder"
ClientHeight = 2220
ClientLeft = 60
ClientTop = 345
ClientWidth = 4350
LinkTopic = "Form1"
ScaleHeight = 2220
ScaleWidth = 4350
StartUpPosition = 3 'Windows Default
Begin VB.CommandButton cmdRecherche
Caption = "Search"
BeginProperty Font
Name = "Arial"
Size = 9.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 1688
TabIndex = 1
Top = 1560
Width = 1215
End
Begin VB.TextBox txtAppToFind
BeginProperty Font
Name = "Arial"
Size = 9.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 968
TabIndex = 0
Top = 960
Width = 2415
End
Begin VB.Label Label1
Alignment = 2 'Center
Caption = "Which application would you like to search?"
BeginProperty Font
Name = "Arial"
Size = 9.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 728
TabIndex = 2
Top = 360
Width = 2895
End
End
Attribute VB_Name = "frmFindApp"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Declare Function FindWindow Lib "user32" _
Alias "FindWindowA" _
(ByVal lpClassName As String, _
ByVal lpWindowName As String) _
As Long
Private Sub cmdRecherche_Click()
Dim str1 As String 'dummy variable
'FindWindow return 0 if not found or the handle to the application if found
'The second parameter is the Caption to search (ex: Calculator).
If FindWindow(str1, txtAppToFind.Text) Then
MsgBox "Application found..."
Else
MsgBox "Application not found..."
End If
End Sub
Éric Moreau, MCPD, Visual Developer - Visual Basic MVP
Conseiller Principal / Senior Consultant
Moer inc.
http://www.emoreau.com