Method: AutoItX3::Window#post_message
- Defined in:
- lib/AutoItX3/window/send_message.rb
#post_message(msg, info1 = 0, info2 = 0) ⇒ Object
Puts a window message in self‘s message queue and immediately returns.
Parameters
msg-
The message to send. Either a constant from the Window::Messages module, or a symbol formed off a such name. For example, for WM_QUIT you’d pass :quit.
info1-
(0) Additional message-specific information (wParam value).
info2-
(0) Additional message-specific information (lParam value).
Return value
The return value of the PostMessage() function.
Raises
- Au3Error
-
Window not found.
- Errno::EACCES
-
Windows’s security policy blocked the function call.
Example
win.(:quit) #Request a window to exit. It doesn't have to obey, though.
Remarks
You can find the additional paramters needed for each message at the Windows API docs at MSDN. I recommand you to query the search function with something like “WM_PAINT” if you want to know more about WM_PAINT.
259 260 261 262 263 264 265 266 267 |
# File 'lib/AutoItX3/window/send_message.rb', line 259 def (msg, info1 = 0, info2 = 0) Window.functions[__method__] ||= Win32::API.new("PostMessage", 'LILL', 'I', "user32") raise_unfound unless exists? msg = Messages.const_get(:"WM_#{msg.to_s.upcase}") if msg.kind_of? Symbol ret = Window.functions[__method__].call(self.to_i, msg, info1, info2) Kernel.raise(Errno::EACCES, "The Windows UIPI blocked your function call.") if Window.functions[:get_last_error].call == 5 ret end |