The code is very simple, so there is no comment :}
[Python]
"""
Use windows events and shared memory to implement inter-process communication.
"""
# Reader
Import win32event as w32e
Import win32api as wapi
Import mmapfile as mmf
HEvent = w32e. CreateEvent (None, 0, 0, "Global \ JmdebuggerEvent ")
# System_info = wapi. GetSystemInfo ()
# Page_size = system_info [1]
PyMm = mmf. mmapfile (None, "JmdebuggerMem", 1024)
If hEvent! = None and pyMm! = None:
W32e. WaitForSingleObject (hEvent,-1)
Buf = pyMm. read (16)
Print buf
Wapi. CloseHandle (hEvent)
PyMm. close ()
[Python] view plaincopy
# Writer
Import win32event as w32e
Import mmapfile as mmf
HEvent = w32e. OpenEvent (w32e. EVENT_ALL_ACCESS, 0, "Global \ JmdebuggerEvent ")
PyMm = mmf. mmapfile (None, "JmdebuggerMem", 1024)
If hEvent! = None and pyMm! = None:
W32e. SetEvent (hEvent)
PyMm. write ("hello world! ");