如何找到课程名称& C ++中程序的标题? [英] How to find the class name & title of a program in c++?

查看:57
本文介绍了如何找到课程名称& C ++中程序的标题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题是如何从运行的程序和那些程序的标题中找到类名。我知道已经有一些扫描工具,例如 WinDowse Visual Studio的 spy ++ ,但我要问的是如何制作类似于我们自己源代码中的程序,要使用什么功能,有一些开源程序可以帮助您吗?代码赞赏​​,链接也:)

The question is how to find the class name from running programs and title of those programs. I know there already exist some scanning tools like WinDowse or spy++ from visual studio, but what I am asking you is how to make programs like those in our own source code, what function to use, is there some open source program that can help? Code appreciated, link's also :)

推荐答案


  1. 使用 EnumWindows 枚举所有顶级窗口并获取它们的句柄。

  1. Use EnumWindows to enumerate all top-level windows and get their handle.

将句柄传递给 GetWindowText GetClassName 到分别获取窗口标题和窗口类。

Pass the handle to GetWindowText and GetClassName to get the window title and window class respectively.

示例:

EnumWindows(EnumProc, 0);

...

BOOL CALLBACK EnumProc(HWND hWnd, LPARAM lParam) {
  TCHAR title[256];
  TCHAR className[256];

  GetWindowText(hWnd, title, 256);
  MessageBox(NULL, title, NULL, MB_OK);

  GetClassName(hWnd, className, 256);
  MessageBox(NULL, className, NULL, MB_OK);

  return TRUE;
}

这篇关于如何找到课程名称& C ++中程序的标题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆