在Windows Mobile和Windows Embedded CE开发过程中经常会遇到路径问题。在论坛中还有不少人下面的问题。
“找不到文件的异常”
其实这个问题很容易解决,路径一般分为绝对路径和相对路径,下面讲述如何查这些路径。
绝对路径
查绝对路径,首先需要ActiveSync设备。
右键点击Explore
点击 My Windows Mobile-Based Deivce
进入相应的路径。注意路径是以根目录“”开始的,没有C盘,D盘的概念。
相对路径
.NET Compact Framework
System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.FullyQualifiedName);
Native C++
BOOL APIENTRY DllMain( HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved){ HINSTANCE hInst = (HINSTANCE)hModule; TCHAR pathChar[MAX_PATH]; memset(pathChar, 0 , sizeof(char) * MAX_PATH); //Get exe path GetModuleFileName(NULL, pathChar, MAX_PATH); CString path(pathChar); path = path.Left(path.ReverseFind('\') + 1); memset(pathChar, 0 , sizeof(char) * MAX_PATH); //Get DLL path GetModuleFileName(hInst, pathChar, MAX_PATH); path = pathChar; path = path.Left(path.ReverseFind('\') + 1);}
具体请参考
在Windows Mobile和Wince(Windows Embedded CE)下进行Native C++开发,如何取出当前执行文件的路径和调用模块的路径
在Windows Mobile和Wince(Windows Embedded CE)下使用.NET Compact Framework 取当前运行文件的路径
相对路径查问题的方法一般是取出路径,然后和绝对路径进行比较,找出生成路径时的错误。
分享到:
相关推荐
Windows Mobile开发Windows Mobile开发Windows Mobile开发Windows Mobile开发
Windows Mobile开发实验,wince操作系统定制。
如何搭建windows mobile应用开发的环境
windows mobile开发常用工具介绍
Windows mobile应用开发流程
windows mobile开发环境搭建全过程 helloworld
结合经验和实例软件来介绍Windows Mobile操作系统上的短信开发技术
windows mobile驱动开发
有关windows mobile 实例开发的问题,希望对大家有所帮助
pknife出品 有详尽的开发实例 不可多得
Windows Mobile开发概述 --微软有关用于智能手机的操作系统Windows Mobile概述。对初次了解的人还是有用的。
Windows CE 、Windows Mobile概念介绍,Windows Mobile开发工具简介,Windows Mobile开发环境搭建指南,智能手机Smartphone开发从零起步。
Windows Mobile 6.1 开发指南,希望对大家有用!
Windows Mobile应用程序开发介绍 .Windows Mobile平台 .Windows Mobile开发环境搭建 .Windows Mobile开发技术和资源 .Demo
WinCE和Windows Mobile开发资料大全,包括《Windows CE程序设计.pdf》、《Window Mobile 6.1的新特性.pdf》、《Windows Mobile GPS应用开发指南.pdf》和《WM Comparison(Mobile各个版本比较).pdf》
Windows Mobile 3rd 技术开发黄金周(2):Windows Mobile开发中的异构系统集成
介绍WindowsMobile应用程序开发的流程。
Windows Mobile中如何开发GPS应用
Windows-Mobile平台应用与开发 Windows-Mobile平台应用与开发 Windows-Mobile平台应用与开发