ControlGetClassNN

Returns the ClassNN (class name and sequence number) of the specified control.

ClassNN := ControlGetClassNN(Control , WinTitle, WinText, ExcludeTitle, ExcludeText)

Parameters

Control

Type: String, Integer or Object

The control's ClassNN, text or HWND, or an object with a Hwnd property. For details, see The Control Parameter.

WinTitle

Type: String, Integer or Object

A window title or other criteria identifying the target window. See WinTitle.

WinText

Type: String

If present, this parameter must be a substring from a single text element of the target window (as revealed by the included Window Spy utility). Hidden text elements are detected if DetectHiddenText is ON.

ExcludeTitle

Type: String

Windows whose titles include this value will not be considered.

ExcludeText

Type: String

Windows whose text include this value will not be considered.

Return Value

Type: String

This function returns the ClassNN (class name and sequence number) of the specified control, or an empty string if the control could not be found.

Error Handling

An exception is thrown if invalid parameters are detected.

Remarks

A control's ClassNN is the name of its window class followed by its sequence number within the top-level window which contains it. For example, "Edit1" is the first Edit control on a window and "Button12" is the twelth button.

A control's ClassNN can also be determined via Window Spy, MouseGetPos or WinGetControls.

Some class names include digits which are not part of the control's sequence number. For example, "SysListView321" is the window's first ListView control, not its 321st. To retrieve the class name without the sequence number, pass the control's HWND to WinGetClass.

Window titles and text are case sensitive. Hidden windows are not detected unless DetectHiddenWindows has been turned on.

Related

WinGetClass, WinGetControls, ClassNN property (GuiControl object), MouseGetPos, Control functions

Examples

#1: Retrieves the ClassNN of the currently focused control:

classNN := ControlGetClassNN(ControlGetFocus("A"))