destroying a window on windows

Michael C <[email protected]> Wed, 17 May 2017 16:10:28 -0700
Newsgroups gmane.comp.python.ctypes
Message-ID <CANyKM1jBAuVnZ=DzxJHHAnp4yhbVP8xo3w2oJaK8tMKQRY6nBA@mail.gmail.com>
--===============0510370922556034755==
Content-Type: multipart/alternative; boundary="001a113ed2bee5f1de054fc06474"

--001a113ed2bee5f1de054fc06474
Content-Type: text/plain; charset="UTF-8"

Apparently even though the MSDN says, given a handle, it would kill the
window, but it doesn't do that for me. Am I doing it properly?

Thanks!


import time
import ctypes
User32 = ctypes.WinDLL('User32', use_last_error=True)

handle = User32.GetForegroundWindow()
print(handle)
time.sleep(2)
User32.DestroyWindow(handle)

--001a113ed2bee5f1de054fc06474
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>Apparently even though the MSDN says, given a handle,=
 it would kill the window, but it doesn&#39;t do that for me. Am I doing it=
 properly?</div><div><br></div><div>Thanks!</div><div><br></div><div><br></=
div><div>import time</div><div>import ctypes</div><div>User32 =3D ctypes.Wi=
nDLL(&#39;User32&#39;, use_last_error=3DTrue)</div><div><br></div><div>hand=
le =3D User32.GetForegroundWindow()</div><div>print(handle)</div><div>time.=
sleep(2)</div><div>User32.DestroyWindow(handle)</div><div><br></div></div>

--001a113ed2bee5f1de054fc06474--


--===============0510370922556034755==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
--===============0510370922556034755==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
ctypes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ctypes-users

--===============0510370922556034755==--