Hi,

how can I prevent, that the user shifts listview column headers, or change the column headers size ?
Could not find a message.

Thanks,
Nordwind64
Posted on 2003-09-08 13:41:43 by Nordwind64
The way I have stopped users from resizing listview columns in the past is to subclass the listview and find the notify messages that are sent when a resize starts. The messages you are after are HDN_DIVIDERDBLCLICKA and HDN_BEGINTRACKA (for some reason I could never get the basic HDN_DIVIDERDBLCLICK and HDN_BEGINTRACK messages to work).



LVSCProc PROC uses edi ebx,hWnd:DWORD,uMsg:DWORD,wParam:DWORD,lParam:DWORD

.if uMsg==WM_NOTIFY

ASSUME edi:PTR NMHDR
mov edi,lParam
mov ebx,[edi].code

; Stop Header resizing

.if ebx== HDN_DIVIDERDBLCLICKA|| HDN_BEGINTRACKA||HDN_DIVIDERDBLCLICKW||HDN_BEGINTRACKW

invoke SetWindowLong,hMilesDlg,DWL_MSGRESULT,32

.else

invoke SetWindowLong,hMilesDlg,DWL_MSGRESULT,0

.endif

ASSUME edi:nothing
mov eax,TRUE
ret

.else

invoke CallWindowProc,oldLVProc,hWnd,uMsg,wParam,lParam

.endif

ret

LVSCProc endp
Posted on 2003-09-08 16:00:41 by MurkyT
Have you tried to send the LVM_GETHEADER message and just disable the header control. That's how I do it.

invoke SendMessage,hListView,LVM_GETHEADER,0,0
invoke EnableWindow,eax,FALSE
Posted on 2003-09-08 16:13:30 by donkey
Hi,

thanks !!!

donkey: Not possible. I use the header for sorting the listview...
MurkyT: Thank you, I will try it now !

Greetings,
Nordwind64
Posted on 2003-09-09 06:26:48 by Nordwind64
Hi,

MurkyT, what is "hMilesDlg", your dialog window ?

Greetings,
Nordwind64
Posted on 2003-09-09 13:02:55 by Nordwind64
Hi,

I found another solution, without subclassing:

Test the columnswidths and use API mouse_event with MOUSEEVENTF_LEFTUP Flag.

Thanks again,
Nordwind64
Posted on 2003-09-09 13:57:44 by Nordwind64