HOw do i check if a certain application has open? (particularly lotus note) :)
Printable View
HOw do i check if a certain application has open? (particularly lotus note) :)
The "Lotus Notes" part is the CAPTION of the Lotus Window.VB Code:
Option Explicit Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Private Sub Command1_Click() Dim lngHandle As Long lngHandle = FindWindow(vbNullstring, "Lotus Notes") If lngHandle > 0 Then MsgBox "Lotus is running" End If End Sub
When replying to this thread my IE caption changes to "VBForums.com - Reply to Topic - Microsoft Internet Explorer".
Woka
i have replace the "lotus note" with excel...
Option Explicit
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Sub Command1_Click()
Dim lngHandle As Long
lngHandle = FindWindow(vbNullString, "Microsoft Office Excel 2003")
If lngHandle > 0 Then
MsgBox "Lotus is running"
End If
End Sub
but it wont work.....
"The "Lotus Notes" part is the CAPTION of the Lotus Window.
When replying to this thread my IE caption changes to "VBForums.com - Reply to Topic - Microsoft Internet Explorer"." dun really understand this part..
Are you sure that is the right caption?
I get: "Microsoft Excel - filename.xls"
or just: "Microsoft Excel"
how do i check the caption of an application?
i got it thanks!
:rolleyes: you look at the top bar of the Window
I take it it works now?
Woka
yes thank you....btw...does this code works on all applicaiton?
Try it and find out ;)
to the code add:
VB Code:
Private Declare Function DestroyWindow Lib "user32" Alias "DestroyWindow" (ByVal hwnd As Long) As Long 'then in the sub add If lngHandle > 0 Then DestroyWindow lngHandle End If
:D
Woka
wat is the actual effect to this code? to ensure that all application is checked?
i have added the code but it would not kill the app...
VB Code:
Option Explicit Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Private Declare Function DestroyWindow Lib "user32" (ByVal hwnd As Long) As Long Private Sub Command1_Click() Dim lngHandle As Long lngHandle = FindWindow(vbNullString, "Microsoft Excel - Book1") If lngHandle > 0 Then MsgBox "Lotus is running" End If 'then in the sub add If lngHandle > 0 Then DestroyWindow lngHandle End If End Sub
you are surprised by that? :confused:Quote:
Originally posted by Goh
i have added the code but it would kill the app...
...DestroyWindow..
:lol:
is it possible to detect the application running with a single set of codes, because all i wanted is make sure that the application is activated before the mail can be sent.....there are so many captions for lotus notes.... does it mean i have to write all?! :) thank you.. furher more this application can be used by mutli-users ie ...the captions varies from user to user!