1 // Copyright © 2015, Peter Atashian 2 // Licensed under the MIT License <LICENSE.md> 3 //! Macro APIs, window message crackers, and control APIs 4 //1233 GET_X_LPARAM(lp: ::LPARAM) -> ::c_int5pub fn GET_X_LPARAM(lp: ::LPARAM) -> ::c_int { 6 ::LOWORD(lp as ::DWORD) as ::c_short as ::c_int 7 } GET_Y_LPARAM(lp: ::LPARAM) -> ::c_int8pub fn GET_Y_LPARAM(lp: ::LPARAM) -> ::c_int { 9 ::HIWORD(lp as ::DWORD) as ::c_short as ::c_int 10 } 11 #[test] test_get_x_lparam()12fn test_get_x_lparam() { 13 assert_eq!(GET_X_LPARAM(0xDEAD1234u32 as ::LPARAM), 0x1234); 14 assert_eq!(GET_X_LPARAM(0xBEEFffffu32 as ::LPARAM), -1); 15 assert_eq!(GET_X_LPARAM(0xCAFEFB2Eu32 as ::LPARAM), -1234); 16 } 17 #[test] test_get_y_lparam()18fn test_get_y_lparam() { 19 assert_eq!(GET_Y_LPARAM(0x1234DEADu32 as ::LPARAM), 0x1234); 20 assert_eq!(GET_Y_LPARAM(0xffffBEEFu32 as ::LPARAM), -1); 21 assert_eq!(GET_Y_LPARAM(0xFB2ECAFEu32 as ::LPARAM), -1234); 22 } 23