Thursday, August 30, 2007

How to debug your Control Panel Application(or applet) in Windows Mobile Devices?

How to debug Control Panel Applets in Pocket PC 2003 and Pocket PC 5.0 devices?

Recently while developing my En2FaMail control panel program i came into this problem.
Reading MSDN documentations and searching Internet,you will find you have to use ctlpnl.exe as your host program.But this doesn't seem to work.

Anyway before beginning,a short introduction to Control Panel Applets!

Control Panel Applets are basically dll files but with extension of cpl.And they have to export a function like this.

LONG CALLBACK CPlApplet (HWND hwndCPL, UINT uMsg, LONG lParam1, LONG lParam2)

And windows send following messages to communicate with this applet

CPL_GETCOUNT
CPL_INIT
CPL_NEWINQUIRE
CPL_STOP

There is also a sample in PocketPc 5.0(and i guess also PocketPc 2003) SDKS,name MyBacklight.

Also you can read following pages for more information on how to develop your own Control Panel Applets.
An Ancient Story of Control Panel Applets
Using Control Panel

So how to debug your program?

As Control Panel Applets are dll files they need a host,so to function and also for you to debug them.
I find out you can use mstli.exe as your host application.You have to set \windows\mstli.exe as your host in visual studio debugging page.
But if mstli.exe was ran for any reasons,first you have to kill this task.Eighter by visual studio or your own task manager in your PocketPc.(You cant use default memory control panel applet to kill this task,as it is not shown there).

After deploying and running,you also have to manually start your program,by going into settings and tapping on your application name.
Also it seems you have to do it not very slowly,as visual studio again terminates the task.

And then you are good to go!

1 comment:

Shiv said...

Its highly informative. I would be visiting your blog hereafter regularly to gather valuable information.Website Hosting India