cFindbyClass

Gets the window handle of the first window whose class name matches the specified "class-name".

Syntax:

cFindbyClass(class-name)

Parameters:

(s) class-name Window class name.

Returns:

(i) window-handle Windows handle.

 

cFindByClass returns the windows handle of the first window whose class name matches the specified "class-name". It can be used to manipulate windows that do not have titles. The function searches by checking each top-level window’s class. If no match is found, it checks the child windows of each top-level window. 0 is returned, if no window has the class name.

Note: "Class-name" is not case sensitive but must be the full class name (ie, not a partial name).

 

Example:

AddExtender("wwctl44i.dll",0,"wwctl64i.dll")
sAppName = "Notepad.exe"
sAppWindow = "~Notepad"
sAppClass = "NotePad"
; Start up an application
TestApp = FileLocate (sAppName)
If TestApp == "" Then Goto Error
If !ShellExecute(TestApp, "", "",0, "") Then Goto error
If !WinWaitExist(sAppWindow, 8) Then Goto error
hWnd = cFindByClass(sAppClass)
If !hWnd Then Goto Error
; Get the first edit control we can find.
sClassName = "Edit"
hWndEdit = cFindByClass(sClassName)
; Get Notepad's edit control
hWndEdit2 = cWndbyclass(hWnd, sClassName)
If hWndEdit == hWndEdit2
   Message("Edit Controls", "Found Notepad's edit with cFindbyClass")
Else
   Message("Edit Controls", "Found another applications edit control")
EndIf
Exit
:Error
; Do something useful.

See Also:

cWndByClass