Results 1 to 2 of 2

Thread: to find out whether a particular program is running and bringing it to the front

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jan 2001
    Location
    mumbai(india)
    Posts
    26

    Angry 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.

  2. #2
    Fanatic Member pradeepkrao's Avatar
    Join Date
    Sep 2001
    Location
    New Jersey
    Posts
    534
    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
  •  



Click Here to Expand Forum to Full Width