Blog Stats

windows mobile

I wanted to write my GUI using C#/.NET WinForms as it is a lot easier than MFC and more portable. But I needed to access some low-level functions packaged in MFC dll. So I needed to call unmanaged code and I found 2 usefull articles:

I tried the technique on PC. It works. When I tried it on Windows Mobile 6, it kept showing “Can’t find PInvoke DLL ‘nameofmydll.dll’.” I put both managed & unmanaged dll in the same folder. The message didn’t make any sense. I searched on internet, some people were saying the my MFC dll must be compiled for the right platform. I checked my target platform (under Configuration Properties\C/C++\Advanced\Compile For Architecture) and it was correct ARM4. It baffled me. Eventually, I tried to link to static MFC dll, and it works.

My theory was that MS didn’t include MFC dll (at least the version I need) with my Windows Mobile. Later, I found out from MS: “MFC8.0 (DLL) is not ensured to be on the device. ” Link to the article.

I have HTC Touch cellphone running on Windows Mobile 6.1. I always wanted to write some apps on it for awhile just to play with it. Finally, I was able to find time and wrote a Hello World app using WinForms.

The cool part of .NET is that I can run the problem on my PC w/o using emulator. In fact, it’s faster to debug by running the .NET assembly then using emulator.