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 ')
現在呢?
請幫忙!