Path issues for Windows Mobile Development

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.