首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

读取内存中的值,如何读取float

2012-11-08 
读取内存中的值,怎么读取float?C# code//读取内存中的整数public int ReadMemoryValue(int address, int p

读取内存中的值,怎么读取float?

C# code
       //读取内存中的整数         public int ReadMemoryValue(int address, int processId)        {            try            {                byte[] buffer = new byte[4];                IntPtr byteAddress = Marshal.UnsafeAddrOfPinnedArrayElement(buffer, 0); //获取缓冲区地址                IntPtr hProcess = OpenProcess(0x1F0FFF, false, processId);                ReadProcessMemory(hProcess, (IntPtr)address, byteAddress, 4, IntPtr.Zero); //将制定内存中的值读入缓冲区                CloseHandle(hProcess);                Console.WriteLine(Marshal.ReadIntPtr(byteAddress));                return Marshal.ReadInt32(byteAddress);              }            catch            {                return 0;            }        } 这个是整数的,怎么读取浮点类型的值?如果有 Marshal.ReadFloat() 就好了...


[解决办法]
http://topic.csdn.net/u/20071015/16/20e927fe-01ee-43bc-919f-edcb9bed6a09.html
[解决办法]
使用BitConverter类。

热点排行