HWND FindWindow(lpszClassName, lpszWindow) | |||||
LPCSTR lpszClassName; | /* address of class-name string | */ | |||
LPCSTR lpszWindow; | /* address of window-name string | */ |
The FindWindow function retrieves the handle of the window whose class name and window name match the specified strings. This function does not search child windows.
lpszClassName
Points to a null-terminated string that contains the window's class name. If this parameter is NULL, all class names match.
lpszWindow
Points to a null-terminated string that specifies the window name (the window's title). If this parameter is NULL, all window names match.
The return value is the handle of the window that has the specified class name and window name if the function is successful. Otherwise, it is NULL.
The following example searches for the main window of Windows Control Panel (CONTROL.EXE) and, if it does not find it, starts Control Panel:
if (FindWindow("CtlPanelClass", "Control Panel") == NULL)
WinExec("control.exe", SW_SHOWNA);