收集所有活动的窗口类名称 [英] Collect all active window class names
问题描述
许多程序(True Transparancy等)都可以在后台窗口类名称中获得所有活动或运行,例如:
Many programs (True Transparancy and others) can get all active or running in background window class names like this one:
Delphi 7 Object Inspector名称为 tpropertyinspector
Opera主窗口类名称为 operawindowclass
等
Delphi 7 Object Inspector name is tpropertyinspector
Opera main window class name is operawindowclass
etc.
那么如何在Delphi中获取任何打开的窗口类名称?
So how to get any opened window class name in Delphi?
推荐答案
调用 EnumWindows
获取所有顶级窗口。然后调用 GetClassName
找出每个窗口的窗口类名称。如果您还希望探测子窗口,请在每个顶级窗口上调用 EnumChildWindows
。
Call EnumWindows
to get all the top level windows. Then call GetClassName
to find out the window class name for each window. If you also wish to probe child windows then call EnumChildWindows
on each top level window.
像这样调用GetClassName:
Call GetClassName like this:
var
ClassName: string;
len: Integer;
...
SetLength(ClassName, 256);
len := GetClassName(window, PChar(ClassName), Length(ClassName));
if len=0 then
RaiseLastOSError;
SetLength(ClassName, len);
这篇关于收集所有活动的窗口类名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!