Microsoft KB Archive/110704

From BetaArchive Wiki

HOWTO: Replace Windows NT Control Panel's Mouse Applet

Q110704



The information in this article applies to:


  • Microsoft Win32 Software Development Kit (SDK), on platform(s):
    • the operating system: Microsoft Windows NT, versions 3.1, 3.5





SUMMARY

The Control Panel includes a Mouse applet as a standard applet that is shipped with the system. In Windows 3.1, this applet can be overridden by an ISV/OEM's mouse driver or module. Windows 3.1 accomplished this by the Control Panel doing a GetModuleHandle() call on "Mouse". If MOUSE.DLL or MOUSE.EXE was already loaded in the system, Control Panel would look for the entry point "CPlApplet". If found, Control Panel would send the following messages:


  • CPL_NEWINQUIRE
  • CPL_INQUIRE (the former is preferred)

This would return the icon and strings to replace the mouse icon already in Control Panel.

In Windows NT, because of the separation of Kernel drivers from applications by the client-server interface, the GetModuleHandle() call does not work. Consequently, the same functionality must be achieved in a slightly different way. The Control Panel calls LoadLibrary( "Mouse" ) to look for a MOUSE.DLL or a MOUSE.EXE. If this call fails, no other checks are made.

If LoadLibrary() succeeds, the Control Panel looks for the "CPlApplet" entry point, sends a CPL_INIT message, and then sends a CPL_NEWINQUIRE. If CPL_NEWINQUIRE fails, a CPL_INQUIRE is sent; however, it is preferable to have the applet implement the newer CPL_NEWINQUIRE message. The string information returned by the CPL_NEWINQUIRE message can be in either UNICODE or ANSI (UNICODE is preferred) as long as the dwSize field is set correctly. See the CPL.H public header file for these messages and structures (for example CPLINFOW or CPLINFOA, where CPLINFOW is the default).

When the User double-clicks the Mouse applet icon, the MOUSE.DLL or MOUSE.EXE will receive a CPL_DBLCLK message from the CPlApplet interface. This routine must return TRUE to the Control Panel if the routine runs its own dialog. If FALSE is returned, the internal Mouse Dialog box will be presented to the User.

The Control Panel will send the CPL_EXIT message to the Mouse applet when it wants to unload the module or terminate. The applet must use this message to perform tasks such as calling UnRegisterWindowClass(), freeing memory, and unloading DLLs.

NOTE: It is not possible to replace any of the other standard Windows NT 3.1 Control Panel applets. As of Windows NT 3.5, it is also possible to replace the Keyboard applet in the same manner.

In Windows NT 4.0 and later, the mouse control panel applet should be extended, not replaced, using a control panel extension.

Additional query words:

Keywords : kbCPApplet kbOSWinNT310 kbOSWinNT350 kbOSWinNT351 kbGrpDSUser
Issue type : kbhowto
Technology : kbWin32SDKSearch kbAudDeveloper kbSDKSearch kbWin32sSearch


Last Reviewed: October 27, 2000
© 2001 Microsoft Corporation. All rights reserved. Terms of Use.