|
-
Apr 14th, 2004, 07:26 AM
#1
Thread Starter
Fanatic Member
Application Open?
HOw do i check if a certain application has open? (particularly lotus note)
Last edited by Goh; May 10th, 2004 at 07:24 PM.
-
Apr 14th, 2004, 07:39 AM
#2
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
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".
Woka
-
Apr 14th, 2004, 07:47 AM
#3
Thread Starter
Fanatic Member
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..
-
Apr 14th, 2004, 08:15 AM
#4
Are you sure that is the right caption?
I get: "Microsoft Excel - filename.xls"
or just: "Microsoft Excel"
-
Apr 14th, 2004, 08:16 AM
#5
Thread Starter
Fanatic Member
how do i check the caption of an application?
-
Apr 14th, 2004, 08:21 AM
#6
Thread Starter
Fanatic Member
-
Apr 14th, 2004, 08:21 AM
#7
-
Apr 14th, 2004, 08:32 AM
#8
I take it it works now?
Woka
-
Apr 14th, 2004, 08:34 AM
#9
Thread Starter
Fanatic Member
yes thank you....btw...does this code works on all applicaiton?
-
Apr 14th, 2004, 10:06 AM
#10
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

Woka
-
Apr 14th, 2004, 10:10 AM
#11
Thread Starter
Fanatic Member
wat is the actual effect to this code? to ensure that all application is checked?
-
Apr 14th, 2004, 10:22 AM
#12
Thread Starter
Fanatic Member
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
Last edited by Goh; Apr 14th, 2004 at 10:35 AM.
-
Apr 14th, 2004, 10:32 AM
#13
Originally posted by Goh
i have added the code but it would kill the app...
...DestroyWindow..
you are surprised by that?
-
May 10th, 2004, 07:00 PM
#14
Thread Starter
Fanatic Member
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!
Last edited by Goh; May 10th, 2004 at 07:26 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|