Enumerate all windows

Source: Internet
Author: User
  1. Bool callback enumchildwindows (hwnd, lparam)
  2. {
  3. Char STR [1000];
  4. GetWindowText (hwnd, str, sizeof (str); // get the window title
  5. CString temp (str );
  6. AfxMessageBox (temp );
  7. GetClassName (hwnd, str, sizeof (str); // get the class name
  8. Temp = CString (str );
  9. AfxMessageBox (temp );
  10. Return TRUE;
  11. }
  12. Bool callback lpEnumWindows (HWND hwnd, LPARAM lParam)
  13. {
  14. Char str [1000];
  15. GetWindowText (hwnd, str, sizeof (str); // get the window title
  16. CString temp (str );
  17. AfxMessageBox (temp );
  18. GetClassName (hwnd, str, sizeof (str); // get the class name
  19. Temp = CString (str );
  20. AfxMessageBox (temp );
  21. EnumChildWindows (hwnd, EnumChildWindows, NULL); // obtain the subwindow (including controls)
  22. Return TRUE;
  23. }
  24. EnumWindows (lpEnumWindows, NULL); // start Enumeration

Bool enumwindows (wndenumproc lpenumfunc, lparam );

Parameters:

Lpenumfunc: pointer to the callback function defined by an application. For details, see enumwindowsproc.

Lpararm: Specifies an application definition value passed to the callback function.

Return Value: If the function succeeds, the return value is non-zero. If the function fails, the return value is zero. To obtain more error information, call the getlasterror function.

Note: The enumwindows function does not list subwindows.

 

Bool enumchildwindows (
Hwnd hwndparent, // handle to parent window // parent window handle
Wndenumproc lpenumfunc, // callback function address
Lparam // application-defined value // your own defined parameter
);

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.