Comment detail

クリップボードへの転送 (Nested Flatten)

This comment is reply for 6681 ocean: 私が使ってるライブラリそのものですが。私...(クリップボードへの転送). Go to thread root.

ちょっと簡略化。

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
--- clipboard.py    Mon Feb 11 19:47:02 2008
+++ clipboard.py    Mon Jul  7 02:51:50 2008
@@ -37,9 +37,7 @@
         raise WindowsError("GlobalAlloc() failed")
     try:
         with _GlobalLock(h) as p:
-            p = (ctypes.c_char * (len(s) + 1)).from_address(p)
-            for i, c in enumerate(s + "\0"):
-                p[i] = c
+            (ctypes.c_char * (len(s) + 1)).from_address(p).value = s
         # clipboard
         with _Clipboard():
             user32.EmptyClipboard()

Index

Feed

Other

Link

Pathtraq

loading...