Although DLLs are central to the architecture of Windows, they are not necessary components of most Windows applications. Your application does not have to use a DLL simply to maximize Windows' management of memory. If you split your application into multiple code segments, Windows provides a type of dynamic linking between code segments that allows for optimal memory usage.
However, among other purposes, DLLs are useful for:
Sharing code and resources among applications.
Allowing the Dialog Editor to support your custom-designed controls.
Facilitating the development of a complex application.
Easily customizing your application for different markets.
Filtering messages on a system-wide basis.
Creating device drivers.
The most common use for DLLs is sharing objects between applications. Certain types of objects, including code and resources, can be freely shared using a DLL. The sharing of other types of objects, including data and file handles, is much more limited. This is because file handles and data are created in an application's private address space. Attempts to share file handles, or to share data (outside of DDE, the clipboard, and the library's data segment) will lead to unpredictable results and could be incompatible with future versions of Windows.
This section describes how to use a DLL so applications can share code and resources.