CreateFileMapping返回null. [英] CreateFileMapping returns null.

查看:379
本文介绍了CreateFileMapping返回null.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对不起,我的英语.

我想创建地图文件.我在代码项目中找到了一个示例.但是在使用中,该示例向我展示了一些失败:

Sorry for my English.

I want to create map file. I found an example at the code project. But in use that example show me some fails:

IntPtr m_pMapFile;
IntPtr m_pBuff;

string data = "TestTest";

// create map file
m_pMapFile = WinCE.CreateFileMapping(WinCEConst.INVALID_HANDLE_VALUE, null, WinCEConst.PAGE_READWRITE, 0, MapSize, MapName);



编译后,变量m_pMapFile的值为0.



After compiling, variable m_pMapFile takes the value 0.

// get map file
m_pBuff = WinCE.MapViewOfFile(m_pMapFile, WinCEConst.FILE_MAP_ALL_ACCESS, 0, 0, MapSize);



然后变量m_pBuff取值为0.



Then variable m_pBuff takes the value 0.

What''s the problem?

推荐答案

您可以通过在CreateFileMapping语句周围放置try .. catch块来跟踪确切的问题.
You can trace the exact problem by putting try.. catch block around CreateFileMapping statement.


这篇关于CreateFileMapping返回null.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆