How can I remove the caption bar icons at run-time?
Applies To: C++Builder 1 or higher
Category: Knowledge Base
- At design-time, I can easily change the BorderIcons property of my form to modify the caption bar icons. However, modifying this property at run-time does not change anything.
-

-
- Start a new project using File | New Application.
-
- Add a Button. Edit its OnClick event:
-
- void __fastcall TForm1::Button1Click(TObject *Sender)
- {
- LONG style;
- // Get the current style
- style = GetWindowLong(Handle, GWL_STYLE);
- // Remove the system menu
- style &= ~WS_SYSMENU;
- SetWindowLong(Handle, GWL_STYLE, style);
- // Redraw the form
- RedrawWindow(Handle, 0, 0, RDW_FRAME | RDW_UPDATENOW
- | RDW_INVALIDATE);
- }
-
- The SetWindowLong Win32 API function helps you change the behavior of your form.
-
- Hints
- · To show the system menu, set the style to style |= WS_SYSMENU;
- · You can also remove/show individually the minimize and maximize boxes by using WS_MINIMIZEBOX and WS_MAXIMIZEBOX.
C++Builder Developer's Network
Copyright © Yoto Yotov