当我从Ulong64转换为cstring值时会被64位截断,任何人都可以帮我解决这个问题吗?
HMONITOR hmonitor64; // Hmonitor decl
hmonitor64 = (HMONITOR)0x0000000300290eaf;// initialize to big value
ULONG64 lmonitor64;
CString strMonitor64;
lmonitor64 = (ULONG64)hmonitor64; // typecasted to long
strMonitor64.Format(_T("%lu"), lmonitor64); // value gets truncated in cstring
答案 0 :(得分:3)
格式化ULONG64
的正确方法如下:
HMONITOR hmonitor64; // Hmonitor decl
hmonitor64 = (HMONITOR)0x0000000300290eaf;// initialize to big value
ULONG64 lmonitor64;
CString strMonitor64;
lmonitor64 = (ULONG64)hmonitor64; // typecasted to long
strMonitor64.Format(_T("%I64u"), lmonitor64); // value gets truncated in cstring