Click to See Complete Forum and Search --> : Minimized Application
a_k93
Feb 16th, 2002, 05:24 AM
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
Hack
Feb 16th, 2002, 08:19 AM
Private Declare Function IsIconic Lib "user32" (ByVal hwnd As Long) As Long
Private Function IsWindowMinimized(ByVal hwnd As Long) As Boolean
IsWindowMinimized = Not (IsIconic(hwnd) = 0&)
End Function
'To Find Out If The Window Is Minimized
Dim IsIt As Boolean
IsIt = IsWindowMinimized(Me.hwnd)
If IsIt = True Then 'application is minimized
Me.WindowState = vbNormal
End If
a_k93
Feb 23rd, 2002, 11:45 PM
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
Private Declare Function IsIconic Lib "user32" (ByVal hwnd As Long) As Long
Private Function IsWindowMinimized(ByVal hwnd As Long) As Boolean
IsWindowMinimized = Not (IsIconic(hwnd) = 0&)
End Function
'To Find Out If The Window Is Minimized
Dim IsIt As Boolean
IsIt = IsWindowMinimized(Me.hwnd)
If IsIt = True Then 'application is minimized
Me.WindowState = vbNormal
End If
Shawn N
Feb 24th, 2002, 02:06 PM
http://www.vb-world.net/beginning/tip125.html
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.