Note that there are some explanatory texts on larger screens.

plurals
  1. POhow to hook to events / messages in windows using python
    primarykey
    data
    text
    <h2>in short:</h2> <p>i want to intercept <strong>suspend/standby messages</strong> on my laptop, but my program doesn't receives all relevant messages.</p> <h2>background:</h2> <p>there's a bug in ms-excel on windows xp/2k, which prevents system suspend if a file is opened on a network/usb drive.</p> <p>i'm trying to work-around it programmatically (my toolbox include python, vb6, or command line tools).</p> <p>i know nothing about windows instrumentation :-)</p> <p>i have a sysinternals utility that suspends the system anyhow. i want to hook it to the close-lid event!</p> <h2>in long:</h2> <p>The notebook lid close (fujitsu u810) initiate the standby procedure [how?]</p> <p>The system then send everybody WM_POWERBROADCAST: PBT_APMQUERYSUSPEND (i can trace them using <code>SPYXX.EXE</code>)</p> <p>Every program answers "True", until excel answers "false", and the whole process stops.</p> <h2>My questions:</h2> <p>1) my python program doesn't catch neither pbm_apmquerysuspend, nor PBT_APMQUERYSTANDBYFAILED, nor PBT_APMQUERYSUSPENDFAILED: ` ...</p> <pre><code>query = "SELECT * FROM Win32_PowerManagementEvent" power_watcher = wmi.ExecNotificationQuery ( query ) power_event = power_watcher.NextEvent () </code></pre> <p>` it receives only PBT_APMSUSPEND, if standby finally occurs.</p> <p>Why not - and how do i intercept it?</p> <p>2) Is there another way to intercept the standby process?</p> <p>in a prefect world, i would set the lid-close event to run a command i choose. in a perfect world, lid-closure is a documented event.</p> <p>thank you all :-)</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload