Replacing Windows NT Control Panel's Mouse Applet

Last reviewed: November 2, 1995
Article ID: Q110704
The information in this article applies to:
  • Microsoft Win32 Application Programming Interface (API) included with:

        - Microsoft Windows NT versions 3.1 and 3.5
    

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

   -or-

   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.


Additional reference words: 3.10 3.50
KBCategory: kbui
KBSubcategory: UsrMisc


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: November 2, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.