1.
Function Prototypes:
BOOL WINAPI EnumWindows (
_in_ Wndenumproc Lpenumfunc,
_in_ LPARAM LPARAM
);
Lpenumfunc: Pointer to application-defined callback function
LParam: application-defined value passed to the callback function
An explanation of EnumWindows in MSDN:
Enumerates all top-level windows on the screens by passing the handle to each window, in turn, to an application-defined CA Llback function. EnumWindows continues until the last top-level window is enumerated or the callback function returns FALSE.
That
Enumerates all the top-level windows on the screen, transferring the handles of these windows to an application-defined callback function in turn. The enumwindows will continue until all the top-level windows are enumerated, or the callback function returns FALSE.
2.
The definition of the Enumwindowsproc () function:
BOOL CALLBACK Enumwindowsproc (
_in_ HWND hwnd,
_in_ LPARAM LPARAM
);
HWND: Handle to the top-level window passed to the function during the enumeration of each top-level window while invoking the function
LParam: The second parameter of the EnumWindows () function.
Return Value:
Returns True if the EnumWindows () function continues to call the Enumwindowsproc () function in the system and returns false to stop the enumeration.
MSDN explained:
An application-defined callback function used with the EnumWindows or enumdesktopwindows function. It receives top-level window handles. The Wndenumproc type defines a pointer to this callback function. Enumwindowsproc is a placeholder for the application-defined function name
That
application-defined functions for the enumwindows () or Enumdesktopwindos () functions. Receives the top-level window handle. The Wndenumproc type defines a pointer to this callback function. Enumwindowsproc is a placeholder for an application-defined function name.
Application Examples:
The function of this code is to enumerate all of the current top-level window handles, and to specify a window handle that, if the top-level window handle enumerated to and the window handle passed to the Enumwindowsproc function is different, causes the top-level window to be enumerated to fail
//Customizing the structure bodytypedefstruct_dlong{long WParam; LONG LParam;} Stlong;//definition of callback functionBOOL CALLBACK Enumwindowsproc (HWND hwnd, LPARAM LPARAM) {Stlong*pdlong = (stlong*) LParam; BOOL benable= (BOOL) pdlong->LParam;if(hwnd! = (HWND) pdlong->WParam) EnableWindow (hwnd, benable);//if the top-level window handle that is currently enumerated is different from the extra information passed by the keynote function (Enumwindos function) to do the specified top-level window handle, then the related enable or enable deactivation operationreturnTRUE;} ... stlong Dlong;//additional information passed to the EnumwindowsprocDlong.lparam =(LPARAM) False;dlong.wparam=(WPARAM) hWnd; EnumWindows (Enumwindowsproc, (LONG)&dlong);
Windows API Programming----The use of the EnumWindows () function