Einzelnen Beitrag anzeigen

Tubos

Registriert seit: 25. Feb 2004
Ort: Yspertal (Niederösterreich)
1.014 Beiträge
 
Delphi 7 Personal
 
#2

Re: Set/Get-Capture / ReleaseCapture

  Alt 12. Jun 2004, 16:03
Ich weiß nicht wo du geschaut hast, aber vielleicht hilft dir dieser Ausschnitt aus der Visual C++ - Hilfe weiter.
Ich hoffe, die C++-Syntay macht dir nichts aus.

SetCapture
The SetCapture function sets the mouse capture to the specified window belonging to the current thread. Once a window has captured the mouse, all mouse input is directed to that window, regardless of whether the cursor is within the borders of that window. Only one window at a time can capture the mouse.

If the mouse cursor is over a window created by another thread, the system will direct mouse input to the specified window only if a mouse button is down.

HWND SetCapture(
HWND hWnd // handle of window to receive mouse capture
);

Parameters
hWnd
Handle to the window in the current thread that is to capture the mouse.
Return Values
The return value is the handle of the window that had previously captured the mouse. If there is no such window, the return value is NULL.

Remarks
Only the foreground window can capture the mouse. When a background window attempts to do so, the window receives messages only for mouse events that occur when the cursor hot spot is within the visible portion of the window. Also, even if the foreground window has captured the mouse, the user can still click another window, bringing it to the foreground.

When the window no longer requires all mouse input, the thread that created the window should call the ReleaseCapture function to release the mouse.

This function cannot be used to capture mouse input meant for another process.

Windows 95: Calling SetCapture causes the window that is losing the mouse capture to receive a WM_CAPTURECHANGED message.


GetCapture
The GetCapture function retrieves the handle of the window (if any) that has captured the mouse. Only one window at a time can capture the mouse; this window receives mouse input whether or not the cursor is within its borders.

HWND GetCapture(VOID)

Parameters
This function has no parameters.

Return Values
The return value is the handle of the capture window associated with the current thread. If no window in the thread has captured the mouse, the return value is NULL.

Remarks
A NULL return value does not mean no other thread or process in the system has captured the mouse; it just means the current thread has not captured the mouse.


ReleaseCapture
The ReleaseCapture function releases the mouse capture from a window in the current thread and restores normal mouse input processing. A window that has captured the mouse receives all mouse input, regardless of the position of the cursor, except when a mouse button is clicked while the cursor hot spot is in the window of another thread.

BOOL ReleaseCapture(VOID)

Parameters
This function has no parameters.

Return Values
If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To get extended error information, callGetLastError.

Remarks
An application calls this function after calling the SetCapture function.

Windows 95: Calling ReleaseCapture causes the window that is losing the mouse capture to receive a WM_CAPTURECHANGED message.


================================================== =========================
Ich bin aus Zufall beim C-Programmieren mal auf die Funktionen gestoßen und habe die Beschreibungen eigentlich recht gut verstanden.
Vielleicht hilft dir das ja auch weiter.

Grüße
Tubos
Lukas
  Mit Zitat antworten Zitat