mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
Smaller doc fixes.
This commit is contained in:
parent
2e9675adf8
commit
35b9020246
1 changed files with 16 additions and 19 deletions
|
@ -1706,16 +1706,14 @@ the windows header file is this::
|
||||||
LPCSTR lpCaption,
|
LPCSTR lpCaption,
|
||||||
UINT uType);
|
UINT uType);
|
||||||
|
|
||||||
Here is the wrapping with ``ctypes``:
|
Here is the wrapping with ``ctypes``::
|
||||||
|
|
||||||
::
|
>>> from ctypes import c_int, WINFUNCTYPE, windll
|
||||||
|
>>> from ctypes.wintypes import HWND, LPCSTR, UINT
|
||||||
>>> from ctypes import c_int, WINFUNCTYPE, windll
|
>>> prototype = WINFUNCTYPE(c_int, HWND, LPCSTR, LPCSTR, UINT)
|
||||||
>>> from ctypes.wintypes import HWND, LPCSTR, UINT
|
>>> paramflags = (1, "hwnd", 0), (1, "text", "Hi"), (1, "caption", None), (1, "flags", 0)
|
||||||
>>> prototype = WINFUNCTYPE(c_int, HWND, LPCSTR, LPCSTR, UINT)
|
>>> MessageBox = prototype(("MessageBoxA", windll.user32), paramflags)
|
||||||
>>> paramflags = (1, "hwnd", 0), (1, "text", "Hi"), (1, "caption", None), (1, "flags", 0)
|
>>>
|
||||||
>>> MessageBox = prototype(("MessageBoxA", windll.user32), paramflags)
|
|
||||||
>>>
|
|
||||||
|
|
||||||
The MessageBox foreign function can now be called in these ways::
|
The MessageBox foreign function can now be called in these ways::
|
||||||
|
|
||||||
|
@ -1733,16 +1731,14 @@ function retrieves the dimensions of a specified window by copying them into
|
||||||
HWND hWnd,
|
HWND hWnd,
|
||||||
LPRECT lpRect);
|
LPRECT lpRect);
|
||||||
|
|
||||||
Here is the wrapping with ``ctypes``:
|
Here is the wrapping with ``ctypes``::
|
||||||
|
|
||||||
::
|
>>> from ctypes import POINTER, WINFUNCTYPE, windll, WinError
|
||||||
|
>>> from ctypes.wintypes import BOOL, HWND, RECT
|
||||||
>>> from ctypes import POINTER, WINFUNCTYPE, windll, WinError
|
>>> prototype = WINFUNCTYPE(BOOL, HWND, POINTER(RECT))
|
||||||
>>> from ctypes.wintypes import BOOL, HWND, RECT
|
>>> paramflags = (1, "hwnd"), (2, "lprect")
|
||||||
>>> prototype = WINFUNCTYPE(BOOL, HWND, POINTER(RECT))
|
>>> GetWindowRect = prototype(("GetWindowRect", windll.user32), paramflags)
|
||||||
>>> paramflags = (1, "hwnd"), (2, "lprect")
|
>>>
|
||||||
>>> GetWindowRect = prototype(("GetWindowRect", windll.user32), paramflags)
|
|
||||||
>>>
|
|
||||||
|
|
||||||
Functions with output parameters will automatically return the output parameter
|
Functions with output parameters will automatically return the output parameter
|
||||||
value if there is a single one, or a tuple containing the output parameter
|
value if there is a single one, or a tuple containing the output parameter
|
||||||
|
@ -1758,6 +1754,7 @@ do the error checking, and raises an exception when the api call failed::
|
||||||
... if not result:
|
... if not result:
|
||||||
... raise WinError()
|
... raise WinError()
|
||||||
... return args
|
... return args
|
||||||
|
...
|
||||||
>>> GetWindowRect.errcheck = errcheck
|
>>> GetWindowRect.errcheck = errcheck
|
||||||
>>>
|
>>>
|
||||||
|
|
||||||
|
@ -1772,7 +1769,7 @@ instead, the normal processing will no longer take place::
|
||||||
... raise WinError()
|
... raise WinError()
|
||||||
... rc = args[1]
|
... rc = args[1]
|
||||||
... return rc.left, rc.top, rc.bottom, rc.right
|
... return rc.left, rc.top, rc.bottom, rc.right
|
||||||
>>>
|
...
|
||||||
>>> GetWindowRect.errcheck = errcheck
|
>>> GetWindowRect.errcheck = errcheck
|
||||||
>>>
|
>>>
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue