Author Topic: Listview header  (Read 3336 times)

ragdog

  • Member
  • ****
  • Posts: 610
Listview header
« on: January 03, 2015, 03:58:40 AM »
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.

Code: [Select]
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

  • Member
  • ****
  • Posts: 610
Re: Listview header
« Reply #1 on: January 03, 2015, 07:58:29 AM »
Solved with Subclass

Code: [Select]
invoke SendMessage,hLvs_Result,LVM_GETHEADER,0,0
mov hHeader,eax
invoke SetWindowLong,hHeader,GWL_WNDPROC,offset OnListViewHeader

Code: [Select]
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

  • Member
  • *****
  • Posts: 1226
    • uasm
Re: Listview header
« Reply #2 on: January 20, 2015, 06:23:54 PM »
And keep the distance from this forum :icon13:
Cod-Father