函数参考


_WinAPI_AddClipboardFormatListener

Places the given window in the system-maintained clipboard format listener list.

#Include <WinAPIEx.au3>
_WinAPI_AddClipboardFormatListener ( $hWnd )

参数

$hWnd Handle to the window to be placed.

返回值

成功: 返回 1.
失败: 返回 0 并设置 @error 标志为非 0 值.

注意/说明

本函数需要 Windows Vista 或更高版本系统.

相关

详情参考

在MSDN中搜索


示例/演示


#Include <APIConstants.au3>
#Include <Clipboard.au3>
#Include <EditConstants.au3>
#Include <WinAPIEx.au3>

Opt('MustDeclareVars', 1)

If _WinAPI_GetVersion() < '6.0' Then
    MsgBox(16, 'Error', 'Require Windows Vista or later.')
    Exit
EndIf

Global $hForm, $Msg, $Edit

$hForm = GUICreate('MyGUI', 400, 400, 10, 10, BitOR($GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX, $WS_SIZEBOX), $WS_EX_TOPMOST)
$Edit = GUICtrlCreateEdit('', 0, 0, 400, 400, BitOR($GUI_SS_DEFAULT_EDIT, $ES_READONLY))
GUIRegisterMsg($WM_CLIPBOARDUPDATE, 'WM_CLIPBOARDUPDATE')
GUISetState()

_WinAPI_AddClipboardFormatListener($hForm)
_SendMessage($hForm, $WM_CLIPBOARDUPDATE)

Do
Until GUIGetMsg() = -3

Func WM_CLIPBOARDUPDATE($hWnd, $Msg, $wParam, $lParam)
    _ClipBoard_Open(0)
    GUICtrlSetData($Edit, _ClipBoard_GetData($CF_TEXT))
    _ClipBoard_Close()
    Return 0
EndFunc   ;==>WM_CLIPBOARDUPDATE