| Autor |
Beitrag |
Ikarus7
      
Beiträge: 36
|
Verfasst: Di 09.03.04 23:19
wie kann ich Erkennen ob nach oben oder nach unten gescrolt wurde, und zwar global ?
(ähnlich wie das erkennen ob ALT gedrückt ist)
gruß ika
|
|
CenBells
      
Beiträge: 1547
Win 7
Delphi XE5 Pro
|
Verfasst: Di 09.03.04 23:33
Hallo,
ich glaube da gehst du von falschen voraussetzungen aus.
Eine gedrückte Alt-Taste löst (zumindest bei PS2-Tastaturen) einen Interrupt aus.
Das ist also ne hardware mäßige Sache.
Nen Scrollvorgang wird man kaum in hardware umgesetzt finden. Das einzige, was du vielleicht (!!!) machen kannst, ist eine Hook-DLL zu programmieren, und die in die MessageQueue zu hängen. Und wenn nun eine Message eines Scroll vorgangs kommt, dann musst du dein programm benachrichtigen.
Gruß
Ken
_________________ Eine Klasse beschreibt die Struktur und das Verhalten einer Menge gleichartiger Objekte.
|
|
Ikarus7 
      
Beiträge: 36
|
Verfasst: Mi 10.03.04 19:20
wieso wird man einen scrollvorgang kaum in hardware umgesetz sehen ???
ich hoffe du weists daß ich von der bewegung des scrollrades ausgehe ..........
|
|
MaxiTB
      
Beiträge: 679
Win2000, WinXp, Workbench ;-)
D7 Ent, VS2003 Arch.
|
Verfasst: Mi 10.03.04 19:45
::ikarus
Du solltest erstmal dazusagen, daß du das mouse scroll wheel meinst.
Weiters solltest du dazusagen, was du genau wann wie und wo erkennen willst.
Ich hab gerade meinen Vorang gescrollt - denke mal, daß interssiert dich aber nicht  .
Hier ein paar Hints zum Thema mouse wheel messages:
| Zitat: | WM_MOUSEWHEEL
The WM_MOUSEWHEEL message is sent to the focus window when the mouse wheel is rotated. The DefWindowProc function propagates the message to the window's parent. There should be no internal forwarding of the message, since DefWindowProc propagates it up the parent chain until it finds a window that processes it.
A window receives this message through its WindowProc function.
LRESULT CALLBACK WindowProc(
HWND hwnd, // handle to window
UINT uMsg, // WM_MOUSEWHEEL
WPARAM wParam, // key indicator and wheel rotation
LPARAM lParam // horizontal and vertical position
);
Parameters
wParam
The low-order word indicates whether various virtual keys are down. This parameter can be one or more of the following values. Value Description
MK_CONTROL The CTRL key is down.
MK_LBUTTON The left mouse button is down.
MK_MBUTTON The middle mouse button is down.
MK_RBUTTON The right mouse button is down.
MK_SHIFT The SHIFT key is down.
MK_XBUTTON1 Windows 2000/XP: The first X button is down.
MK_XBUTTON2 Windows 2000/XP: The second X button is down.
The high-order word indicates the distance the wheel is rotated, expressed in multiples or divisions of WHEEL_DELTA, which is 120. A positive value indicates that the wheel was rotated forward, away from the user; a negative value indicates that the wheel was rotated backward, toward the user.
lParam
The low-order word specifies the x-coordinate of the pointer, relative to the upper-left corner of the screen.
The high-order word specifies the y-coordinate of the pointer, relative to the upper-left corner of the screen.
Return Values
If an application processes this message, it should return zero.
Remarks
Use the following code to crack the wParam parameter:
fwKeys = GET_KEYSTATE_WPARAM(wParam);
zDelta = GET_WHEEL_DELTA_WPARAM(wParam);
Use the following code to obtain the horizontal and vertical position:
xPos = GET_X_LPARAM(lParam);
yPos = GET_Y_LPARAM(lParam);
You can also use the MAKEPOINTS macro to convert the lParam parameter to a POINTS structure.
The wheel rotation will be a multiple of WHEEL_DELTA, which is set at 120. This is the threshold for action to be taken, and one such action (for example, scrolling one increment) should occur for each delta.
The delta was set to 120 to allow Microsoft or other vendors to build finer-resolution wheels in the future, including perhaps a freely-rotating wheel with no notches. The expectation is that such a device would send more messages per rotation, but with a smaller value in each message. To support this possibility, you should either add the incoming delta values until WHEEL_DELTA is reached (so for a delta-rotation you get the same response), or scroll partial lines in response to the more frequent messages. You could also choose your scroll granularity and accumulate deltas until it is reached.
Windows 95, Windows NT 3.51: Support for the mouse wheel is provided through a separately-running module, MSWheel, that generates a MSH_MOUSEWHEEL message. The MSWheel module, which consists of MSWheel.exe and MSWheel.dll, is installed with the IntelliPoint software that is shipped with the IntelliMouse® pointing device. In addition, MSH_MOUSEWHEEL is defined in the header file (ZMouse.h) that an application must use to implement support for the wheel via the MSWheel module.
MSH_MOUSEWHEEL
zDelta = (int) wParam; // wheel rotation
xPos = LOWORD(lParam); // horizontal position of pointer
yPos = HIWORD(lParam); // vertical position of pointer
Note, there is no fwKeys for MSH_MOUSEWHEEL. Otherwise, the parameters are exactly the same as for WM_MOUSEWHEEL.
It is up to the application to forward MSH_MOUSEWHEEL to any embedded objects or controls. The application is required to send the message to an active embedded OLE application. It is optional that the application sends it to a wheel-enabled control with focus. If the application does send the message to a control, it can check the return value to see if the message was processed. Controls are required to return a value of TRUE if they process the message.
Requirements
Windows NT/2000/XP: Included in Windows NT 4.0 and later.
Windows 95/98/Me: Included in Windows 98 and later.
Header: Declared in Winuser.h; include Windows.h. |
_________________ Euer Mäxchen
Wer früher stirbt, ist länger tot.
|
|
Ikarus7 
      
Beiträge: 36
|
Verfasst: Mi 10.03.04 22:24
danke maxi.
ich bin leider kein profi, kann man das erfassen der mousewheel-bewegung vielleicht etwas laienhafter erklären ?
wäre nett,
gruß Ika
|
|
CenBells
      
Beiträge: 1547
Win 7
Delphi XE5 Pro
|
Verfasst: Mi 10.03.04 23:30
| Ikarus7 hat folgendes geschrieben: | wieso wird man einen scrollvorgang kaum in hardware umgesetz sehen ???
ich hoffe du weists daß ich von der bewegung des scrollrades ausgehe .......... |
Hi,
das mit dem Mausrad hättest du auch schreiben müssen. Daran hab ich nicht gedacht, ich dachte, du meinst den klick auf einen der Pfeile einer Scrollbar (gibt schließlich noch mäuse ohne rad  ). Der wäre nicht über die Hardware gekommen ... ok, ich habe mich da auch unverständlich ausgedrückt.
Laienhafter ist so eine sache. Du musst eine Message-Hook-Dll schreiben, die sich in den windows message queue hängt und auf die Nachricht WM_Mouswheel wartet. Alle anderen nachrichten werden normal durchgereicht und die nachricht kann von dir gesondert bearbeitet werden und sollte dann auch an das system durchgereicht werden.
Der Rest steht da im Detail drin.
Gruß
Ken
_________________ Eine Klasse beschreibt die Struktur und das Verhalten einer Menge gleichartiger Objekte.
|
|
Ikarus7 
      
Beiträge: 36
|
Verfasst: Do 11.03.04 17:29
das verstehe ich nicht, warum muss ich eine hook schreiben wenn es für alle anderen tasten eine andere möglichkeit gibt ??
|
|
CenBells
      
Beiträge: 1547
Win 7
Delphi XE5 Pro
|
Verfasst: Do 11.03.04 17:49
hmm,
weil du nur tasten abfragen kannst, wenn dein programm aktiv ist.
Und du hast geschrieben, daß du global alle scrollaktionen abfangen willst. Oder meinst du mit global, daß du in deinem programm an zentraler stelle alle scrollaktionen abfangen willst?
Gruß
Ken
_________________ Eine Klasse beschreibt die Struktur und das Verhalten einer Menge gleichartiger Objekte.
|
|
|