截获消息wm_vscoll 下移以行的时候上移的时候 movenext
在 moveperivous 是吧这么简单
在 moveperivous 是吧这么简单
解决方案 »
- C++调用Delphi dll中文乱码问题
- delphi中调用ACCESS的UPDATE语句时出错,有谁遇到过这种情况啊?急!!!
- "symbol 'faarchive' is specific to a platform"这是为什么呢?
- 有关语音引擎的问题!还望各位大侠救我于痛苦之中!
- 是高手就来吧
- 高分解决小问题(200)
- 急!急!保存的*.dfm文件中的汉字都变成16进制表示,在另一台机器中无法打开!为什么会这样呢?
- 我怎么运行程序,一下出来2个窗口,登陆和主窗体都出来了,为什么啊?
- 下载delphi informant 杂志1995至2000年全部内容光盘,请进。该杂志内容极有价值。
- 请问windows nt的屏幕锁定及解锁API是什么,怎么使用?
- 怎样在DrawGrid的Cells里面画个checkbox!!!
- 能否采用hook实时获得用户在我的电脑或资源管理器中选取的文件及路径?
type
{$IFDEF WIN32}
WParameter = LongInt;
{$ELSE}
WParameter = Word;
{$ENDIF}
LParameter = LongInt; {Declare a variable to hold the window procedure we are replacing}
var
OldWindowProc : Pointer; function NewWindowProc(WindowHandle : hWnd;
TheMessage : WParameter;
ParamW : WParameter;
ParamL : LParameter) : LongInt
{$IFDEF WIN32} stdcall; {$ELSE} ; export; {$ENDIF}
var
TheRangeMin : integer;
TheRangeMax : integer;
TheRange : integer;
begin if TheMessage = WM_VSCROLL then begin
{Get the min and max range of the horizontal scroll box}
GetScrollRange(WindowHandle,
SB_HORZ,
TheRangeMin,
TheRangeMax);
{Get the vertical scroll box position}
TheRange := GetScrollPos(WindowHandle,
SB_VERT);
{Make sure we wont exceed the range}
if TheRange < TheRangeMin then
TheRange := TheRangeMin else
if TheRange > TheRangeMax then
TheRange := TheRangeMax;
{Set the horizontal scroll bar}
SetScrollPos(WindowHandle,
SB_HORZ,
TheRange,
true);
end; if TheMessage = WM_HSCROLL then begin
{Get the min and max range of the horizontal scroll box}
GetScrollRange(WindowHandle,
SB_VERT,
TheRangeMin,
TheRangeMax);
{Get the horizontal scroll box position}
TheRange := GetScrollPos(WindowHandle,
SB_HORZ);
{Make sure we wont exceed the range}
if TheRange < TheRangeMin then
TheRange := TheRangeMin else
if TheRange > TheRangeMax then
TheRange := TheRangeMax;
{Set the vertical scroll bar}
SetScrollPos(WindowHandle,
SB_VERT,
TheRange,
true);
end; { Call the old Window procedure to }
{ allow processing of the message. }
NewWindowProc := CallWindowProc(OldWindowProc,
WindowHandle,
TheMessage,
ParamW,
ParamL);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
{ Set the new window procedure for the control }
{ and remember the old window procedure. }
OldWindowProc := Pointer(SetWindowLong(ScrollBox1.Handle,
GWL_WNDPROC,
LongInt(@NewWindowProc)));
end; procedure TForm1.FormDestroy(Sender: TObject);
begin
{ Set the window procedure back }
{ to the old window procedure. }
SetWindowLong(ScrollBox1.Handle,
GWL_WNDPROC,
LongInt(OldWindowProc)); end;
unit Unit1;interfaceuses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;type
TForm1 = class(TForm)
ListBox1: TListBox;
procedure FormCreate(Sender: TObject);
private { Private declarations }
public
{ Public declarations }
end; Tmylistbox = class(Tlistbox)
privateprotected
procedure wndproc(var message:Tmessage);override;
public
{ Public declarations }
published
{ Published declarations }
end;
var
Form1: TForm1;implementation{$R *.DFM}procedure TForm1.FormCreate(Sender: TObject);
var
a:Tmylistbox;
i:integer;begin
a:=Tmylistbox.Create (self);
a.parent:=form1;
a.Visible :=true;
for i :=0 to 20 do
a.Items.Add (inttostr(i));end;{ Tmylistbox }procedure Tmylistbox.wndproc(var message: Tmessage);
begin
if message.msg=WM_VSCroll then
begin
if message.WParam= SB_LINEDOWN then
showmessage('ok'); exit;
end; inherited wndproc(message);end;end.