Click here to Skip to main content
15,892,517 members
Articles / Programming Languages / C#

Enumerate and Host Control Panel Applets using C#.

Rate me:
Please Sign up or sign in to vote.
4.90/5 (18 votes)
15 Feb 200424 min read 99.3K   2.5K   56  
Demonstrates how to enumerate and host Windows Control Panel Applets using C# and unmanaged C++.
using System;

namespace AppletEngine
{
	/// <summary>
	/// Summary description for AppletMessages.
	/// </summary>
	public enum AppletMessages
	{
		Initialize = 1,
		/*  This message is sent to indicate CPlApplet() was found. */
		/*  lParam1 and lParam2 are not defined. */
		/*  Return TRUE or FALSE indicating whether the control panel should proceed. */

		GetCount = 2,
		/*  This message is sent to determine the number of applets to be displayed. */
		/*  lParam1 and lParam2 are not defined. */
		/*  Return the number of applets you wish to display in the control */
		/*  panel window. */

		Inquire = 3,
		/*  This message is sent for information about each applet. */
		/*  A CPL SHOULD HANDLE BOTH THE CPL_INQUIRE AND CPL_NEWINQUIRE MESSAGES. */
		/*  The developer must not make any assumptions about the order or dependance */
		/*  of CPL inquiries. */
		/*  lParam1 is the applet number to register, a value from 0 to */
		/*  (CPL_GETCOUNT - 1).  lParam2 is a far ptr to a CPLINFO structure. */
		/*  Fill in CPLINFO's IconResourceId, NameResourceId, InformationResourceId and AppletDefinedData fields with */
		/*  the resource id for an icon to display, name and description string ids, */
		/*  and a long data item associated with applet #lParam1.  This information */
		/*  may be cached by the caller at runtime and/or across sessions. */
		/*  To prevent caching, see CPL_DYNAMIC_RES, above.  */

		Select = 4,
		/*  The CPL_SELECT message has been deleted. */

		DoubleClick = 5,
		/*  This message is sent when the applet's icon has been double-clicked */
		/*  upon.  lParam1 is the applet number which was selected.  lParam2 is the */
		/*  applet's AppletDefinedData value. */
		/*  This message should initiate the applet's dialog box. */

		Stop = 6,
		/*  This message is sent for each applet when the control panel is exiting. */
		/*  lParam1 is the applet number.  lParam2 is the applet's AppletDefinedData  value. */
		/*  Do applet specific cleaning up here. */

		Exit = 7,
		/*  This message is sent just before the control panel calls FreeLibrary. */
		/*  lParam1 and lParam2 are not defined. */
		/*  Do non-applet specific cleaning up here. */

		NewInquire = 8
		/* Same as CPL_INQUIRE execpt lParam2 is a pointer to a NEWCPLINFO struct. */
		/*  A CPL SHOULD HANDLE BOTH THE CPL_INQUIRE AND CPL_NEWINQUIRE MESSAGES. */
		/*  The developer must not make any assumptions about the order or dependance */
		/*  of CPL inquiries. */
	}
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Software Developer (Senior)
United States United States
Senior Application Developer specializing in Windows desktop and network development.

Professional Experience
- B.S. of Computer Science (Graduated 2001 - PSU)
- Senior Application Developer (8+ yrs)
- Microsoft Certified Professional

Primary Interests
- C#, C++, HTML, Javascript
- XML, ASP.NET, Web Services, SOAP, UDDI
- Socket programming and anything network related
- Reflection, Serialization, and Plugin Frameworks
- Owner-drawn controls and GDI+ goodness

Comments and Discussions