i noticed that in the powertoy ttweak UI by microsoft some of the control
panel shortcuts are .cpl files. instead of adding stuff to the control panel
via the registry i was wondering if there was a way to create .cpl files to
add stuff to the registry?
You create a DLL and in the code you export a function named
CPLApplet. This function has a declaration (in Delphi) of ...
function CPlApplet(hwndCPl: THandle; uMsg: DWORD;
lParam1, lParam2: Longint): Longint; stdcall;
In the function code you must handle uMsg (again in Delphi) of ...
const
NUM_APPLETS = 1;
intTrue = integer(true);
intFalse = integer(false);
case uMsg of
CPL_INIT : Result := intTrue;
CPL_GETCOUNT : Result := NUM_APPLETS;
CPL_INQUIRE :
begin
lParam1 := 0;
with PCPlInfo(lParam2)^ do begin
{resource identifiers in the control panel applet see
below for typical}
idName := 1;
idInfo := 2;
idIcon := 3;
end;
Result := intTrue;
end;
CPL_SELECT : Result := intFalse;
CPL_DBLCLK :
// This calls the display of the form you have coded for the
CP applet
CPL_STOP : Result := intFalse;
CPL_EXIT : Result := intFalse;
CPL_NEWINQUIRE : Result := intFalse;
else Result := intFalse;
end;
Typical resource content file (*.RC sent to a resource compiler)
contains references for the displayed applet name, the info tip, and
the icon in the resource, typically ...
STRINGTABLE
{
1, "Control Panel Applet"
2, "My First Control Panel Applet"
}
3 ICON "..\Icons\My CP Applet.ico"
When you have created the DLL, then you rename it to a .cpl and place
it in the <windows>\System\System32 folder. The OS will pick it up
from there and diaplay it in Control Panel.
Google for "CPApplet" and your favourite language, and you'll get
something described in that langauge.
Alan Lloyd