Mouse position: Difference between revisions
Content deleted Content added
m →{{header|Rust}}: Update to Rust 0.9 |
|||
Line 653: | Line 653: | ||
Prints current location of the mouse cursor relative to any active window. |
Prints current location of the mouse cursor relative to any active window. |
||
This example relies on the Windows API. |
This example relies on the Windows API. |
||
<lang Rust>// |
<lang Rust>// rustc 0.9 (7613b15 2014-01-08 18:04:43 -0800) |
||
use std::libc |
use std::libc::{BOOL, HANDLE, LONG}; |
||
use std::ptr::mut_null; |
use std::ptr::mut_null; |
||
type LONG = i32; |
|||
type HWND = HANDLE; |
type HWND = HANDLE; |
||
Line 669: | Line 668: | ||
#[link_name = "user32"] |
#[link_name = "user32"] |
||
extern "system" { |
extern "system" { |
||
fn GetCursorPos(lpPoint:&mut POINT) -> BOOL; |
|||
fn GetForegroundWindow() -> HWND; |
|||
fn ScreenToClient(hWnd:HWND, lpPoint:&mut POINT); |
|||
} |
} |
||