To mark a Pocket PC app as being resolution aware, you have to compile a native resource file into it. VS.NET doesn't have a way of doing this so we published a tool called RES2EXE which allows you to push a res file into a compiled .NET CF exe file. Using it is pretty straightforward (see the Second Edition managed code whitepaper for details) but the debugging story is pretty painful. To debug a resolution aware app you have to:
- Build your project from VS.NET
- Open up a command line and run the RES2EXE tool on your compiled output
- Note: you must run the tool on the version of your output in the Obj directory - not Bin.
- Switch back to VS.NET and launch the debugger
With Whidbey life will be easier, but until then you can either get used to the steps above or take advantage of VS.NET macro engine to automate the process. Below is the macro I'm using for this. After creating the macro, you can place a button for it on a toolbar or even bind a keyboard shortcut to it (I use Ctrl-Shift-Alt-F5). So now I can forget about switching back and forth to the command line and be happy once again. Enjoy!
Public Sub DebugAsHighRes()
' Path for 2nd Edition Resources. You may need to change this to match your setup.
Dim SecondEditionResources As String = "C:\Program Files\Developer Resources for Windows Mobile 2003 Second Edition\tools\"
Dim ActiveProject As Project = DTE.ActiveWindow.Project
Dim Solution As SolutionBuild = DTE.Solution.SolutionBuild
' Create the command line for marking the output file as resolution aware
Dim ResFile As String = """" + SecondEditionResources + "\hidpi.res"""
Dim Params As String = " -r -c "
Dim Res2Exe As String = """" + SecondEditionResources + "\res2exe.exe"""
Dim OutputFile As String = """" + ActiveProject.Properties.Item("LocalPath").Value + "\obj\Debug\" + ActiveProject.Properties.Item("OutputFileName").Value + """"
Dim Command As String = Res2Exe + Params + ResFile + " " + OutputFile
' Build, mark has resolution aware, and then launch the debugger
Solution.BuildProject("Debug", ActiveProject.UniqueName, True)
Shell(Command, AppWinStyle.Hide, True)
[Author: Robert Levy]