Skip to content
This repository has been archived by the owner on May 4, 2018. It is now read-only.

Commit

Permalink
clipboard: use ASCII text type (1) on Windows.
Browse files Browse the repository at this point in the history
  • Loading branch information
StefanKarpinski committed Sep 9, 2013
1 parent bb150d8 commit 96bf9e2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions base/util.jl
Original file line number Diff line number Diff line change
Expand Up @@ -247,16 +247,16 @@ end
p = ccall((:GlobalLock, "kernel32"), stdcall, Ptr{Void}, (Ptr{Void},), p)
# write data to locked, allocated space
ccall(:memcpy, Ptr{Void}, (Ptr{Void},Ptr{Uint8},Int32), p, x, length(x)+1)
ccall( (:GlobalUnlock, "kernel32"), stdcall, Void, (Ptr{Void},), p)
ccall((:GlobalUnlock, "kernel32"), stdcall, Void, (Ptr{Void},), p)
# set clipboard data type to 13 for Unicode text/string
p = ccall((:SetClipboardData, "user32"), stdcall, Ptr{Void}, (Uint32, Ptr{Void}), 13, p)
p = ccall((:SetClipboardData, "user32"), stdcall, Ptr{Void}, (Uint32, Ptr{Void}), 1, p)
ccall((:CloseClipboard, "user32"), stdcall, Void, ())
end
clipboard(x) = clipboard(sprint(io->print(io,x))::ByteString)

function clipboard()
ccall((:OpenClipboard, "user32"), stdcall, Bool, (Ptr{Void},), C_NULL)
s = bytestring(ccall( (:GetClipboardData, "user32"), stdcall, Ptr{Uint8}, (Uint32,), 1))
s = bytestring(ccall((:GetClipboardData, "user32"), stdcall, Ptr{Uint8}, (Uint32,), 1))
ccall((:CloseClipboard, "user32"), stdcall, Void, ())
return s
end
Expand Down

0 comments on commit 96bf9e2

Please sign in to comment.