Sample Code:
# Close WMP by Window Message
require 'Win32API'
FindWindow = Win32API.new('user32', 'FindWindow', ["P", "P"], "L")
SendMessage = Win32API.new('user32', 'SendMessage', ["L", "L", "P", "P"], "L")
WM_CLOSE = 0x0010
def CloseWMP()
hwnd = FindWindow.call(nil, "Windows Media Player")
if hwnd != 0 then
id = SendMessage.call(hwnd, WM_CLOSE, nil, nil)
end
end
# End of Close WMP by Window Message
Reference:
http://www.rubycentral.com/pickaxe/lib_windows.html
Android 專用版 Facebook 推出更新版 1.6.0
13 years ago