message processing dialogbox

message processing dialogbox

Hi,
I need some help for processing Windows messages.
I have a Dialogproc function for processing all the messages that are generated for my dialogbox. In the dialogbox I have a listview control. I increase the column width by mouse drag operation. At the end of the drag a HDN_ENDTRACK message is generated by the header to indicate end of drag. I use sendmessage(WM_PAINT).And paint I check the value to which the column width has been modified.If this value exceeds the maximum allowable value(say 30), I sendmessage to my listview to alter the column width to the maximum allowable value.
Somehow the width of the column gets altered to the final drag position instead of this value that I set. I understand that it does alterb the column width to the value I set, but subsequently something alters the column width. Is there any particular order in which the messages have to be processed?
______________________________________________________
integer*4 function listview_proc(hDlg, wMsg, wParam, lParam)
!DEC$ IF DEFINED(_X86_)
!DEC$ ATTRIBUTES STDCALL, ALIAS : '_listview_proc@16' :: listview_proc
!DEC$ ELSE
!DEC$ ATTRIBUTES STDCALL, ALIAS : 'listview_proc' :: listview_proc
!DEC$ ENDIF
use dflogm
use dfwin
...
select case (wMsg)
case (WM_INITDIALOG)
...
case (WM_NOTIFY)
...
pnmhdr=lparam
if(hdr_struct%code .eq. HDN_ENDTRACK)then
plistview=lparam
drag_flag=.true.
column_drag=listview_struct%iitem
dummyi = SendMessage (hdlg,WM_PAINT,0,0)
endif
listview_proc=1
return

case(WM_PAINT)
ret = BeginPaint(hdlg, ps)
if(drag_flag)then
col_wd = SendMessage (ghwndlist, LVM_GETCOLUMNWIDTH,
column_drag, 0)
col_wd = min(30,col_wd)
dummyi = SendMessage (ghwndlist, LVM_SETCOLUMNWIDTH,
column_drag,col_wd)
!*******************************************************
!I find that this function succeeds,but subsequently
!something causes the column width to be altered again.
!********************************************************
drag_flag=.false.
endif
ret = EndPaint(hdlg, ps)
listview_proc=1
return
...
...
end select
listview_proc =0 ! Didn't process the message
return
end
_________________________________________________________

1 post / 0 new
For more complete information about compiler optimizations, see our Optimization Notice.