HelperFunctions.FindWindowEx Method

An example of an external function. Retrieves a handle to a window whose class name and window name match the specified strings.
<DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)> _ 
Friend Shared Function FindWindowEx( _ 
ByVal parentHandle As IntPtr, _ 
ByVal childAfter As IntPtr, _ 
ByVal lclassName As String, _ 
ByVal windowTitle As String _ 
) As IntPtr
This language is not supported or no code example is available.
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)] 
internal static extern IntPtr FindWindowEx( 
IntPtr parentHandle, 
IntPtr childAfter, 
string lclassName, 
string windowTitle 
)
This language is not supported or no code example is available.
[<DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)>] 
extern IntPtr FindWindowEx( 
parentHandle:IntPtr * 
childAfter:IntPtr * 
lclassName:string * 
windowTitle:string 
)
This language is not supported or no code example is available.
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)] 
public private:  
static extern IntPtr FindWindowEx( 
IntPtr parentHandle, 
IntPtr childAfter, 
String^ lclassName, 
String^ windowTitle 
)
This language is not supported or no code example is available.
In JScript, you cannot define your own external method with DllImport.
This language is not supported or no code example is available.

Parameters

parentHandle
IntPtr

A handle to the parent window whose child windows are to be searched.

childAfter
IntPtr

A handle to a child window. The search begins with the next child window in the Z order. The child window must be a direct child window of hwndParent, not just a descendant window.

lclassName
string

The class name or a class atom created by a previous call to the RegisterClass or RegisterClassEx function.

windowTitle
string

The window name (the window's title). If this parameter is null reference (Nothing in Visual Basic), all window names match.

Return Value

IntPtr

If the function succeeds, the return value is a handle to the window that has the specified class and window names.

If the function fails, the return value is null reference (Nothing in Visual Basic).

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Core

Supported in: 1.0, 1.1, 2.0

.NET Standard

Supported in: 2.0

Xamarin.Android

Supported in: 7.1

Portable Class Library

Supported in: Portable Class Library

In this article

Definition