function FindControl(Handle: HWnd): TWinControl; 就可以了
function findvclwindow(const pos: tpoint): twincontrol; var handle: hwnd; begin handle := windowfrompoint(pos); result := nil; while handle <> 0 do begin result := findcontrol(handle); if result <> nil then exit; handle := getparent(handle); end; end;
The GetClassName function retrieves the name of the class to which the specified window belongs. Syntaxint GetClassName( HWND hWnd, LPTSTR lpClassName, int nMaxCount ); ParametershWnd [in] Handle to the window and, indirectly, the class to which the window belongs. lpClassName [out] Pointer to the buffer that is to receive the class name string. nMaxCount [in] Specifies the length, in TCHAR, of the buffer pointed to by the lpClassName parameter. The class name string is truncated if it is longer than the buffer and is always null-terminated. Return ValueIf the function succeeds, the return value is the number of TCHAR copied to the specified buffer.If the function fails, the return value is zero. To get extended error information, call GetLastError.
就可以了
var
handle: hwnd;
begin
handle := windowfrompoint(pos);
result := nil;
while handle <> 0 do
begin
result := findcontrol(handle);
if result <> nil then exit;
handle := getparent(handle);
end;
end;
我的问题主要是获得其他进程的啊,呵呵
LPTSTR lpClassName,
int nMaxCount
);
ParametershWnd
[in] Handle to the window and, indirectly, the class to which the window belongs.
lpClassName
[out] Pointer to the buffer that is to receive the class name string.
nMaxCount
[in] Specifies the length, in TCHAR, of the buffer pointed to by the lpClassName parameter. The class name string is truncated if it is longer than the buffer and is always null-terminated.
Return ValueIf the function succeeds, the return value is the number of TCHAR copied to the specified buffer.If the function fails, the return value is zero. To get extended error information, call GetLastError.
我没找到,只有listview的,是c++的,但是他是用sendmessage(wm_gettext)来获取文本的,
我想获取的是他的name;注入目标进程,我想也非此不可,但是如何获得name,头疼.
(只要能获取delphi的vcl控件的name即可了)肯请高手出招