User32FindWindow Method
Retrieves a handle to the top-level window whose class name and window name match the specified strings.
This function does not search child windows.
This function does not perform a case-sensitive search.
To search child windows, beginning with a specified child window, use the
FindWindowEx(IntPtr, IntPtr, String, String) function.
Namespace: DevCase.Win32.NativeMethodsAssembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
[DllImportAttribute("User32.dll", CharSet = CharSet.Auto, BestFitMapping = false,
ThrowOnUnmappableChar = true, SetLastError = true)]
public static IntPtr FindWindow(
string className,
string windowName
)
<DllImportAttribute("User32.dll", CharSet := CharSet.Auto, BestFitMapping := false,
ThrowOnUnmappableChar := true, SetLastError := true>]
Public Shared Function FindWindow (
className As String,
windowName As String
) As IntPtr
Dim className As String
Dim windowName As String
Dim returnValue As IntPtr
returnValue = User32.FindWindow(className,
windowName)
public:
[DllImportAttribute(L"User32.dll", CharSet = CharSet::Auto, BestFitMapping = false,
ThrowOnUnmappableChar = true, SetLastError = true)]
static IntPtr FindWindow(
String^ className,
String^ windowName
)
[<DllImportAttribute("User32.dll", CharSet = CharSet.Auto, BestFitMapping = false,
ThrowOnUnmappableChar = true, SetLastError = true)>]
static member FindWindow :
className : string *
windowName : string -> IntPtr
No code example is currently available or this language may not be supported.
- className String
-
The class name or a class atom created by a previous call to the RegisterClass or RegisterClassEx function.
The atom must be in the low-order word of className; the high-order word must be zero.
If className is NULL, it finds any window whose title matches the windowName parameter.
- windowName String
-
The window name (the window's titlebar title).
If this parameter is , all window names match.
IntPtr
If the function succeeds, the return value is a handle to the window that has the specified class name and window name.
If the function fails, the return value is
.