Unit Unit1; Interface uses Windows, Messages, sysutils, variants, Classes, Graphics, Controls, Forms, Dialogs, Stdctrls, comctr
Ls,commctrl;
Type phd_notify=^hd_notify;
TForm1 = Class (Tform) Listview1:tlistview;
Button1:tbutton;
Procedure Formdestroy (Sender:tobject);
Procedure Button1Click (Sender:tobject);
Private {private declarations} Oldproc:twndmethod;
Procedure Newproc (var message:tmessage);
Public {public declarations} end;
var Form1:tform1;
Implementation {$R *.DFM} procedure Tform1.newproc (Var message:tmessage);
var hn:phd_notify; Begin IF message.
Msg=wm_notify then BEGIN Hn:=phd_notify (Message.lparam); if (hn^. Hdr.code=hdn_begintracka) or (HN^.HDR.CODE=HDN_BEGINTRACKW) THEN BEGIN//Message.result: = 1;
Join this line so that the column header can not change the width//If you want to handle after the drag is done, you can determine whether hn->hdr.code//equals Hdn_endtracka or HDN_ENDTRACKW, and then do the processing.
ShowMessage (' hehe ');
End Else Listview1.dispatch (message); End
End
Procedure Tform1.formdestroy (Sender:tobject);
Begin Listview1.windowproc:=oldproc;
End
Procedure Tform1.button1click (Sender:tobject);
Begin oldproc:= Listview1.windowproc;
Listview1.windowproc:= Newproc;
End End.