pywin32: Improve some types (#9089)

This commit is contained in:
Samuel T
2022-11-04 20:48:53 -04:00
committed by GitHub
parent 4329404b1c
commit 98dac4c926
9 changed files with 276 additions and 239 deletions

View File

@@ -55,6 +55,7 @@ pythoncom.MakeIID
pythoncom.MakeTime
win32.lib.dbi
win32.lib.win32pdhquery.Query.addperfcounter
# Deprecated and makes a buffer of random junk. Use something like `b"\x00" * bufferSize` instead
win32.win32gui.PyMakeBuffer
# Also a script
win32.lib.regcheck

View File

@@ -2,6 +2,8 @@ version = "304.*"
[tool.stubtest]
# The library only works on Windows; we currently only run stubtest on Ubuntu for third-party stubs in CI.
# See #8660
# `ignore_missing_stub = false` crashes stubtest. This should be fixed in next mypy update
# https://github.com/python/mypy/issues/13822
skip = true
# This crashes stubtest. It should be fixed in next mypy update
# (keeping it since we currently skip the stub anyway)
# https://github.com/python/mypy/issues/13822
ignore_missing_stub = false

View File

@@ -1,4 +1,4 @@
# Not available at runtime. Contains type definitions that are otherwise not exposed
# Not available at runtime. Contains type definitions that are otherwise not exposed and not part of a specific module.
from _typeshed import Incomplete
from typing_extensions import final
@@ -646,182 +646,182 @@ class PyDCB:
class PyDEVMODE:
@property
def SpecVersion(self): ...
def SpecVersion(self) -> int: ...
@property
def DriverVersion(self): ...
def DriverVersion(self) -> int: ...
@property
def Size(self): ...
def Size(self) -> int: ...
@property
def DriverExtra(self): ...
def DriverExtra(self) -> int: ...
@property
def Fields(self): ...
def Fields(self) -> int: ...
@property
def Orientation(self): ...
def Orientation(self) -> int: ...
@property
def PaperSize(self): ...
def PaperSize(self) -> int: ...
@property
def PaperLength(self): ...
def PaperLength(self) -> int: ...
@property
def PaperWidth(self): ...
def PaperWidth(self) -> int: ...
@property
def Position_x(self): ...
def Position_x(self) -> int: ...
@property
def Position_y(self): ...
def Position_y(self) -> int: ...
@property
def DisplayOrientation(self): ...
def DisplayOrientation(self) -> int: ...
@property
def DisplayFixedOutput(self): ...
def DisplayFixedOutput(self) -> int: ...
@property
def Scale(self): ...
def Scale(self) -> int: ...
@property
def Copies(self): ...
def Copies(self) -> int: ...
@property
def DefaultSource(self): ...
def DefaultSource(self) -> int: ...
@property
def PrintQuality(self): ...
def PrintQuality(self) -> int: ...
@property
def Color(self): ...
def Color(self) -> int: ...
@property
def Duplex(self): ...
def Duplex(self) -> int: ...
@property
def YResolution(self): ...
def YResolution(self) -> int: ...
@property
def TTOption(self): ...
def TTOption(self) -> int: ...
@property
def Collate(self): ...
def Collate(self) -> int: ...
@property
def LogPixels(self): ...
def LogPixels(self) -> int: ...
@property
def BitsPerPel(self): ...
def BitsPerPel(self) -> int: ...
@property
def PelsWidth(self): ...
def PelsWidth(self) -> int: ...
@property
def PelsHeight(self): ...
def PelsHeight(self) -> int: ...
@property
def DisplayFlags(self): ...
def DisplayFlags(self) -> int: ...
@property
def DisplayFrequency(self): ...
def DisplayFrequency(self) -> int: ...
@property
def ICMMethod(self): ...
def ICMMethod(self) -> int: ...
@property
def ICMIntent(self): ...
def ICMIntent(self) -> int: ...
@property
def MediaType(self): ...
def MediaType(self) -> int: ...
@property
def DitherType(self): ...
def DitherType(self) -> int: ...
@property
def Reserved1(self): ...
def Reserved1(self) -> int: ...
@property
def Reserved2(self): ...
def Reserved2(self) -> int: ...
@property
def Nup(self): ...
def Nup(self) -> int: ...
@property
def PanningWidth(self): ...
def PanningWidth(self) -> int: ...
@property
def PanningHeight(self): ...
def PanningHeight(self) -> int: ...
@property
def DeviceName(self): ...
def DeviceName(self) -> str: ...
@property
def FormName(self): ...
def FormName(self) -> str: ...
@property
def DriverData(self): ...
def DriverData(self) -> Incomplete | None: ...
def Clear(self) -> None: ...
class PyDEVMODEW:
@property
def SpecVersion(self): ...
def SpecVersion(self) -> int: ...
@property
def DriverVersion(self): ...
def DriverVersion(self) -> int: ...
@property
def Size(self): ...
def Size(self) -> int: ...
@property
def DriverExtra(self): ...
def DriverExtra(self) -> int: ...
@property
def Fields(self): ...
def Fields(self) -> int: ...
@property
def Orientation(self): ...
def Orientation(self) -> int: ...
@property
def PaperSize(self): ...
def PaperSize(self) -> int: ...
@property
def PaperLength(self): ...
def PaperLength(self) -> int: ...
@property
def PaperWidth(self): ...
def PaperWidth(self) -> int: ...
@property
def Position_x(self): ...
def Position_x(self) -> int: ...
@property
def Position_y(self): ...
def Position_y(self) -> int: ...
@property
def DisplayOrientation(self): ...
def DisplayOrientation(self) -> int: ...
@property
def DisplayFixedOutput(self): ...
def DisplayFixedOutput(self) -> int: ...
@property
def Scale(self): ...
def Scale(self) -> int: ...
@property
def Copies(self): ...
def Copies(self) -> int: ...
@property
def DefaultSource(self): ...
def DefaultSource(self) -> int: ...
@property
def PrintQuality(self): ...
def PrintQuality(self) -> int: ...
@property
def Color(self): ...
def Color(self) -> int: ...
@property
def Duplex(self): ...
def Duplex(self) -> int: ...
@property
def YResolution(self): ...
def YResolution(self) -> int: ...
@property
def TTOption(self): ...
def TTOption(self) -> int: ...
@property
def Collate(self): ...
def Collate(self) -> int: ...
@property
def LogPixels(self): ...
def LogPixels(self) -> int: ...
@property
def BitsPerPel(self): ...
def BitsPerPel(self) -> int: ...
@property
def PelsWidth(self): ...
def PelsWidth(self) -> int: ...
@property
def PelsHeight(self): ...
def PelsHeight(self) -> int: ...
@property
def DisplayFlags(self): ...
def DisplayFlags(self) -> int: ...
@property
def DisplayFrequency(self): ...
def DisplayFrequency(self) -> int: ...
@property
def ICMMethod(self): ...
def ICMMethod(self) -> int: ...
@property
def ICMIntent(self): ...
def ICMIntent(self) -> int: ...
@property
def MediaType(self): ...
def MediaType(self) -> int: ...
@property
def DitherType(self): ...
def DitherType(self) -> int: ...
@property
def Reserved1(self): ...
def Reserved1(self) -> int: ...
@property
def Reserved2(self): ...
def Reserved2(self) -> int: ...
@property
def Nup(self): ...
def Nup(self) -> int: ...
@property
def PanningWidth(self): ...
def PanningWidth(self) -> int: ...
@property
def PanningHeight(self): ...
def PanningHeight(self) -> int: ...
@property
def DeviceName(self) -> str: ...
@property
def FormName(self): ...
def FormName(self) -> str: ...
@property
def DriverData(self): ...
def DriverData(self) -> Incomplete | None: ...
class PyDISPLAY_DEVICE:
@property
def Size(self): ...
def Size(self) -> int: ...
@property
def DeviceName(self): ...
def DeviceName(self) -> str: ...
@property
def DeviceString(self): ...
def DeviceString(self) -> str: ...
@property
def StateFlags(self): ...
def StateFlags(self) -> int: ...
@property
def DeviceID(self): ...
def DeviceID(self) -> str: ...
@property
def DeviceKey(self): ...
def DeviceKey(self) -> str: ...
def Clear(self) -> None: ...
class PyDLGITEMTEMPLATE: ...
@@ -910,7 +910,7 @@ class PyGetSignerCertificate: ...
class PyHANDLE:
@property
def handle(self): ...
def handle(self) -> int: ...
def Close(self) -> None: ...
def close(self) -> None: ...
def Detach(self): ...

View File

@@ -1,10 +1,30 @@
from _typeshed import Incomplete
from _typeshed import Incomplete, ReadableBuffer
from array import array
from typing import NamedTuple
is64bit: bool
def UnpackWMNOTIFY(lparam) -> tuple[Incomplete, ...]: ...
def UnpackNMITEMACTIVATE(lparam) -> tuple[Incomplete, ...]: ...
class _WMNOTIFY(NamedTuple):
hwndFrom: Incomplete
idFrom: Incomplete
code: Incomplete
def UnpackWMNOTIFY(lparam: int) -> _WMNOTIFY: ...
class _NMITEMACTIVATE(NamedTuple):
hwndFrom: Incomplete
idFrom: Incomplete
code: Incomplete
iItem: Incomplete
iSubItem: Incomplete
uNewState: Incomplete
uOldState: Incomplete
uChanged: Incomplete
actionx: Incomplete
actiony: Incomplete
lParam: Incomplete
def UnpackNMITEMACTIVATE(lparam) -> _NMITEMACTIVATE: ...
def PackMENUITEMINFO(
fType: Incomplete | None = ...,
fState: Incomplete | None = ...,
@@ -17,20 +37,20 @@ def PackMENUITEMINFO(
hbmpItem: Incomplete | None = ...,
dwTypeData: Incomplete | None = ...,
) -> tuple[array[int], list[Incomplete]]: ...
def UnpackMENUITEMINFO(
s,
) -> tuple[
Incomplete | None,
Incomplete | None,
Incomplete | None,
Incomplete | None,
Incomplete | None,
Incomplete | None,
Incomplete | None,
str | None,
Incomplete | None,
]: ...
def EmptyMENUITEMINFO(mask: Incomplete | None = ..., text_buf_size: int = ...) -> tuple[array[int], list[Incomplete]]: ...
class _MENUITEMINFO(NamedTuple):
fType: int | None
fState: int | None
wID: int | None
hSubMenu: int | None
hbmpChecked: int | None
hbmpUnchecked: int | None
dwItemData: int | None
text: str | None
hbmpItem: int | None
def UnpackMENUITEMINFO(s: ReadableBuffer) -> _MENUITEMINFO: ...
def EmptyMENUITEMINFO(mask: Incomplete | None = ..., text_buf_size: int = ...) -> tuple[array[int], list[array[int]]]: ...
def PackMENUINFO(
dwStyle: Incomplete | None = ...,
cyMax: Incomplete | None = ...,
@@ -39,68 +59,49 @@ def PackMENUINFO(
dwMenuData: Incomplete | None = ...,
fMask: int = ...,
) -> array[int]: ...
def UnpackMENUINFO(s) -> tuple[Incomplete | None, Incomplete | None, Incomplete | None, Incomplete | None, Incomplete | None]: ...
class _MENUINFO(NamedTuple):
dwStyle: Incomplete | None
cyMax: Incomplete | None
hbrBack: Incomplete | None
dwContextHelpID: Incomplete | None
dwMenuData: Incomplete | None
def UnpackMENUINFO(s: ReadableBuffer) -> _MENUINFO: ...
def EmptyMENUINFO(mask: Incomplete | None = ...) -> array[int]: ...
def PackTVINSERTSTRUCT(parent, insertAfter, tvitem) -> tuple[bytes, list[Incomplete]]: ...
def PackTVITEM(hitem, state, stateMask, text, image, selimage, citems, param) -> tuple[array[int], list[Incomplete]]: ...
def EmptyTVITEM(hitem, mask: Incomplete | None = ..., text_buf_size: int = ...) -> tuple[array[int], list[Incomplete]]: ...
def UnpackTVITEM(
buffer,
) -> tuple[
Incomplete,
Incomplete | None,
Incomplete | None,
Incomplete | None,
Incomplete | None,
Incomplete | None,
Incomplete | None,
Incomplete | None,
]: ...
def UnpackTVNOTIFY(
lparam,
) -> tuple[
Incomplete,
Incomplete,
Incomplete,
Incomplete,
tuple[
Incomplete,
Incomplete | None,
Incomplete | None,
Incomplete | None,
Incomplete | None,
Incomplete | None,
Incomplete | None,
Incomplete | None,
],
tuple[
Incomplete,
Incomplete | None,
Incomplete | None,
Incomplete | None,
Incomplete | None,
Incomplete | None,
Incomplete | None,
Incomplete | None,
],
]: ...
def UnpackTVDISPINFO(
lparam,
) -> tuple[
Incomplete,
Incomplete,
Incomplete,
tuple[
Incomplete,
Incomplete | None,
Incomplete | None,
Incomplete | None,
Incomplete | None,
Incomplete | None,
Incomplete | None,
Incomplete | None,
],
]: ...
class _TVITEM(NamedTuple):
item_hItem: Incomplete
item_state: Incomplete | None
item_stateMask: Incomplete | None
text: Incomplete | None
item_image: Incomplete | None
item_selimage: Incomplete | None
item_cChildren: Incomplete | None
item_param: Incomplete | None
def UnpackTVITEM(buffer: ReadableBuffer) -> _TVITEM: ...
class _TVNOTIFY(NamedTuple):
hwndFrom: Incomplete
id: Incomplete
code: Incomplete
action: Incomplete
item_old: _TVITEM
item_new: _TVITEM
def UnpackTVNOTIFY(lparam: int) -> _TVNOTIFY: ...
class _TVDISPINFO(NamedTuple):
hwndFrom: Incomplete
id: Incomplete
code: Incomplete
item: _TVITEM
def UnpackTVDISPINFO(lparam: int) -> _TVDISPINFO: ...
def PackLVITEM(
item: Incomplete | None = ...,
subItem: Incomplete | None = ...,
@@ -111,49 +112,40 @@ def PackLVITEM(
param: Incomplete | None = ...,
indent: Incomplete | None = ...,
) -> tuple[array[int], list[Incomplete]]: ...
def UnpackLVITEM(
buffer,
) -> tuple[
Incomplete,
Incomplete,
Incomplete | None,
Incomplete | None,
Incomplete | None,
Incomplete | None,
Incomplete | None,
Incomplete | None,
]: ...
def UnpackLVDISPINFO(
lparam,
) -> tuple[
Incomplete,
Incomplete,
Incomplete,
tuple[
Incomplete,
Incomplete,
Incomplete | None,
Incomplete | None,
Incomplete | None,
Incomplete | None,
Incomplete | None,
Incomplete | None,
],
]: ...
def UnpackLVNOTIFY(
lparam,
) -> tuple[
Incomplete,
Incomplete,
Incomplete,
Incomplete,
Incomplete,
Incomplete,
Incomplete,
Incomplete,
tuple[Incomplete, Incomplete],
Incomplete,
]: ...
class _LVITEM(NamedTuple):
item_item: Incomplete
item_subItem: Incomplete
item_state: Incomplete | None
item_stateMask: Incomplete | None
text: Incomplete | None
item_image: Incomplete | None
item_param: Incomplete | None
item_indent: Incomplete | None
def UnpackLVITEM(buffer: ReadableBuffer) -> _LVITEM: ...
class _LVDISPINFO(NamedTuple):
hwndFrom: Incomplete
id: Incomplete
code: Incomplete
item: _LVITEM
def UnpackLVDISPINFO(lparam: int) -> _LVDISPINFO: ...
class _UnpackLVNOTIFY(NamedTuple):
hwndFrom: Incomplete
id: Incomplete
code: Incomplete
item: Incomplete
subitem: Incomplete
newstate: Incomplete
oldstate: Incomplete
changed: Incomplete
pt: tuple[Incomplete, Incomplete]
lparam: Incomplete
def UnpackLVNOTIFY(lparam: int) -> _UnpackLVNOTIFY: ...
def EmptyLVITEM(
item, subitem, mask: Incomplete | None = ..., text_buf_size: int = ...
) -> tuple[array[int], list[Incomplete]]: ...
@@ -165,12 +157,26 @@ def PackLVCOLUMN(
image: Incomplete | None = ...,
order: Incomplete | None = ...,
) -> tuple[array[int], list[Incomplete]]: ...
def UnpackLVCOLUMN(
lparam,
) -> tuple[Incomplete | None, Incomplete | None, Incomplete | None, Incomplete | None, Incomplete | None, Incomplete | None]: ...
class _LVCOLUMN(NamedTuple):
fmt: Incomplete | None
cx: Incomplete | None
text: Incomplete | None
subItem: Incomplete | None
image: Incomplete | None
order: Incomplete | None
def UnpackLVCOLUMN(lparam: ReadableBuffer) -> _LVCOLUMN: ...
def EmptyLVCOLUMN(mask: Incomplete | None = ..., text_buf_size: int = ...) -> tuple[array[int], list[Incomplete]]: ...
def PackLVHITTEST(pt) -> tuple[array[int], None]: ...
def UnpackLVHITTEST(buf) -> tuple[tuple[Incomplete, Incomplete], Incomplete, Incomplete, Incomplete]: ...
class _LVHITTEST(NamedTuple):
pt: tuple[Incomplete, Incomplete]
flags: Incomplete
item: Incomplete
subitem: Incomplete
def UnpackLVHITTEST(buf: ReadableBuffer) -> tuple[tuple[Incomplete, Incomplete], Incomplete, Incomplete, Incomplete]: ...
def PackHDITEM(
cxy: Incomplete | None = ...,
text: Incomplete | None = ...,
@@ -189,4 +195,4 @@ class DEV_BROADCAST_INFO:
devicetype: Incomplete
def __init__(self, devicetype, **kw) -> None: ...
def UnpackDEV_BROADCAST(lparam) -> DEV_BROADCAST_INFO | None: ...
def UnpackDEV_BROADCAST(lparam: int) -> DEV_BROADCAST_INFO | None: ...

View File

@@ -1,8 +1,15 @@
from _typeshed import Incomplete
from typing_extensions import TypedDict
import _win32typing
from win32.lib.pywintypes import error as error
class _MonitorInfo(TypedDict):
Monitor: tuple[int, int, int, int]
Work: tuple[int, int, int, int]
Flags: int
Device: str
def AbortSystemShutdown(computerName: str) -> None: ...
def InitiateSystemShutdown(computerName: str, message: str, timeOut, bForceClose, bRebootAfterShutdown) -> None: ...
def Apply(exceptionHandler, func, args): ...
@@ -21,8 +28,10 @@ def DuplicateHandle(
hSourceProcess: int, hSource: int, hTargetProcessHandle: int, desiredAccess, bInheritHandle, options
) -> int: ...
def EndUpdateResource(handle: int, discard) -> None: ...
def EnumDisplayDevices(Device: str | None = ..., DevNum: int = ..., Flags=...) -> _win32typing.PyDISPLAY_DEVICE: ...
def EnumDisplayMonitors(hdc: int | None = ..., rcClip: _win32typing.PyRECT | None = ...): ...
def EnumDisplayDevices(Device: str | None = ..., DevNum: int = ..., Flags: int = ...) -> _win32typing.PyDISPLAY_DEVICE: ...
def EnumDisplayMonitors(
hdc: int | None = ..., rcClip: _win32typing.PyRECT | None = ...
) -> list[tuple[_win32typing.PyHANDLE, _win32typing.PyHANDLE, tuple[int, int, int, int]]]: ...
def EnumDisplaySettings(DeviceName: str | None = ..., ModeNum: int = ...) -> _win32typing.PyDEVMODE: ...
def EnumDisplaySettingsEx(ModeNum, DeviceName: str | None = ..., Flags=...) -> _win32typing.PyDEVMODE: ...
def EnumResourceLanguages(
@@ -47,7 +56,7 @@ def GetCommandLine() -> str: ...
def GetComputerName() -> str: ...
def GetComputerNameEx(NameType) -> str: ...
def GetComputerObjectName(NameFormat) -> str: ...
def GetMonitorInfo(hMonitor: int): ...
def GetMonitorInfo(hMonitor: int) -> _MonitorInfo: ...
def GetUserName() -> str: ...
def GetUserNameEx(NameFormat) -> str: ...
def GetCursorPos() -> tuple[Incomplete, Incomplete]: ...

View File

@@ -1,15 +1,19 @@
from _typeshed import Incomplete
from _typeshed import Incomplete, ReadableBuffer, WriteableBuffer
from collections.abc import Callable
from typing import TypeVar
import _win32typing
from win32.lib.pywintypes import error as error
_T = TypeVar("_T")
def EnumFontFamilies(hdc: int, Family: str, EnumFontFamProc, Param): ...
def set_logger(logger) -> None: ...
def LOGFONT() -> _win32typing.PyLOGFONT: ...
def CreateFontIndirect(lplf: _win32typing.PyLOGFONT): ...
def GetObject(handle: int): ...
def GetObjectType(h: int): ...
def PyGetMemory(addr, _len): ...
def PyGetMemory(__addr: int, __len: int): ...
def PyGetString(addr, _len) -> str: ...
def PySetString(addr, String, maxLen): ...
def PySetMemory(addr, String): ...
@@ -21,16 +25,29 @@ def GetWindowLong(hwnd: int, index): ...
def GetClassLong(hwnd: int, index): ...
def SetWindowLong(hwnd: int, index, value): ...
def CallWindowProc(wndproc, hwnd: int, msg, wparam, lparam): ...
def SendMessage(hwnd: int, message, wparam: Incomplete | None = ..., lparam: Incomplete | None = ...): ...
def SendMessageTimeout(hwnd: int, message, wparam, lparam, flags, timeout) -> tuple[Incomplete, Incomplete]: ...
def PostMessage(hwnd: int, message, wparam: int = ..., lparam: int = ...) -> None: ...
def SendMessage(
__hwnd: int | None, __message: int, __wparam: int | None = ..., __lparam: ReadableBuffer | float | None = ...
) -> int: ...
def SendMessageTimeout(
__hwnd: int,
__message: int,
__wparam: ReadableBuffer | float | None,
__lparam: ReadableBuffer | float | None,
__flags: int,
__timeout: int,
) -> tuple[int, int]: ...
def PostMessage(
__hwnd: int | None, __message: int, __wparam: int | None = ..., __lparam: ReadableBuffer | float | None = ...
) -> None: ...
def PostThreadMessage(threadId, message, wparam, lparam) -> None: ...
def ReplyMessage(result): ...
def RegisterWindowMessage(name: str): ...
def DefWindowProc(hwnd: int, message, wparam, lparam): ...
def EnumWindows(callback, extra) -> None: ...
def EnumThreadWindows(dwThreadId, callback, extra) -> None: ...
def EnumChildWindows(hwnd: int, callback, extra) -> None: ...
def DefWindowProc(
hwnd: int | None, message: int, wparam: ReadableBuffer | float | None, lparam: ReadableBuffer | float | None
) -> int: ...
def EnumWindows(__callback: Callable[[int, _T], object], __extra: _T) -> None: ...
def EnumThreadWindows(dwThreadId, __callback: Callable[[int, _T], object], __extra: _T) -> None: ...
def EnumChildWindows(__hwnd: int | None, __callback: Callable[[int, _T], object], __extra: _T) -> None: ...
def DialogBox(hInstance: int, TemplateName: _win32typing.PyResourceId, hWndParent: int, DialogFunc, InitParam: int = ...): ...
def DialogBoxParam(): ...
def DialogBoxIndirect(
@@ -113,7 +130,7 @@ def HideCaret(hWnd: int) -> None: ...
def SetCaretPos(x, y) -> None: ...
def GetCaretPos() -> tuple[Incomplete, Incomplete]: ...
def ShowCaret(hWnd: int) -> None: ...
def ShowWindow(hWnd: int, cmdShow): ...
def ShowWindow(__hWnd: int | None, __cmdShow: int) -> int: ...
def IsWindowVisible(__hwnd: int | None) -> int: ...
def IsWindowEnabled(__hwnd: int | None) -> int: ...
def SetFocus(hwnd: int) -> None: ...
@@ -122,8 +139,8 @@ def UpdateWindow(hwnd: int) -> None: ...
def BringWindowToTop(hwnd: int) -> None: ...
def SetActiveWindow(hwnd: int): ...
def GetActiveWindow(): ...
def SetForegroundWindow(hwnd: int): ...
def GetForegroundWindow(): ...
def SetForegroundWindow(__hwnd: int) -> None: ...
def GetForegroundWindow() -> int: ...
def GetClientRect(hwnd: int) -> tuple[int, int, int, int]: ...
def GetDC(hwnd: int): ...
def SaveDC(hdc: int): ...
@@ -138,7 +155,7 @@ def GetWindowRect(hwnd: int) -> tuple[int, int, int, int]: ...
def GetStockObject(Object) -> int: ...
def PostQuitMessage(rc) -> None: ...
def WaitMessage() -> None: ...
def SetWindowPos(hWnd: int, InsertAfter: int, X, Y, cx, cy, Flags) -> None: ...
def SetWindowPos(__hWnd: int, __InsertAfter: int | None, __X: int, __Y: int, __cx: int, __cy: int, __Flags: int) -> None: ...
def GetWindowPlacement(__hwnd: int) -> tuple[int, int, tuple[int, int], tuple[int, int], tuple[int, int, int, int]]: ...
def SetWindowPlacement(hWnd: int, placement) -> None: ...
def RegisterClass(wndClass: _win32typing.PyWNDCLASS): ...
@@ -153,7 +170,7 @@ def PeekMessage(hwnd: int, filterMin, filterMax, removalOptions): ...
def Shell_NotifyIcon(Message, nid: _win32typing.PyNOTIFYICONDATA) -> None: ...
def GetSystemMenu(hwnd: int, bRevert): ...
def DrawMenuBar(hwnd: int) -> None: ...
def MoveWindow(hwnd: int, x, y, width, height, bRepaint) -> None: ...
def MoveWindow(__hwnd: int, __x: int, __y: int, __width: int, __height: int, __bRepaint: bool) -> None: ...
def CloseWindow() -> None: ...
def DeleteMenu(hmenu, position, flags) -> None: ...
def RemoveMenu(hmenu, position, flags) -> None: ...
@@ -200,8 +217,8 @@ def GradientFill(hdc, Vertex: tuple[_win32typing.PyTRIVERTEX, ...], Mesh, Mode)
def GetOpenFileName(OPENFILENAME: str): ...
def InsertMenuItem(hMenu, uItem, fByPosition, menuItem) -> None: ...
def SetMenuItemInfo(hMenu, uItem, fByPosition, menuItem) -> None: ...
def GetMenuItemInfo(hMenu, uItem, fByPosition, menuItem) -> None: ...
def GetMenuItemCount(hMenu): ...
def GetMenuItemInfo(__hMenu: int, __uItem: int, __fByPosition: bool, __menuItem: ReadableBuffer) -> None: ...
def GetMenuItemCount(__hMenu: int | None) -> int: ...
# Actually returns a list of int|tuple, but lists don't support positional types
def GetMenuItemRect(__hWnd: int | None, __hMenu: int | None, __uItem: int) -> tuple[int, tuple[int, int, int, int]]: ...
@@ -220,7 +237,7 @@ def SetMenuItemBitmaps(
) -> None: ...
def CheckMenuRadioItem(hMenu, idFirst, idLast, idCheck, uFlags) -> None: ...
def SetMenuInfo(hmenu, info) -> None: ...
def GetMenuInfo(hmenu, info) -> None: ...
def GetMenuInfo(__hmenu: int, __info: WriteableBuffer) -> None: ...
def DrawFocusRect(hDC: int, rc: tuple[int, int, int, int]) -> None: ...
def DrawText(hDC: int, String, nCount, Rect: _win32typing.PyRECT, Format) -> tuple[Incomplete, _win32typing.PyRECT]: ...
def LineTo(hdc: int, XEnd, YEnd) -> None: ...
@@ -321,10 +338,10 @@ def CreateWindowEx(
dwExStyle, className: str, windowTitle: str, style, x, y, width, height, parent, menu, hinstance, reserved
): ...
def GetParent(child: int) -> int: ...
def SetParent(child: int, child1: int): ...
def SetParent(__child: int, __child1: int | None | _win32typing.PyHANDLE) -> int: ...
def GetCursorPos() -> tuple[Incomplete, Incomplete]: ...
def GetDesktopWindow(): ...
def GetWindow(hWnd: int, uCmd): ...
def GetWindow(__hWnd: int, __uCmd: int) -> int: ...
def GetWindowDC(hWnd: int) -> int: ...
def IsIconic(__hWnd: int) -> int: ...
def IsWindow(__hWnd: int) -> int: ...
@@ -341,7 +358,7 @@ def ScrollWindowEx(
def SetScrollInfo(hwnd: int, nBar, scollInfo: _win32typing.PySCROLLINFO, bRedraw=...) -> None: ...
def GetScrollInfo(hwnd: int, nBar, mask) -> _win32typing.PySCROLLINFO: ...
def GetClassName(hwnd: int) -> str: ...
def WindowFromPoint(point: tuple[Incomplete, Incomplete]): ...
def WindowFromPoint(point: tuple[int, int]) -> int: ...
def ChildWindowFromPoint(hwndParent: int, point: tuple[Incomplete, Incomplete]): ...
def CreateDC(Driver: str, Device: str, InitData: _win32typing.PyDEVMODE): ...
def GetSaveFileNameW(

View File

@@ -38,7 +38,7 @@ def GetStartupInfo() -> _win32typing.PySTARTUPINFO: ...
def GetPriorityClass(handle: int): ...
def GetExitCodeThread(handle: int): ...
def GetExitCodeProcess(handle: int): ...
def GetWindowThreadProcessId(hwnd: int) -> tuple[Incomplete, Incomplete]: ...
def GetWindowThreadProcessId(__hwnd: int | None) -> tuple[int, int]: ...
def SetThreadPriority(handle: int, nPriority) -> None: ...
def GetThreadPriority(handle: int): ...
def GetProcessPriorityBoost(Process: int): ...

View File

@@ -2,7 +2,7 @@ from _typeshed import Incomplete
from win32com.client import dynamic as dynamic
def GetObject(Pathname: Incomplete | None = ..., Class: Incomplete | None = ..., clsctx: Incomplete | None = ...): ...
def GetObject(Pathname: str | None = ..., Class: Incomplete | None = ..., clsctx: Incomplete | None = ...) -> CDispatch: ...
def GetActiveObject(Class, clsctx=...): ...
def Moniker(Pathname, clsctx=...): ...
def Dispatch(

View File

@@ -1,4 +1,5 @@
from _typeshed import Incomplete
from typing import Any
# Necessary for mypy to not throw AssertionError with win32com.client
class CDispatch:
@@ -22,5 +23,6 @@ class CDispatch:
def __LazyMap__(self, attr): ...
def __AttrToID__(self, attr): ...
ob: Incomplete
def __getattr__(self, attr): ...
def __setattr__(self, attr, value) -> None: ...
# CDispatch objects are dynamically generated and too complex to type
def __getattr__(self, attr: str) -> Any: ...
def __setattr__(self, attr: str, value: Any) -> None: ...