Path problems are often encountered during the development of Windows Mobile and Windows Embedded CE. There are still many questions in the Forum.
"File not found exception"
In fact, this problem is easy to solve. paths are generally divided into absolute paths and relative paths. The following describes how to query these paths.
Absolute path
To check the absolute path, you must first use the ActiveSync device.
Right-click Explore
Click My Windows Mobile-Based Deivce.
Enter the corresponding path. Note that the path starts with the root directory "\", and there is no disk C or disk D concept.
Relative Path
. 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(TCHAR) * MAX_PATH);
//Get exe path
GetModuleFileName(NULL, pathChar, MAX_PATH);
CString path(pathChar);
path = path.Left(path.ReverseFind('\\') + 1);
memset(pathChar, 0 , sizeof(TCHAR) * MAX_PATH);
//Get DLL path
GetModuleFileName(hInst, pathChar, MAX_PATH);
path = pathChar;
path = path.Left(path.ReverseFind('\\') + 1);
}
For more information, see
Native C ++ development in Windows Mobile and Windows Wince (Windows Embedded CE), how to retrieve the path of the current execution file and the path of the call module
Use. NET Compact Framework in Windows Mobile and Windows Wince (Windows Embedded CE) to obtain the path of the current running File
The problem of relative path query is generally to retrieve the path and compare it with the absolute path to find out the error when generating the path.