It is an innate ability in Windows. A button control is a good example, just call CreateWindowsEx() and pass L"Button" for the class name and you've got yourself a button control. They are controls that are built into Windows.
Creating your own using this scheme is very simple. Just create a DLL project with an exported Initialize() function. Call RegisterClassEx() in that function to register your own control class. The client code can now simply call CreateWindowEx() and pass your control class name to get your control on their window. It is the window procedure you registered in your WNDCLASSEX that gives the window its custom behavior. Add your own messages to allow the client to configure your control and invoke custom features. This is exactly the way the common controls work, the initialization function is InitCommonControls, the custom messages are declared in the CommCtrl.h header file.
You can infinitely complicate that pattern with schemes to get Windows to automatically find and load your DLL and to get your controls to work in a designer. The idea behind ActiveX controls. Quite a learning curve, best to keep it simple.