积极答复者
System.DllNotFoundException: 无法加载 DLL“rapi.dll”: 找不到指定的模块?

问题
-
[DllImport("rapi.dll", CharSet = CharSet.Unicode)]
internal static extern int CeRapiGetError();
[DllImport("rapi.dll", CharSet = CharSet.Unicode)]
internal static extern int CeRapiInit();
public void RapiInit()
{
int ret = CeRapiInit();
if( ret != 0)
{
// 连接失败,获取失败代码
int e = CeRapiGetError();
// 抛出异常
Marshal.ThrowExceptionForHR(ret);
}
// 连接成功 // To Do
}int ret = CeRapiInit(); 这行报错!!
system32目录下有rapi.dll
顺便问下是不是没有连接设备导致错误的?
答案
-
你好,
我参考Windows Mobile 6 SDK自带的例子,位于\Common\CPP\Win32\Rapi\Pdir目录,在连接设备的情况下,CeRapiInit()函数返回成功;
在断开设备的情况下,CeRapiInit()函数不成功。
另外,编译这个工程的时候,需要加入C:\Program Files\Windows Mobile 6 SDK\Activesync\inc和C:\Program Files\Windows Mobile 6 SDK\Activesync\Lib这两个的依赖。具体可以参考\Common\CPP\Win32\Rapi\Pdir目录下的readme.txt。
施炯- 已标记为答案 Jiong ShiMVP, Moderator 2011年3月18日 6:02
-
你好:
rapi 是依赖于ActiveSync,你是不是没有装ActiveSync啊?建议你确认一下
Pet Yu [MSFT]
MSDN Community Support | Feedback to us
Get or Request Code Sample from Microsoft
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
- 已标记为答案 Jiong ShiMVP, Moderator 2011年3月23日 9:00
-
全部回复
-
[DllImport("rapi.dll", CharSet = CharSet.Unicode)]
internal static extern int CeRapiGetError();
[DllImport("rapi.dll", CharSet = CharSet.Unicode)]
internal static extern int CeRapiInit();
public void RapiInit()
{
int ret = CeRapiInit();
if( ret != 0)
{
// 连接失败,获取失败代码
int e = CeRapiGetError();
// 抛出异常
Marshal.ThrowExceptionForHR(ret);
}
// 连接成功 // To Do
}int ret = CeRapiInit(); 这行报错!!
system32目录下有rapi.dll
顺便问下是不是没有连接设备导致错误的?
- 已合并 Jiong ShiMVP, Moderator 2011年3月17日 4:53 重复内容的帖子
-
你好,
我参考Windows Mobile 6 SDK自带的例子,位于\Common\CPP\Win32\Rapi\Pdir目录,在连接设备的情况下,CeRapiInit()函数返回成功;
在断开设备的情况下,CeRapiInit()函数不成功。
另外,编译这个工程的时候,需要加入C:\Program Files\Windows Mobile 6 SDK\Activesync\inc和C:\Program Files\Windows Mobile 6 SDK\Activesync\Lib这两个的依赖。具体可以参考\Common\CPP\Win32\Rapi\Pdir目录下的readme.txt。
施炯- 已标记为答案 Jiong ShiMVP, Moderator 2011年3月18日 6:02
-
你好:
rapi 是依赖于ActiveSync,你是不是没有装ActiveSync啊?建议你确认一下
Pet Yu [MSFT]
MSDN Community Support | Feedback to us
Get or Request Code Sample from Microsoft
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
- 已标记为答案 Jiong ShiMVP, Moderator 2011年3月23日 9:00
-