How do I change the style of a tab control after it has been created?

721 Views Asked by At

I have a Windows form (not a WPF form) that contains a tab control from CommCtrl.h. According to the documentation, I should be able to change the "style" to TCS_BUTTONS after the control has been created. Unfortunately, I can't find any examples on how to do that. Can anyone provide a reference to C++ or VB6 code to do this?

More specifically, I'm using PowerBuilder 11.5 which wraps the native MS tab control. PowerBuilder doesn't expose the TCS_BUTTONS style but I'm looking for a way to send the raw messages to change the style anyway to get around this PowerBuilder limitation.

1

There are 1 best solutions below

3
On

I'm not sure about the PowerBuilder angle but if you want to add a flag in the style of a control try this:

DWORD dwStyle = ::GetWindowLong(hWnd, GWL_STYLE);
dwStyle |= TCS_BUTTONS;

::SetWindowLong(hWnd, GWL_STYLE, dwStyle);

You can use the same sort of concept to remove a style, e.g.

dwStyle &= ~dwRemove;