Share via

win32 custom controls

Antonino Perricone 0 Reputation points
2026-04-26T06:37:41.1733333+00:00

Hello,

I created a win32 custom control, in the old-fashion way: I register the class, define the styles, and the messages. All without MFC. It is inside a DLL. Now I would like to import the DLL inside the visual studio toolbox, to add the control to a RC file.

Searching around I found the include file "CustCntl.h" inside the Windows SDK, but none of its structures and defines are documentated on MSDN. It looks like, we simply need to implement and export the C function "CustomControlInfoW" but it is insufficent.

There is a guide how to define a Visual studio custom control dll?

Thanks.

PS. I am an old developer, but I think that the simplicity of Win32 message system is unbeatable.

Developer technologies | Visual Studio | Other
Developer technologies | Visual Studio | Other

A family of Microsoft suites of integrated development tools for building applications for Windows, the web, mobile devices and many other platforms. Miscellaneous topics that do not fit into specific categories.

0 comments No comments

1 answer

Sort by: Most helpful
  1. Q&A Assist
    2026-04-26T06:38:01.4233333+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    Visual Studio does not provide a documented, supported mechanism to surface arbitrary Win32 window-class–based custom controls (implemented in a plain DLL and registered with RegisterClass/Ex) directly in the Visual Studio toolbox for use in RC dialogs.

    The documented guidance for using custom controls in dialog resources is:

    1. Use the dialog editor’s “custom control” support
      • In the dialog editor, insert a generic/custom control placeholder.
      • At design time, specify:
        • The window class name of the control (the same name passed to RegisterClass/Ex).
        • The style and extended style as 32-bit hex values.
        • Position and size.
      • At run time, ensure the custom control’s window class is registered (for example, by calling the DLL’s initialization function that registers the class) before the dialog is created.
      This is described in the “Custom Controls” section for dialog box controls: the dialog editor lets a dialog template reference a custom control by its window class name and style, and the application code is responsible for registering that class.
    2. Prefer modern alternatives when possible
      • The documentation notes that the “old technique” of using raw custom controls in dialog templates is largely superseded by:
        • Subclassing existing common controls.
        • Writing an ActiveX control.
      • ActiveX controls and subclassed common controls integrate better with Visual Studio design-time tooling.
    3. Owner-draw / self-draw approaches
      • Another supported pattern is to use existing controls (buttons, static, list box, combo box) with owner-draw styles and implement custom drawing logic in the parent window or in a reusable class.
      • This keeps the dialog editor working with standard controls while still allowing custom visuals and behavior.

    The CustCntl.h header and the CustomControlInfoW export are not documented as a supported, public extension point for Visual Studio’s toolbox. The available documentation instead focuses on using dialog templates with custom window classes, common controls, owner-drawn controls, and ActiveX controls.


    References:

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.