Atlanta Custom Software Development 

 
   Search        Code/Page
 

User Login
Email

Password

 

Forgot the Password?
Services
» Web Development
» Maintenance
» Data Integration/BI
» Information Management
Programming
  Database
Automation
OS/Networking
Graphics
Links
Tools
» Regular Expr Tester
» Free Tools

Prevent an iconized window from being restored

Total Hit ( 1719)

Rate this article:     Poor     Excellent 

 Submit Your Question/Comment about this article

Rating


 


When the user clicks on an iconized (minimized) form in the taskbar, Windows sends that form a WM_QUERYOPEN message, and inspects the value returned to the operating system. If this value is zero, the operation is canceled.

Using subclassing you can therefore determine when a form is about to be restored, and you can also refuse to restore it by returning 0. Here is a code snippet that does the trick:

Click here to copy the following block
' REQUIRES THE MSGHOOK.DLL COMPONENT
'
' you can omit the following constant definition,
' because it is contained in the MsgHook type library
Const WM_QUERYOPEN = &H13

Dim WithEvents FormHook As MsgHook

Private Sub Form_Load()
  ' start form subclassing
  Set FormHook = New MsgHook
  FormHook.StartSubclass hWnd
End Sub

Private Sub FormHook_AfterMessage(ByVal uMsg As Long, ByVal wParam As Long, _
  ByVal lParam As Long, retValue As Long)
  If uMsg = WM_QUERYOPEN Then
    ' The iconized form is being restored.
    ' ...
    ' Uncomment the next line to prevent the window from being restored.
    ' retValue = False
  End If
End Sub


Submitted By : Nayan Patel  (Member Since : 5/26/2004 12:23:06 PM)

Job Description : He is the moderator of this site and currently working as an independent consultant. He works with VB.net/ASP.net, SQL Server and other MS technologies. He is MCSD.net, MCDBA and MCSE. In his free time he likes to watch funny movies and doing oil painting.
View all (893) submissions by this author  (Birth Date : 7/14/1981 )


Home   |  Comment   |  Contact Us   |  Privacy Policy   |  Terms & Conditions   |  BlogsZappySys

© 2008 BinaryWorld LLC. All rights reserved.