procedure TForm1.ApplicationEvents1Message(var Msg: tagMSG; var Handled: Boolean); var Rotation: ShortInt; begin if Msg.message = WM_MOUSEWHEEL then begin Rotation := HIWORD( Msg.wParam ); if Rotation > 0 then Inc( Num ) else Dec( Num ); SetLabelCaption( Num ); Handled := True; end; end; Delphi(Pascal) code:
procedure TForm1.FormCreate(Sender: TObject); begin Application.OnMessage := ApplicationEvents1Message; end;