commit | 77588710a683e1a4ec085b0f3d6c8939ecc7f030 | [log] [tgz] |
---|---|---|
author | Michael Mitteregger <[email protected]> | Thu Jun 16 18:04:17 2016 |
committer | Michael Mitteregger <[email protected]> | Fri Jul 29 08:51:18 2016 |
tree | c56fc1b2a9762c7b384d7cdd03cf61b72b43f33d | |
parent | 00ba8887014ed407e81881aaf5b463c35a0bdd18 [diff] |
Add GetSubMenu and TrackPopupMenu{Ex} bindings and more menu related constants
Official IRC channel: #winapi on Mozilla IRC
This crate provides types and constants for WinAPI FFI bindings. They are gathered by hand using the Windows 10 SDK from Microsoft. I aim to replace all existing Windows FFI in other crates with this set of crates through the “Embrace, extend, and extinguish” technique.
If this crate is missing something you need, feel free to create an issue, open a pull request, or contact me via other means.
This crate depends on Rust 1.4 on Windows. On other platforms this crate is a no-op and should compile with Rust 1.0.
Cargo.toml:
[dependencies] winapi = "0.2" user32-sys = "0.2"
main.rs:
extern crate winapi; extern crate user32; use std::ffi::OsStr; use std::io::Error; use std::iter::once; use std::os::windows::ffi::OsStrExt; use std::ptr::null_mut; fn main() { let msg = "Hello, world!"; let wide: Vec<u16> = OsStr::new(msg).encode_wide().chain(once(0)).collect(); let ret = unsafe { user32::MessageBoxW(null_mut(), wide.as_ptr(), wide.as_ptr(), winapi::MB_OK) }; if ret == 0 { println!("Failed: {:?}", Error::last_os_error()); } }
Bindings to library functions are in separate crates. The source to each crate is in the relevant subdirectory under the lib
directory.
These are the ones that actually have functions in them:
These are the ones that are reserved for future use: