Jump to content

Recommended Posts

Posted

Hello

i have this code that monitors the clipboard but it needs an GUI ...

$gui = GUICreate("Clip Hook",400,400,-1,-1)

$calldata= DLLCall("user32.dll","int","AddClipboardFormatListener","hwnd", $hHandle)

GUIRegisterMsg(0x031D,"OnClipBoardChange")


i am trying to monitor the clipboard without creating a GUI, However i am facing issues with DllCallbackRegister to replace (GUIRegisterMsg)

 

this is what i tried , but ti is not working... 

; Create callback function.
Local $hHandle = DllCallbackRegister("_EnumWindowsProc", "int", "hwnd;lparam")

; Call dll.
DllCall("user32.dll", "int", "AddClipboardFormatListener", "ptr", $hHandle)


While 1
   sleep(100)
WEnd

; Callback Procedure
Func _EnumWindowsProc($hWnd, $lParam)
    ConsoleWrite(ClipGet()))
EndFunc

 

what i am doing wrong ? 

AutoFox, A Modern, Simple, No dependency, Noob friendly yet powerful Firefox UDF !

  • Solution
Posted (edited)

You need to provide a window handle.  No big deal.  Some messages were designed by Windows to use only a window handle.  This is the case.

But I suppose your first code does not work also.  $hHandle is unassigned.

Edited by Nine
Posted

There's a good example in the help-file for the function _WinAPI_AddClipboardFormatListener. Though you have to create a GUI, you don't have to show it, remove or comment the GUISetState line.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...