|
-
Nov 19th, 2001, 12:04 AM
#1
Thread Starter
Junior Member
to find out whether a particular program is running and bringing it to the front
Can we write a api which will detect whether a particular programm is running and also bring the program to the front of the screen.
-
Nov 21st, 2001, 01:13 AM
#2
Fanatic Member
use the following code... in you form...
call the following function in your form load event..
if the function parameter is not 1 it will just get the form to foreground..
else if the parameter is 1 it will get the previous instance to foreground and terminate the current instance..
Public Sub ShowPrevInstance(x As Integer)
On Error Resume Next
Dim OldTitle As String
Dim ll_WindowHandle As Long
OldTitle = App.Title
If x = 1 Then App.Title = "New App - This App Will Be Closed"
ll_WindowHandle = FindWindow("ThunderRT5Main", OldTitle)
'if you are using vb6.0 then use ThunderRT6Main instead of ThunderRT5Main
If ll_WindowHandle = 0 Then Exit Sub
ll_WindowHandle = GetWindow(ll_WindowHandle, GW_HWNDPREV)
Call OpenIcon(ll_WindowHandle)
Call SetForegroundWindow(ll_WindowHandle)
If x = 1 Then Unload Me
End Sub
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
|