INFO: Global Classes in Win32

ID: Q80382


The information in this article applies to:


SUMMARY

Under 16-bit Windows, when an application wants to check whether or not a window class has been previously registered in the system, it typically checks hPrevInstance. Under 32-bit Windows and Windows NT, hPreviousInstance is always FALSE, because a class definition is not available outside the process context of the process that registers it. Thus, code that checks hPreviousInstance will always register the window class.


MORE INFORMATION

Under 32-bit Windows and Windows NT, a style of CS_GLOBALCLASS indicates that the class is available to every DLL in the process, not every application and DLL in the system, as it does in Windows 3.1.

To have a class registered for every process in the system under Windows NT:

  1. Register the class in a DLL.


  2. Use a style of CS_GLOBALCLASS.


  3. List the DLL in the following registry key.
    
       HKEY_LOCAL_MACHINE\S OFTWARE\ 
          Microsoft\ 
          Windows NT\ 
          CurrentVersion\ 
          Windows\ 
          AppInit_DLLs
     


This will force the DLL to be loaded into every process in the system, thereby registering the class in each and every process.

NOTE: This technique does not work under Windows 95.


Keywords          : kbNTOS kbGrpUser kbWinOS95 kbWinOS98 kbWndw kbWndwClass 
Version           : 
Platform          : 
Issue type        : kbinfo 

Last Reviewed: March 7, 1999