0
我需要通过只知道HWND来获得进程的名称通过窗口句柄获取未知进程的名称?
我知道这可能与win32api或dl或win32/api,但我不知道那太api奇怪的参数.. 。我是小白编程
我获得HWND被Win32/API(不Win32API的),是一个integre数,而不是十六进制,但我可以把它容易...
这是代码是什么赋予了我把手...
require 'win32/api'
include Win32
# Callback example - Enumerate windows
EnumWindows = API.new('EnumWindows', 'KP', 'L', 'user32')
GetWindowText = API.new('GetWindowText', 'LPI', 'I', 'user32')
EnumWindowsProc = API::Callback.new('LP', 'I'){ |handle, param|
buf = "\0" * 200
GetWindowText.call(handle, buf, 200);
if (!buf.index(param).nil?)
puts "window was found: handle #{handle}"
0 # stop looking after we find it
else
1
end
}
EnumWindows.call(EnumWindowsProc, 'the title here ')
现在呢?
请帮忙!