Results 1 to 2 of 2

Thread: Restore\Maximize another application

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 2000
    Location
    Dayton, OH USA
    Posts
    119

    Restore\Maximize another application

    In my application I am checking to see if another instance is already running. If so, I pop up a message box saying so. Instead, I would like to restore\maximize the original application from the task bar, but not sure how to do so.

  2. #2
    Frenzied Member
    Join Date
    Oct 2002
    Location
    Gammapolis
    Posts
    1,474
    this is how i accomplished this, check to see if it works for you:

    VB Code:
    1. Declare Function ShowWindow Lib "user32" (ByVal hWnd As Int32, ByVal nCmdShow As Int32) As Int32
    2.  
    3.         Dim proc() As Process
    4.         proc = Process.GetProcessesByName(Application.ProductName)
    5.         If proc.Length > 1 Then
    6.  
    7.             If proc(1).Id = Process.GetCurrentProcess.Id Then
    8.                 ShowWindow(proc(0).MainWindowHandle.ToInt32, 9)
    9.                 Microsoft.VisualBasic.AppActivate(proc(0).Id)
    10.  
    11.             Else
    12.                 ShowWindow(proc(1).MainWindowHandle.ToInt32, 9)
    13.                 Microsoft.VisualBasic.AppActivate(proc(1).Id)
    14.             End If
    15.             Exit Sub
    16.         End If

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