There is an example of creating control panel applets in Windows.
- Download/Clone this repository.
- Open solution file
.sln
. - Build the solution.
This sample writes in registry under HKEY_LOCAL_MACHINE
. So you need to run this application with administator rights.
-
Open Visual Studio 2015 IDE.
-
Start project wizard
File->New->Project
-
Select Visual C++ MFC Dll
Visual C++->MFC->MFC DLL
-
Press
OK
andFinish
. -
Add extern applet function that initialize and handling your applet. For example see function
CplApplet
here. -
Define your applet function in definition file
.def
.
-
Open project properties.
-
In
General
tab changeTarget Extension
to.cpl
. -
In
Debugging
tab addCommand : <Path to Rundll32.exe>\Rundll32.exe Command Arguments : shell32.dll, Control_RunDLL "$(TargetPath)"
-
Press
Ok
.
Here you can see examples of Command
x86 configuration : C:\Windows\SysWOW64\Rundll32.exe
x64 configuration : C:\Windows\System32\Rundll32.exe
This exception is thrown because the CommCtl32.dll tries to modify the resources for the pages.
To avoid it you should change the font of the pages so they are not MS Sans Serif
. MFC checks the dialog template font for the page. If it is not MS Sans Serif, MFC makes a copy of the resource in read/write memory, and then modifies the font and passes this to the C mCtl32.dll. When the DLL writes to the template for the page, it is writing to read/write memory. Therfore, an exception is not thrown.
Also you can read full article about this on msdn.