Function Reference


_ClipBoard_GetOpenWindow

Retrieves the handle to the window that currently has the clipboard open

#include <Clipboard.au3>
_ClipBoard_GetOpenWindow ( )

Return Value

Success: The handle to the window that has the clipboard open
Failure: 0 if no window has the clipboard open

Remarks

If an application or DLL specifies a NULL window handle when calling the _ClipBoard_Open() function, the clipboard is opened but is not associated with a window. In such a case, _ClipBoard_GetOpenWindow() returns 0.

Related

_ClipBoard_GetOwner, _ClipBoard_Open

See Also

Search GetOpenClipboardWindow in MSDN Library.

Example

#include <Clipboard.au3>
#include <GUIConstantsEx.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>

Global $g_idMemo

Example()

Func Example()
    Local $hGUI

    ; Create GUI
    $hGUI = GUICreate("Clipboard", 600, 400)
    $g_idMemo = GUICtrlCreateEdit("", 2, 2, 596, 396, $WS_VSCROLL)
    GUICtrlSetFont($g_idMemo, 9, 400, 0, "Courier New")
    GUISetState(@SW_SHOW)

    ; Open the clipboard
    If _ClipBoard_Open($hGUI) Then

        ShowData($hGUI)

        ; Close the clipboard
        _ClipBoard_Close()
    Else
        _WinAPI_ShowError("_ClipBoard_Open failed")
    EndIf

    ; Loop until the user exits.
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc   ;==>Example

; Show clipboard statistics
Func ShowData($hGUI)
    MemoWrite("GUI handle ............: " & $hGUI)
    MemoWrite("Clipboard owner .......: " & _ClipBoard_GetOwner())
    MemoWrite("Clipboard open window .: " & _ClipBoard_GetOpenWindow())
    MemoWrite("Clipboard sequence ....: " & _ClipBoard_GetSequenceNumber())
    MemoWrite()
EndFunc   ;==>ShowData

; Write message to memo
Func MemoWrite($sMessage = "")
    GUICtrlSetData($g_idMemo, $sMessage & @CRLF, 1)
EndFunc   ;==>MemoWrite