Rocksolid Light

News from da outaworlds

mail  files  register  groups  login

Message-ID:  

You have a strong desire for a home and your family interests come first.


comp / comp.lang.python / Re: win32clipboard writing to clipboard on Windows 11

SubjectAuthor
o Re: win32clipboard writing to clipboard on Windows 11Eryk Sun

1
Subject: Re: win32clipboard writing to clipboard on Windows 11
From: Eryk Sun
Newsgroups: comp.lang.python
Date: Tue, 18 Jun 2024 07:26 UTC
References: 1 2 3 4
Path: eternal-september.org!news.eternal-september.org!feeder3.eternal-september.org!fu-berlin.de!uni-berlin.de!not-for-mail
From: eryksun@gmail.com (Eryk Sun)
Newsgroups: comp.lang.python
Subject: Re: win32clipboard writing to clipboard on Windows 11
Date: Tue, 18 Jun 2024 02:26:39 -0500
Lines: 24
Message-ID: <mailman.152.1718695638.2909.python-list@python.org>
References: <f6e408ad-89c1-42b0-a771-d3677692f610@btinternet.com>
<7e8c9107-6f71-4c49-a78b-ac5094073499@mrabarnett.plus.com>
<CACL+1atEbLNT3E3cm+mApSAQ9xKQb1__muSFWrjajk702+ZcJw@mail.gmail.com>
<CACL+1auxyx4WioS3+ROjtK5Mad-d9gisN5pKktbHhhpdbrRDNg@mail.gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Trace: news.uni-berlin.de Lrj8THWc0Euu7njMCvt+0wBcYOMLa4vD/elAVV3PiYgg==
Cancel-Lock: sha1:jP5INOSQXU7NVkczyKoV9+pNdlY= sha256:t2ja53VzE39sdAp7V1DrLml0x/vdC2Owyf1fnvldyoM=
Return-Path: <eryksun@gmail.com>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="2048-bit key; unprotected key"
header.d=gmail.com header.i=@gmail.com header.b=M1/cjk7H;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.002
X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'def': 0.04;
'subject:Windows': 0.07; '18,': 0.09; 'cc:addr:python-list': 0.09;
'memory.': 0.09; 'subject:writing': 0.09; 'cc:no real name:2**0':
0.14; '2024': 0.16; 'eryk': 0.16; 'exception.': 0.16; 'owns':
0.16; 'wrote:': 0.16; 'tue,': 0.19; 'cc:addr:python.org': 0.20;
'cc:2**0': 0.25; 'jun': 0.26; 'raise': 0.31; 'message-
id:@mail.gmail.com': 0.32; 'header:In-Reply-To:1': 0.34;
'received:google.com': 0.34; 'from:addr:gmail.com': 0.35;
'global': 0.73; 'subject:skip:w 10': 0.76; 'skip:k 20': 0.78
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1718695635; x=1719300435; darn=python.org;
h=content-transfer-encoding:cc:to:subject:message-id:date:from
:in-reply-to:references:mime-version:from:to:cc:subject:date
:message-id:reply-to;
bh=KJCeAki27nAS05qwoKQaQBIq5uVoejOUxC18eqhcLWU=;
b=M1/cjk7HO8SE+dp8HncgqQoYSGYkD2SUzrmM5LgcMibtYj3DGRZyfKG7Mw5dPf/HRW
JFMtQliw1JwneVlmJioyfOqBUdVm0iwK7o7ojPUa14uO3iDsc9DRA9ynQ9WFowAl1uOa
r+peSKE1f+FV3xsn7Bd+Z9kb2XYv9iciZLOqw3ubO7HHLalgDSuK5r0psrHFqhD6DXvw
t+9PKs+ew48qLaxaZeBi7Pis/Qcw5CrkTCwDQXiFdZbXeO6P0kLWUqwxt878k9uRAAF8
7qiugE0Q66oOsnahxaHAlnz/5d++yK27aVDEDygtrMj/Fg5gafQKsCJOr29B1lzB40yI
cKmA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1718695635; x=1719300435;
h=content-transfer-encoding:cc:to:subject:message-id:date:from
:in-reply-to:references:mime-version:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to;
bh=KJCeAki27nAS05qwoKQaQBIq5uVoejOUxC18eqhcLWU=;
b=Frxt5abJDHfAxQ8mD9XYTkv2m5533/HhbcuMm/7NPnaeR8XPxnngUSJ3Ef8Om4oDHA
4DVNY/L/DSCqYG0AvQdoSWzxlHgd4FrtkusPx+2Aj9s1XAMVpsFfmOGIBUG7VypYGWBL
Z0TcH2RWelqn76062hD9jmUVe/mkfJXG7EMzb8ArjyhYqSXoAPyI8Oka9j5aRDjTbWGG
aNKWsfv2le/eXALgfvDELG8nrJLT9gtV5l1BAAksBGpNgvitQUpc6mEc0Q60fWlMGOFU
NQKdZHLM58OTdASWnnKBEZSHFZagEXXpie9XiPT82LVqB4RCgHlHH95W8nImi3uABY0m
fNtw==
X-Gm-Message-State: AOJu0YzGrDkvNZejrZefa0VOrd20hMtR1Jjq+lAtsrxyIkpYR2EaTmiQ
P6VdBryjSR+mKBpY0XoyF1eXdwHqNjR3CmyDwVomX17Ndn7Jecd/jyqGcZdc6OLtYAXxjAGwtDS
k20M6END2ryOwdHHg+Y3wmb5vg2xFzJfT
X-Google-Smtp-Source: AGHT+IEW8RQp4NrSIU6TFaYgpJhKEnlVnCcby7s3LQGTZxtXWc1KqdPw50Js/iz5DRcrgi1khvSVruhMSkrzeKibBos=
X-Received: by 2002:a05:6870:d203:b0:254:7dbe:1b81 with SMTP id
586e51a60fabf-258428bada3mr13012781fac.20.1718695635019; Tue, 18 Jun 2024
00:27:15 -0700 (PDT)
In-Reply-To: <CACL+1atEbLNT3E3cm+mApSAQ9xKQb1__muSFWrjajk702+ZcJw@mail.gmail.com>
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <CACL+1auxyx4WioS3+ROjtK5Mad-d9gisN5pKktbHhhpdbrRDNg@mail.gmail.com>
X-Mailman-Original-References: <f6e408ad-89c1-42b0-a771-d3677692f610@btinternet.com>
<7e8c9107-6f71-4c49-a78b-ac5094073499@mrabarnett.plus.com>
<CACL+1atEbLNT3E3cm+mApSAQ9xKQb1__muSFWrjajk702+ZcJw@mail.gmail.com>
View all headers

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

1

rocksolid light 0.9.8
clearnet tor