IsWindow Function

Declare Function IsWindow Lib "user32.dll" (ByVal hWnd As Long) As Long

Platforms

Desctiption & Usage

IsWindow determines if a given handle refers to a window or not. The function verifies that the handle in fact refers to a window, instead of one of the many other objects which handles can represent.

Return Value

If the handle does not refer to a window, the function returns 0. If the handle does refer to a window, the function returns a non-zero value.

Visual Basic-Specific Issues

None.

Parameters

hWnd
The handle to check if it refers to a window or not.

Example

' Demonstrate handles refering to a window and not refering to a window.
Dim hWindow As Long  ' handle to a window (Form1, to be exact)
Dim hPen As Long  ' handle to a pen (the solid black stock pen)
Dim result As Long  ' result of the test

' Initialize the two handles.
hWindow = Form1.hWnd  ' hWindow now equals window Form1's handle
hPen = GetStockObject(BLACK_PEN)  ' hPen refers to a pen
' Verify that hWindow refers to a window.
result = IsWindow(hWindow)
If result = 0 Then
  Debug.Print "hWindow does not refer to a window."  ' won't happen
Else
  Debug.Print "hWindow refers to a window."  ' will happen
End If
' Verify that hPen does not refer to a window.
result = IsWindow(hPen)
If result = 0 Then
  Debug.Print "hPen does not refer to a window."  ' will happen
Else
  Debug.Print "hPen refers to a window."  ' won't happen
End If

Related Function

IsChild

Category

Windows

Back to the index.


Last Modified: August 1, 1999
This page is copyright © 1999 Paul Kuliniewicz. Copyright Information

Go to Paul Kuliniewicz's Home Page.
E-mail: rogue953@hotmail.com
This page is at http://skyscraper.fortunecity.com/transmission/45/api/i/iswindow.html