Skip to content

Commit 31f8288

Browse files
committed
Show something useful from EvtSubscribe_push demo
1 parent 842fbef commit 31f8288

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

CHANGES.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ https://mhammond.github.io/pywin32_installers.html.
1414
Coming in build 308, as yet unreleased
1515
--------------------------------------
1616

17+
* The `EvtSubscribe_push` demo now actually demonstrates the callback action and the event context being filled. (#2281, @Avasam)
18+
1719
Build 307, released 2024-10-04
1820
------------------------------
1921
### Release process changes

win32/Demos/EvtSubscribe_push.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
## Demonstrates a "push" subscription with a callback function
2+
from __future__ import annotations
3+
4+
from time import sleep
5+
26
import win32evtlog
37

48
query_text = '*[System[Provider[@Name="Microsoft-Windows-Winlogon"]]]'
@@ -15,11 +19,14 @@ def c(reason, context, evt):
1519
return 0
1620

1721

18-
evttext = []
22+
evttext: list[str] = []
1923
s = win32evtlog.EvtSubscribe(
2024
"System",
2125
win32evtlog.EvtSubscribeStartAtOldestRecord,
2226
Query="*",
2327
Callback=c,
2428
Context=evttext,
2529
)
30+
31+
sleep(0.001)
32+
print("\n".join(evttext))

0 commit comments

Comments
 (0)