My test code shows that ModifyStyle(0, LVS_REPORT) added a one to the
initial style of 0x50000000 so this works. The ModifyStyleEx() seems to do
nothing. The returns are all one so the routine supposedly did it's thing
correctly.
If I replace the call ModifyStyleEx(...) with
SetExtendedStyle(GetExtendedStyle(), S1 | S2 | ...) then the
GetExtendedStyle(...) returns the correct value of 0x34.
There's no note in the documentation that SetExtendedStyle(...) won't work.
Is there something that I'm doing incorrectly.
The following code is in the OnInitialUpdate(...) function.
void HeaderView::OnInitialUpdate()
{
BOOL iRet;
DWORD dw;
CListView::OnInitialUpdate();
CListCtrl& rlc = GetListCtrl();
dw = rlc.GetStyle();
// dw = 0x50000000
iRet = rlc.ModifyStyle(0, LVS_REPORT);
dw = rlc.GetStyle();
// dw = 0x50000001
dw = rlc.GetExtendedStyle();
// dw = 0
iRet = rlc.ModifyStyleEx(0, LVS_EX_HEADERDRAGDROP);
iRet = rlc.ModifyStyleEx(0, LVS_EX_FULLROWSELECT, SWP_FRAMECHANGED);
iRet = rlc.ModifyStyleEx(0, LVS_EX_CHECKBOXES);
dw = rlc.GetExtendedStyle();
// dw = 0
iRet = rlc.SetExtendedStyle(rlc.GetExtendedStyle()
| LVS_EX_HEADERDRAGDROP
| LVS_EX_FULLROWSELECT
| LVS_EX_CHECKBOXES
);
dw = rlc.GetExtendedStyle();
// dw = 0x34
...
Ed
--
Edward E.L. Mitchell
Phone: (239)415-7039
6707 Daniel Court
Fort Myers, FL 33908
The docs say...
Return Value
"A combination of the previous extended styles used by the list view control."
This is the same return value as GetExtendedStyle(). If the control initialized
correctly does it matter what the return value is? I would also put all the new
styles on one line rather than three calls to ModifyStyleEx().
Also, is this correct? --> SWP_FRAMECHANGED
I think this is a SetWindowPos value and should be SWP_NOSIZE. If it's wrong and
ModifyStyleEx() fails it returns FALSE.
Mark (c:
The oddity here is that SetExtendedStyle(...) seems to change the extended
style whereas ModifyStyleEx(...) doesn't. As for the SWP_FRAMECHANGED I was
just testing a remark by someone in this news group that the style would
only stick if this SWP_... flag was incorporated. As you can see it does
nothing. The returns from all the ModifyStyleEx(...) functions are all
unity showing supposedly that there were no errors in the invocations!
Is there something about a style for the List View window that is different
from the underlying CListCtrl that I thought I was changing?
The SetExtendedStyle() function does its thing by ::SendMessage(m_hWnd,
LVM_SETEXTENDEDLISTVIEWSTYLE, 0, (LPARAM) dwNewStyle); and this seems to
work.
The ModifyStyleEx(...) function goes through a SetWindowLong(...) (in
AfxModifyStyle) with an offset of -20. This doesn't seem to change the
extended style.
The GetExtendedStyle() function mirrors the SetExtendedStyle() with a
::SendMessage(m_hWnd, LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0);
However, the ModifyStyle(...) function also does its thing via a
SetWindowLong with an offset of -16 which goes to the correct place because
GetStyle() can read it back.
I would of course put the styles on one line. The example was just me
trying different combinations.
Ed
"You do not access extended list-view styles in the same manner as standard
window styles. You do not use the GetWindowLong and SetWindowLong functions
to make extended style changes."
"Edward Mitchell" <EELMi...@newsgroup.nospam> wrote in message
news:elpkaGAD...@tk2msftngp13.phx.gbl...
Is it your concern here that ModifyStyleEx doesn't work with LVS_EX_xxx
values? If so, it is not supposed to.
--
Jeff Partch [VC++ MVP]
I agreed with Alexander's viewpoint. Window's extended style is different
from common control's extender style. So there are different APIs to
set/get respective style and we don't confuse them.
If there is any question, please feel free to join the community and we are
here to support you at your convenience. Thanks again and Happy New Year!
Best Regards,
Terry Fei[MSFT]
Microsoft Community Support
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
The SetExtendedStyle() method belongs to the CListCtrl in the List View and
has style bits defined by LVS_EX_... Since the controls extended style is
sent via a SendMessage(...), the number of extended style bits is not
limited to a single word and so can presumably exceed 32.
I didn't realise that there were two buckets holding "Extended" styles.
Thanks for the explanations.
Ed
""TerryFei"" <v-te...@online.microsoft.com> wrote in message
news:4YpB1NED...@TK2MSFTNGXA02.phx.gbl...