Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #196288 > unrolled thread
| Started by | Eryk Sun <eryksun@gmail.com> |
|---|---|
| First post | 2024-06-18 02:26 -0500 |
| Last post | 2024-06-18 02:26 -0500 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: win32clipboard writing to clipboard on Windows 11 Eryk Sun <eryksun@gmail.com> - 2024-06-18 02:26 -0500
| From | Eryk Sun <eryksun@gmail.com> |
|---|---|
| Date | 2024-06-18 02:26 -0500 |
| Subject | Re: win32clipboard writing to clipboard on Windows 11 |
| Message-ID | <mailman.152.1718695638.2909.python-list@python.org> |
On Tue, Jun 18, 2024 at 2:19 AM Eryk Sun <eryksun@gmail.com> wrote:
>
>
> def set_clipboard_text(text):
> hMem = global_alloc_text(text)
> try:
> win32clipboard.SetClipboardData(win32clipboard.CF_UNICODETEXT,
> hMem)
> # Now the system owns the global memory.
> except:
> kernel32.GlobalFree(hMem)
Oops, that suppresses the exception. Fixed:
def set_clipboard_text(text):
hMem = global_alloc_from_text(text)
try:
win32clipboard.SetClipboardData(win32clipboard.CF_UNICODETEXT,
hMem)
# Now the system owns the global memory.
except:
kernel32.GlobalFree(hMem)
raise
Back to top | Article view | comp.lang.python
csiph-web