i just coded up a simple listview to test for some wm_notify messages that are being sent. the problem
is that i can detect some messages but unfortunately i cant detect the 2 messages im most interested in
which is HDN_BEGINTRACK and HDN_TRACK. im able to detect the HDN_DIVIDERDBLCLICK, and HDN_ENDTRACK
but i dont understand why im having problems with the others. here is a simple listview i coded to test for the
messages. if the message was found a messagebox pops up:
## these messages are header messages that are being tested for ##
.386
.model flat, stdcall
option casemap :none
WinMain PROTO :DWORD, :DWORD, :DWORD, :DWORD
TopXY PROTO :DWORD, :DWORD
Paint_Proc PROTO :DWORD, :DWORD
NewWindow PROTO :DWORD,:DWORD,:DWORD,:DWORD
MoveMemory PROTO
include \masm32\include\windows.inc
include \masm32\include\user32.inc
include \masm32\include\kernel32.inc
include \masm32\include\shell32.inc
includelib \masm32\lib\user32.lib
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\shell32.lib
InsertColumn MACRO handle,txt,width
LOCAL lbl
LOCAL strng
jmp lbl
strng db txt,0
lbl:
mov col.imask,LVCF_TEXT or LVCF_WIDTH
mov col.fmt,0
mov col.lx,width
mov col.pszText,offset strng
invoke lstrlen,offset strng
mov col.cchTextMax,eax
invoke SendMessage,handle,LVM_INSERTCOLUMN,0,addr col
ENDM
.const
ListViewID equ 1001
.data
ClassName db "SimpleWindowClass",0
ListViewClassName db "sysListview32",0
EditClassName db "Edit",0
WindowName db "Ad Smasher",0
fMtStrinG db "%1u",0
.data?
hInstance HWND ?
hWnd HWND ?
hListView HWND ?
col LVCOLUMN <>
XXX NMHEADER <>
ZZZ NMHDR <>
hEdit HANDLE ?
buffer db 512 dup(?)
TotalItems dd ?
.code
start:
invoke GetModuleHandle, NULL
mov hInstance, eax
invoke WinMain,hInstance,NULL,NULL,SW_SHOWDEFAULT
invoke ExitProcess,eax
WinMain proc hInst:DWORD, hPrevInst:DWORD, CmdLine:DWORD, CmdShow:DWORD
LOCAL wc :WNDCLASSEX
LOCAL msg :MSG
LOCAL Wwd :DWORD
LOCAL Wht :DWORD
LOCAL Wtx :DWORD
LOCAL Wty :DWORD
invoke LoadIcon,hInst,IDI_APPLICATION
mov wc.hIcon, eax
mov wc.hIconSm, eax
mov wc.cbSize, sizeof WNDCLASSEX
mov wc.style, CS_HREDRAW + CS_VREDRAW + CS_BYTEALIGNWINDOW
mov wc.lpfnWndProc, offset WndProc
mov wc.cbClsExtra, NULL
mov wc.cbWndExtra, NULL
push hInst
pop wc.hInstance
mov wc.hbrBackground, COLOR_BTNFACE+1
mov wc.lpszMenuName, NULL
mov wc.lpszClassName, offset ClassName
invoke LoadCursor,NULL,IDC_ARROW
mov wc.hCursor, eax
invoke RegisterClassEx, ADDR wc
;================================
; Centre window at following size
;================================
mov Wwd, 500
mov Wht, 350
invoke GetSystemMetrics,SM_CXSCREEN
invoke TopXY,Wwd,eax
mov Wtx, eax
invoke GetSystemMetrics,SM_CYSCREEN
invoke TopXY,Wht,eax
mov Wty, eax
invoke CreateWindowEx,WS_EX_LEFT,
ADDR ClassName,
ADDR WindowName,
WS_OVERLAPPEDWINDOW,
Wtx,Wty,Wwd,Wht,
NULL,
NULL,
hInst,
NULL
mov hWnd,eax
invoke LoadMenu,hInst,600
invoke SetMenu,hWnd,eax
invoke ShowWindow,hWnd,SW_SHOWNORMAL
invoke UpdateWindow,hWnd
.WHILE TRUE
INVOKE GetMessage, ADDR msg,NULL,0,0
.BREAK .IF (!eax)
INVOKE TranslateMessage, ADDR msg
INVOKE DispatchMessage, ADDR m
smurf,
I have same problem, but in different control.
You create listview with createwindowex and not as dialog.
I bypass it problem changing:
.if eax == HDN_DIVIDERDBLCLICK ;<-- this is where i put the different messages
invoke MessageBox,hWin,0,0,0
.endif
to something like this and it work OK.
WM_NOTIFY if somehow different from dialog then from window.
.if eax!=HDN_DIVIDERDBLCLICK && eax!=HDN_XXXXXXXXXXXX
ret ; No! go back
.endif
invoke MessageBox,hWin,0,0,0
It was Try and Fail system.
Just sharing my problem.
forgesmurf, sorry
I didn't read your problem.
I cant detect 2 messages im most interested in
which is HDN_BEGINTRACK and HDN_TRACK.
Well I detect HDN_TRACK just as is in code bellow:
.elseif uMsg == WM_NOTIFY
mov edi,lParam
assume edi:ptr NMHEADER
mov eax,.hdr.code
.if eax <=-300 && eax >=-328; <-- this is where i put the different messages
szText tb50,"New File"
szText wsprintFormat5,"HDN_message = %ld "
invoke wsprintf,ADDR buffer3,ADDR wsprintFormat5,.hdr.code
invoke MessageBox,hWin,ADDR buffer3,ADDR tb50,MB_OK
.endif
assume edi:nothing
;HDN_ITEMCHANGING equ -300
;HDN_ITEMCHANGED equ -301
;HDN_ITEMCLICK equ -302
;HDN_ITEMDBLCLICK equ -303
;HDN_DIVIDERDBLCLICK equ -305
;HDN_BEGINTRACK equ -306
;HDN_ENDTRACK equ -307
;HDN_TRACK equ -308
Hope this help.forge thanks for helping. i have a few more questions. your code is as such:
.elseif uMsg == WM_NOTIFY
mov edi,lParam
assume edi:ptr NMHEADER
mov eax,.hdr.code
.if eax <=-300 && eax >=-328; <-- this is where i put the different messages
szText tb50,"New File"
szText wsprintFormat5,"HDN_message = %ld "
invoke wsprintf,ADDR buffer3,ADDR wsprintFormat5,.hdr.code
invoke MessageBox,hWin,ADDR buffer3,ADDR tb50,MB_OK
.endif
assume edi:nothing
i dont understand what this line is all about:
.if eax <=-300 && eax >=-328
could you explain this to me? what im tring to accomplish from all this to setup my header so it cant be resized but i cant figure it out. in the msdn the HDN_TRACK returns a true or false to allow tracking. is there a way i can change it to true so the my header cant be resized?
thanks
smurfsmurf,
.if eax <=-300 && eax >=-328
This is simple:
It will pass through all messages
which are bigger than (-300 which equ HDN_ITEMCHANGING)
and smaller than (-328 which equ HDN_TRACKW)
It is just for debugging purpose.
forge
Smurf,
You declared your class "sysListview32" it should be "SysListView32"
I don't know if this make any difference ?
Now this is weird:
You insert four columns with this message using Umbongo's macro:
invoke SendMessage,handle,LVM_INSERTCOLUMN,0,addr col
This way you unintentionally created another window with the
Class Name of SysHeader32, than of course you can even get its handle.
It means you can even subclass it.
This window somehow inherited this
Class Styles = CS_GLOBALCLASS or CS_DBLCLKS
and this
Window Styles = WS_CHILDWINDOW or WS_VISIBLE or HDS_FULLDRAG \
or HDS_DRAGDROP or HDS_BUTTONS = 0x500000C2
and I don't know from where?
Is it really documented anywhere?
BTW: SysListView32 is your very Desktop.
CreateWindowEx - I found some tutorials or snippet for these predefined Classes
-------------------------------------------------------------------------------
msctls_progress32 - Iczelion tutorial #18
SysAnimate32 - TestDepartment - td_710
SysDateTimePick32 - old Iczelion Message Board
SysHeader32 - Ron 26/1/01
SysTreeView32 - Iczelion tutorial #19
tooltips_class32 - Igor Soumenkov
Shell_TrayWnd - Stefan
but not any for these.
-----------------------
msctls_hotkey32 - ?
msctls_statusbar32 - ?
msctls_trackbar32 - ?
msctls_updown32 - ?
ReBarWindow32 - ?
SysMonthCal32 - ?
SysPager - ?
TrayNotifyWnd - ?
TrayClockWClass - ?
Please correct me if I'm wrong.
forge