Windows 7 - how to add control panel applet

Asked By Gu on 05-Sep-08 03:28 AM
Can somone help me quick steppings in how to add my own icon in Win CE 5.0
control pannel, on that icon, i want to open a custom dialog, ive made a lot
of search in cplmain and cplutil.cpp's but i didnt gor how to do this,
can someone give me full steps to add an icon in cntrl pannel and then
assosiate that with a dialog resource? Plz also give me some code snippets

Sag replied on 05-Sep-08 04:32 AM

1. create your own icon (MY_ICON) with the pb ressource editor.
2. load the icon  with LoadIcon()
3. inside the CPL_NEWINQUIRE message replace the hIcon value of your
LPNEWCPLINFO struct  with your icon
thats it.

for example
lpNewCplInfo->hIcon =  LoadIcon (g_hInst,(LPCTSTR) MAKEINTRESOURCE(MY_ICON));
see for an example and
replace the lpNewCplInfo->hIcon value with your loaded icon.

Gu replied on 05-Sep-08 05:39 AM

Thanks for reply.
I did that changing u said as:

lpNewCplInfo->hIcon =  LoadIcon (g_hInst,(LPCTSTR)

return GetCplInfo(lParam1, (NEWCPLINFO*)lParam2);

but it still doesnt worked, it gave error like lpNewCplInfo undeclared
Please help me with some detailed steps that
1. How to show icon in cntrl panel.
2. Then how to envoke some .exe or show some resource dialog
Sag replied on 05-Sep-08 07:11 AM

lpNewCplInfo is a variable of LPNEWCPLINFO, given as lParam2 parameter of
the CPlApplet function of you applet.  The hIcon member is the Icon displayed
in the control panel for your applet. If you press this icon, your dialog
will be displayed.

Or do you wan't to display an Icon in your dialog and use it as button?
In that case, you can add an picture in your dialog (you can set the Type to
Icon in the porperties dialog) and wait for mouse click message.  I belive
you can also add an button and set an icon as background image, see MSDN for
button messages to control buttons. Or you create an application-defined
window control see MSDN too.

To open a custom dialog use DialogBox() function

Bruce Eitman [eMVP] replied on 05-Sep-08 08:31 AM
There is a good how to page for creating a control panel applet in PB Help,
have you reviewed that?

There are also examples of control panel applets in shared source code.

Bruce Eitman (eMVP)
Senior Engineer
Bruce.Eitman AT EuroTech DOT com

EuroTech Inc.
Gu replied on 05-Sep-08 09:03 AM
Thank u Very much all.
thank u, ive done it