atotto / clipboard

clipboard for golang
BSD 3-Clause "New" or "Revised" License
1.21k stars 140 forks source link

no clipboard text while in Windows service #43

Open Fndroid opened 5 years ago

Fndroid commented 5 years ago

The logic of my progrom is read texts from the clipboard and send them to my server

And clipboard.ReadAll() works fine when I run the .exe in CMD

But when I tried to run it as a service, clipboard.ReadAll() returns an error like: The operation completed successfully

Are there any solutions for this? Thank you.

Bios-Marcel commented 4 years ago

+1 I got this too, but not in a windows-service. It was a terminal application: https://github.com/Bios-Marcel/cordless

marcio199226 commented 4 years ago

I have the same issue...anybody know how to fix it?

HACKERALERT commented 2 years ago

I found a fix. Around line 82 in clipboard_windows.go, there is:

if r == 0 {
    _, _, _ = closeClipboard.Call()
    return "", err
}

Just comment out that block and everything works :). It seems like an unnecessary check, since I'm using GLFW for one of my projects and it explicitly says to leave the memory management to GLFW, not do it manually.

jinmao88 commented 2 years ago

I found a fix. Around line 82 in clipboard_windows.go, there is:

if r == 0 {
    _, _, _ = closeClipboard.Call()
    return "", err
}

Just comment out that block and everything works :). It seems like an unnecessary check, since I'm using GLFW for one of my projects and it explicitly says to leave the memory management to GLFW, not do it manually.

its not work