Applet and source code for Borland C++ ONLY!! (40kb)
base.cpl - the basic applet
The finished applet, without any source code. (uncompressed). (43kb)
Choose Save from the dialog box and select your Windows\System directory. Base.cpl will then appear in Control Panel when you next open it.
This applet has only a single dialog box and creates, opens, sets and then reads a single registry key. The zip file contains the finished applet and all source code. Note: that this code did not produce a valid cpl file when compiled with MS Visual C++ 5.0 so I cannot guarantee it will work in any other flavours of Visual C. It does successfully compile and execute in Borland C++ 5.0 and I will be happy to help if you have problems developing applets based on base.cpl
The applet code was written to avoid having to install or download special DLL files like Borland's OWL or Microsoft's MFC libraries. Therefore, it does not use CDialog (MS) or TDialog (Borland) and you must call all functions through the WindowsAPI directly. e.g. (all one line)
BOOL CALLBACK GetMeADialogBoxFunc(HWND hdwnd, UINT message, WPARAM wParam, LPARAM lParam)
To create a valid CPL file, you must configure your project to create a DLL and then either alter the target settings to use the .cpl extension instead of .dll or manually rename the file once compiled. Also, the following function must replace DllEntryPoint (which in turn replaces the WinMain function that is needed for an .exe project):
extern "C" FAR LONG CALLBACK _export CPlApplet(HWND hwndCPL, UINT uMsg, LPARAM lParam1 , LPARAM lParam2)
You will also need to use a .def file (included in the kit) that exports the CPlApplet function. It is the need for the _export keyword that causes difficulty with MS Visual C++.
This is part of www.codehelp.co.uk Copyright © 1998-2004 Neil Williams
See the file about.html for copying conditions.