MCPcopy Create free account
hub / github.com/ActiveState/code / WinMSGLoop

Function WinMSGLoop

recipes/Python/577654_DDE_Client/recipe-577654.py:220–236  ·  view source on GitHub ↗

Run the main windows message loop.

()

Source from the content-addressed store, hash-verified

218 return 0
219
220def WinMSGLoop():
221 """Run the main windows message loop."""
222 from ctypes import POINTER, byref, c_ulong
223 from ctypes.wintypes import BOOL, HWND, MSG, UINT
224
225 LPMSG = POINTER(MSG)
226 LRESULT = c_ulong
227 GetMessage = get_winfunc("user32", "GetMessageW", BOOL, (LPMSG, HWND, UINT, UINT))
228 TranslateMessage = get_winfunc("user32", "TranslateMessage", BOOL, (LPMSG,))
229 # restype = LRESULT
230 DispatchMessage = get_winfunc("user32", "DispatchMessageW", LRESULT, (LPMSG,))
231
232 msg = MSG()
233 lpmsg = byref(msg)
234 while GetMessage(lpmsg, HWND(), 0, 0) > 0:
235 TranslateMessage(lpmsg)
236 DispatchMessage(lpmsg)
237
238if __name__ == "__main__":
239 # Create a connection to ESOTS (OTS Swardfish) and to instrument MAR11 ALSI

Callers 1

recipe-577654.pyFile · 0.85

Calls 3

POINTERFunction · 0.85
get_winfuncFunction · 0.85
MSGClass · 0.85

Tested by

no test coverage detected