Jump to content

GetClipboardData Dll


Recommended Posts

I'm still trying Dll's in autoit.. This time the GetClipboardData function. I wrote a code an am wondering if its the ideal way to get clipboard data.. I hear that messing with pointers can cause programmes to malfunction. I know autoit has a more simplier way with the clipget() function but just trying to learn dll in autoit...

;//Open Clipboard for data reading
$clipboardopen = DllCall("User32.dll", "bool", "OpenClipboard", "HWND", Null)

If $clipboardopen[0] <> 0 Then

;//Get Clipboard data.. $clipbaordget returns a pointer
$clipboardget = DllCall("User32.dll", "handle", "GetClipboardData", "UINT", 1)

;//We create struct with pointer of $clipboardget
$struct = DllStructCreate("struct;char var1[128];endstruct", $clipboardget[0])

;//We get the data of the pointer with structgetdata
$results = DllStructGetData($struct, "var1")

MsgBox(64, "Struct Pointer", $results)


EndIf

 

Link to comment
Share on other sites

yes. But You need to get correct SIZE. Also check formats to corrent handle structure.

But Basically check for right size.

Local $iSize=DllCall("Kernel32.dll","ULONG_PTR","GlobalSize","handle",$clipboardget[0])[0]

of course handle error etc. (my code above is not safe)

Then check type for example if you use format for get unicode text you must use a dllstructure wchar to easy see uncode text etc...

 

Saludos

Edited by Danyfirex
Link to comment
Share on other sites

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

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