News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

Listview header

Started by ragdog, January 03, 2015, 03:58:40 AM

Previous topic - Next topic

ragdog

Hi @all and a happy new Year

I try to disable the first column resizing and without a resizing icon.

Any an idea how work this i have only found this but without good results.


push 0
push 0
push LVM_GETHEADER
push hLvs_Result
call SendMessage ;get handle of listview header
mov hLVHeader, eax
.elseif   uMsg == WM_NOTIFY
mov edi, lParam
mov eax, [edi.NMHDR].hwndFrom
.if [edi.NMHDR].code == HDN_BEGINTRACKA
invoke SendMessage,hLVHeader,HDM_GETITEM,0,ADDR hdi
mov hdi._mask,HDI_WIDTH
mov hdi.cxy,20
invoke SendMessage,hLVHeader,HDM_SETITEM,0,ADDR hdi
.endif


Regards..

ragdog

Solved with Subclass


invoke SendMessage,hLvs_Result,LVM_GETHEADER,0,0
mov hHeader,eax
invoke SetWindowLong,hHeader,GWL_WNDPROC,offset OnListViewHeader



OnListViewHeader PROC hWnd:HWND,uMsg:UINT,wParam:WPARAM,lParam:LPARAM
local hht:HDHITTESTINFO
local pt:POINT
xor eax,eax
.if uMsg==WM_LBUTTONDOWN || uMsg==WM_SETCURSOR

invoke GetCursorPos, addr pt
invoke ScreenToClient, hWnd, addr pt
mov eax, pt.x
mov ecx, pt.y
mov hht.pt.x, eax
mov hht.pt.y, ecx

invoke SendMessage, hWnd, HDM_HITTEST, 0, addr hht
mov ecx, hht.flags
.if ecx == HHT_ONDIVIDER
mov eax,hht.iItem
.if eax==0  ;first column
xor eax,eax
ret
.endif
.endif
jmp ToPass
.else
ToPass:
invoke CallWindowProc,EditOldProc,hWnd,uMsg,wParam,lParam
ret
.endif
xor eax,eax
ret
OnListViewHeader endp


Greets,

habran

And keep the distance from this forum :icon13:
Cod-Father