Declare Function EnableWindow Lib "user32.dll" (ByVal hwnd As Long, ByVal fEnable As Long) As Long
Platforms: Win 32s, Win 95/98, Win NT
EnableWindow enables or disables a window. If a window is disabled, it cannot receive the focus and will ignore any attempted input. Some types of windows, such as buttons and other controls, will appear grayed when disabled, although any window can be enabled or disabled. The function returns 0 if the window had previously been enabled, or a non-zero value if the window had been disabled.
Example:
' Reverse the enabled status of window Command1. If the window is
' disabled, enable it; if it is enabled, disable it.
Dim wasenabled As Long ' receives enabled/disabled status of Command1
Dim retval As Long ' return value
' Determine if the window Command1 is currently enabled or not.
wasenabled = IsWindowEnabled(Command1.hWnd)
If wasenabled = 0 Then ' if not enabled, enable it
retval = EnableWindow(Command1.hWnd, 1)
Else ' if enabled, disable it
retval = EnableWindow(Command1.hWnd, 0)
End If
See Also: IsWindowEnabled
Category: Windows
Go back to the alphabetical Function listing.
Go back to the Reference section index.
This page is copyright © 2000 Paul Kuliniewicz. Copyright Information.
Go back to the Windows API Guide home page.
E-mail: vbapi@vbapi.com Send Encrypted E-Mail
This page is at http://www.vbapi.com/ref/e/enablewindow.html