本文整理自网络,侵删。
object Form1: TForm1Left = 0Top = 0Caption = 'Form1'ClientHeight = 772ClientWidth = 635Color = clBtnFaceFont.Charset = DEFAULT_CHARSETFont.Color = clWindowTextFont.Height = -11Font.Name = 'Tahoma'Font.Style = []OldCreateOrder = FalseOnCreate = FormCreateOnDestroy = FormDestroyPixelsPerInch = 96TextHeight = 13object lvErrMsgs: TListViewLeft = 0Top = 0Width = 635Height = 415Align = alTopBevelInner = bvNoneBevelOuter = bvNoneBorderWidth = 1Columns = <itemCaption = ' 'Width = 30enditemCaption = #26500#20214#21517#31216Width = 75enditemCaption = #25152#23646#27004#23618Width = 75enditemCaption = #38169#35823#25551#36848Width = 500end>ColumnClick = FalseDragCursor = crAppStartFlatScrollBars = TrueGridLines = TrueHideSelection = FalseItems.ItemData = {05450000000100000000000000FFFFFFFFFFFFFFFF03000000FFFFFFFF000000000003310031003100F85CC32603320032003200A85BC326057A007800630076006200B059C326FFFFFFFFFFFF}ReadOnly = TrueRowSelect = TrueShowWorkAreas = TrueTabOrder = 0ViewStyle = vsReportExplicitTop = -115ExplicitWidth = 524endend
unit Unit1;
interface
uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ComCtrls;
type TForm1 = class(TForm) lvErrMsgs: TListView; procedure FormCreate(Sender: TObject); procedure FormDestroy(Sender: TObject); private FListViewOldWndProc: TWndMethod; procedure ListViewNewWndProc(var Msg: TMessage); { Private declarations } public { Public declarations } end;
var Form1: TForm1;
implementationusesCommCtrl;
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);begin FListViewOldWndProc := lvErrMsgs.WindowProc; lvErrMsgs.WindowProc := ListViewNewWndProc;end;
procedure TForm1.FormDestroy(Sender: TObject);begin lvErrMsgs.WindowProc := FlistViewOldWndProc; FListViewOldWndProc := nil;end;
procedure TForm1.ListViewNewWndProc(var Msg: TMessage);varhdn: ^THDNotify;beginif Msg.Msg = WM_NOTIFY thenbeginhdn := Pointer(Msg.lParam);if (hdn.hdr.code = HDN_BeginTrackW) or (hdn.hdr.code = HDN_BeginTrackA) thenMsg.Result := 1elseFListViewOldWndProc(Msg);end elseFListViewOldWndProc(Msg);end;
end.
相关阅读 >>
Delphi 判断时间是否合法 -isvaliddatetime、isvaliddate、isvalidtime、isvaliddateday
更多相关阅读请进入《Delphi》频道 >>