clipboard icon indicating copy to clipboard operation
clipboard copied to clipboard

no clipboard text while in Windows service

Open Fndroid opened this issue 5 years ago • 4 comments

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.

Fndroid avatar Jul 10 '19 13:07 Fndroid

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

Bios-Marcel avatar Oct 27 '19 22:10 Bios-Marcel

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

marcio199226 avatar Oct 31 '19 17:10 marcio199226

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.

HACKERALERT avatar May 06 '22 03:05 HACKERALERT

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

jinmao88 avatar Aug 08 '22 05:08 jinmao88