Windows API Guide: CreateToolhelp32Snapshot Function


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.

hwnd
A handle to the window to enable or disable.
fEnable
If 0, the window will be disabled. If non-zero, the window will be enabled.

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



Windows API Guide
Windows API Guide - Reference - Volume 1: Version 3.0 For the MS-DOS and PC-DOS Operating Systems
ISBN: B001V0KQIY
EAN: N/A
Year: 1998
Pages: 610

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net