Results 1 to 4 of 4

Thread: Minimized Application

  1. #1

    Thread Starter
    Member
    Join Date
    Aug 2001
    Posts
    57

    Minimized Application

    Hi there,

    With App.PrevInstance you come to know whether Instance of your application is running or not. But is there any way if your application's one instance is running and currently it is minimized and some one clicks on to same application exe icon then this minimize application should come to its normal state (unminimized).
    In short is there any way to bring your minimized application to its normal state programmitically.

    Thanx

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333
    VB Code:
    1. Private Declare Function IsIconic Lib "user32" (ByVal hwnd As Long) As Long
    2.  
    3. Private Function IsWindowMinimized(ByVal hwnd As Long) As Boolean
    4.     IsWindowMinimized = Not (IsIconic(hwnd) = 0&)
    5. End Function
    6.  
    7. 'To Find Out If The Window Is Minimized
    8.  
    9. Dim IsIt As Boolean
    10. IsIt = IsWindowMinimized(Me.hwnd)
    11.    If IsIt = True Then 'application is minimized
    12.       Me.WindowState = vbNormal
    13.    End If

  3. #3

    Thread Starter
    Member
    Join Date
    Aug 2001
    Posts
    57

    minimized app

    Option Explicit
    Private Declare Function IsIconic Lib "user32" (ByVal hwnd As Long) As Long
    Dim IsIt As Boolean

    Private Function IsWindowMinimized(ByVal hwnd As Long) As Boolean
    IsWindowMinimized = Not (IsIconic(hwnd) = 0&)
    End Function

    Private Sub Form_Load()
    'To Find Out If The Window Is Minimized
    If App.PrevInstance = True Then
    MsgBox "Found another Instance"
    IsIt = IsWindowMinimized(Me.hwnd)
    If IsIt = True Then 'application is minimized
    Me.WindowState = vbNormal
    End If
    End If
    End Sub

    Hi Hack,

    Thanks for your assistance, but the above code when converted to an .exe and when I stated the 2nd instance of the application it gave me the message "Found another Instance" and the minimized application was as it is in the task bar and the new instance of the application was created. So 2 instance of the application was running on the same PC. Looking for further assistance.


    Originally posted by Hack
    VB Code:
    1. Private Declare Function IsIconic Lib "user32" (ByVal hwnd As Long) As Long
    2.  
    3. Private Function IsWindowMinimized(ByVal hwnd As Long) As Boolean
    4.     IsWindowMinimized = Not (IsIconic(hwnd) = 0&)
    5. End Function
    6.  
    7. 'To Find Out If The Window Is Minimized
    8.  
    9. Dim IsIt As Boolean
    10. IsIt = IsWindowMinimized(Me.hwnd)
    11.    If IsIt = True Then 'application is minimized
    12.       Me.WindowState = vbNormal
    13.    End If

  4. #4
    Frenzied Member Shawn N's Avatar
    Join Date
    Dec 2001
    Location
    Houston
    Posts
    1,631
    Please rate my post.

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