procedure TForm1.FormCreate(Sender: TObject);
begin
Application.OnMessage:= AnyMessage;
end;
procedure TForm1.AnyMessage(var Msg: TMsg; var Handled: Boolean);
begin
if Msg.Message = WM_MouseWheel then
if ActiveControl is TDBgrid then
begin
if Msg.wParam > 0 then
begin
keybd_event(VK_UP, VK_UP, 0, 0);
keybd_event(VK_UP, VK_UP, KEYEVENTF_KEYUP, 0);
end
else if Msg.wParam < 0 then
begin
keybd_event(VK_DOWN, VK_DOWN, 0, 0);
keybd_event(VK_DOWN, VK_DOWN, KEYEVENTF_KEYUP, 0);
end;
end;
end;
그런데 검색해도 안나오네요...
아래의 소스를 참조하세요...
procedure TForm1.FormCreate(Sender: TObject);
begin
Application.OnMessage:= AnyMessage;
end;
procedure TForm1.AnyMessage(var Msg: TMsg; var Handled: Boolean);
begin
if Msg.Message = WM_MouseWheel then
if ActiveControl is TDBgrid then
begin
if Msg.wParam > 0 then
begin
keybd_event(VK_UP, VK_UP, 0, 0);
keybd_event(VK_UP, VK_UP, KEYEVENTF_KEYUP, 0);
end
else if Msg.wParam < 0 then
begin
keybd_event(VK_DOWN, VK_DOWN, 0, 0);
keybd_event(VK_DOWN, VK_DOWN, KEYEVENTF_KEYUP, 0);
end;
end;
end;