Created
January 25, 2014 00:38
-
-
Save andor44/8609811 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
unsafe { | |
let namelen = GetWindowTextLengthA(wh); | |
let mut namebuf : ~[u8] = std::vec::with_capacity((namelen+2) as uint); | |
GetWindowTextA(wh, namebuf.as_mut_ptr() as *mut i8, namelen+1); | |
namebuf.set_len(namelen as uint); | |
println!("Window: {:s}", match std::str::is_utf8(namebuf) { | |
true => std::str::from_utf8(namebuf), | |
false => "Non-UTF8 win name"} | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment