Search code examples
winapimfctitlecaptionscintilla

How to set title/caption of Scintilla window


I have created a Scintilla window using CreateWindow() and want to set the title dynamically as different files are loaded into it. However, SetWindowText() is setting the content of the edit box rather than the caption. I also tried WM_SETTEXT to the same effect.

How do I set the title of the window instead?


Solution

  • Is the Scintilla window a top-level window with a caption? That is usually not the correct way to do things, you should create a custom container window with a caption and the Scintilla window should be a child window. This child window can take up the entire client area if required.

    Using a control directly as a top-level window is not just problematic because of the caption text issue, there are also often notification messages from a control that you need to handle and these are sent to the controls parent window.