unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;type TForm1 = class(TForm) cbb1: TComboBox; procedure FormCreate(Sender: TObject); private { Private declarations } procedure comboboxWndProc(var msg : TMessage); public { Public declarations } end;var Form1: TForm1; cbbHandle:THandle; cbbProcPointer
ointer;implementation{$R *.dfm} procedure TForm1.comboboxWndProc(var msg: TMessage);begin//case Msg.Msg of WM_MOUSEWHEEL: begin //ShowMessage('禁止滚动'); Exit; end;end;msg.Result :=CallWindowProc(cbbProcPointer,cbbHandle,msg.Msg ,msg.WParam,msg.LParam );end;procedure TForm1.FormCreate(Sender: TObject);varp
ointer;begincbbHandle:=Self.cbb1.Handle;if cbbHandle>0 thenbegin cbbProcPointer:=Pointer(GetWindowLong(cbbHandle, GWL_WNDPROC) ); p:=Classes.MakeObjectInstance(comboboxWndProc); SetWindowLong(cbbHandle,GWL_WNDPROC,Integer(p));end; //ShowMessage(IntToStr(edtHandle));end;end.