Hey there...
Recently I have been looking into creating new Control Panel applets in C.
I got this link from Msdn: Msdn Shell Stuff which seemed very helpful and tried to use their sample code. This however did not work...
I simplified their code to this, which still has a problem:
Code:
#include <cpl.h>
BOOL WINAPI CALLBACK __declspec(dllexport) CPlApplet(HWND hwnd,UINT Msg,LONG lParam1,LONG lParam2)
{
CPLINFO * cp;
switch(Msg) {
case CPL_INIT:
//no memory to set, so do nothing...
return TRUE;
case CPL_GETCOUNT:
return 1; //only one subprogram...
case CPL_INQUIRE:
cp = (CPLINFO*)lParam2;
cp->idIcon = IDMAINICON;
cp->idName = IDNAME;
cp->idInfo = IDDESCR;
cp->lData = 0;
return 0;
case CPL_DBLCLK:
MessageBox(hwnd,"The message was correctly processed?","status",0);
break;
}
return FALSE;
}
The problem is that when called from the Control Panel as it supposed to be, Explorer crashes. hmmm. Don't know why?
Using Messageboxes, saw that CPL_INIT was called, and that the crash was just after. There were no error logs, and I don't know how to track this down further.
The dll file generated had CPlApplet as entry-point, as I think it was supposed to...
Thanks for your time and trouble.