Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Current applications

Status
Not open for further replies.

jscorpion

Programmer
Nov 17, 2000
40
0
0
US
Is there a way to find what application are running. I need a vbscript that can compare a string to see if that application is running. I found out how to do it in vb6 but I really need the vbscript since it will be used in conjuction with a bigger vbscript.

the vb6 code is as follows.

Private Declare Function FindWindow Lib "USER32" Alias "FindWindowA" (ByVal lpszClassName As String, ByVal lpszWindow As String) As Long

Private Sub Command1_Click()
If FindWindow(vbNullString, "VISUAL Enterprise - RESEARCH/SYSADM") Then
MsgBox "Yes"
Else
MsgBox "No"
End If

End Sub

any help will be greatly appreciated.

thank you,

jscorpion
 
Have you tried to test the return value of a WshShell.AppActivate call ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
I can make that work, thanks for the info. However the problem I am having is trying to find out what db to access by the name given in the application title. I would like to see if a particular application is running and the name of the db is in the title. I would then like to parse out the name of the application and grab the db name. So in short is there a way to access current applications running so I could filter through them find the begginning title and save it to a string so I could get the db name.

thanks again for your response.
 
Hello jscorpion,

Calling api is not within the map of the functionality as sketched by ms scripting team with perhaps good reason.

For simple parameter types passing, you can use dynwrap free downloadable available out there. Get the zip, extract the dll and register it with regsvr32.

The script will go something like this.
Code:
Set oDynWrap=createobject("DynamicWrapper")
oDynWrap.Register "user32.dll", "FindWindowA", "i=ss", "f=s", "r=l"
hWnd=oDynWrap.FindWindowA(vbNullString, "VISUAL Enterprise - RESEARCH/SYSADM")
if hWnd then msgbox "Yes" else msgbox "No"
set oDynWrap=nothing
regards - tsuji
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top