Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[client\_events.py] Use WinDLL/OleDLL instead of windll/oledll #758

Merged
merged 1 commit into from
Jan 25, 2025

Conversation

moi15moi
Copy link
Contributor

See #735

@junkmd
Copy link
Collaborator

junkmd commented Jan 25, 2025

I pulled this change to my local environment and tested triggering Excel events. It seems to be working properly.

>>> from comtypes import client
>>> xl = client.CreateObject("Excel.Application") 
>>> xl.Visible = True
>>> client.PumpEvents(30)
>>> conn = client.ShowEvents(xl)
# event found: AppEvents_NewWorkbook
# event found: AppEvents_SheetSelectionChange
# event found: AppEvents_SheetBeforeDoubleClick
# event found: AppEvents_SheetBeforeRightClick
# event found: AppEvents_SheetActivate
# event found: AppEvents_SheetDeactivate
# event found: AppEvents_SheetCalculate
# event found: AppEvents_SheetChange
# event found: AppEvents_WorkbookOpen
# event found: AppEvents_WorkbookActivate
# event found: AppEvents_WorkbookDeactivate
# event found: AppEvents_WorkbookBeforeClose
# event found: AppEvents_WorkbookBeforeSave
# event found: AppEvents_WorkbookBeforePrint
# event found: AppEvents_WorkbookNewSheet
# event found: AppEvents_WorkbookAddinInstall
# event found: AppEvents_WorkbookAddinUninstall
# event found: AppEvents_WindowResize
# event found: AppEvents_WindowActivate
# event found: AppEvents_WindowDeactivate
# event found: AppEvents_SheetFollowHyperlink
# event found: AppEvents_SheetPivotTableUpdate
# event found: AppEvents_WorkbookPivotTableCloseConnection
# event found: AppEvents_WorkbookPivotTableOpenConnection
# event found: AppEvents_WorkbookSync
# event found: AppEvents_WorkbookBeforeXmlImport
# event found: AppEvents_WorkbookAfterXmlImport
# event found: AppEvents_WorkbookBeforeXmlExport
# event found: AppEvents_WorkbookAfterXmlExport
# event found: AppEvents_WorkbookRowsetComplete
# event found: AppEvents_AfterCalculate
# event found: AppEvents_SheetPivotTableAfterValueChange
# event found: AppEvents_SheetPivotTableBeforeAllocateChanges
# event found: AppEvents_SheetPivotTableBeforeCommitChanges
# event found: AppEvents_SheetPivotTableBeforeDiscardChanges
# event found: AppEvents_ProtectedViewWindowOpen
# event found: AppEvents_ProtectedViewWindowBeforeEdit
# event found: AppEvents_ProtectedViewWindowBeforeClose
# event found: AppEvents_ProtectedViewWindowResize
# event found: AppEvents_ProtectedViewWindowActivate
# event found: AppEvents_ProtectedViewWindowDeactivate
# event found: AppEvents_WorkbookAfterSave
# event found: AppEvents_WorkbookNewChart
# event found: AppEvents_SheetLensGalleryRenderComplete
# event found: AppEvents_SheetTableUpdate
# event found: AppEvents_WorkbookModelChange
# event found: AppEvents_SheetBeforeDelete
# event found: AppEvents_WorkbookBeforeRemoteChange
# event found: AppEvents_WorkbookAfterRemoteChange
# event found: AppEvents_RemoteSheetChange
# event found: AppEvents_RemoteWorkbookNewSheet
# event found: AppEvents_RemoteWorkbookNewChart
# event found: AppEvents_RemoteSheetBeforeDelete
# event found: AppEvents_RemoteSheetPivotTableUpdate
>>> client.PumpEvents(10)
Event AppEvents_WindowResize(None, <POINTER(_Workbook) ptr=0x26e782cd528 at 26e791483d0>, <POINTER(Window) ptr=0x26e782cd838 at 26e791482d0>)
Event AppEvents_SheetSelectionChange(None, <POINTER(_Worksheet) ptr=0x26e77f831b8 at 26e791485d0>, <POINTER(Range) ptr=0x26e77f83bc8 at 26e791481d0>)
Event AppEvents_SheetSelectionChange(None, <POINTER(_Worksheet) ptr=0x26e764aa8c8 at 26e791484d0>, <POINTER(Range) ptr=0x26e764aa548 at 26e791482d0>)
Event AppEvents_NewWorkbook(None, <POINTER(_Workbook) ptr=0x26e78233bb8 at 26e79148450>)
Event AppEvents_WindowDeactivate(None, <POINTER(_Workbook) ptr=0x26e764aa938 at 26e791483d0>, <POINTER(Window) ptr=0x26e764aa4d8 at 26e791485d0>)
Event AppEvents_WorkbookDeactivate(None, <POINTER(_Workbook) ptr=0x26e782345c8 at 26e79148650>)
Event AppEvents_WorkbookActivate(None, <POINTER(_Workbook) ptr=0x26e764aa158 at 26e791484d0>)
Event AppEvents_WindowActivate(None, <POINTER(_Workbook) ptr=0x26e78233ec8 at 26e79148150>, <POINTER(Window) ptr=0x26e78234788 at 26e791483d0>)

@junkmd junkmd added this to the 1.4.10 milestone Jan 25, 2025
@junkmd junkmd merged commit b69e922 into enthought:main Jan 25, 2025
50 checks passed
Copy link
Collaborator

@junkmd junkmd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

junkmd added a commit to junkmd/pywinauto that referenced this pull request Jan 25, 2025
@junkmd junkmd linked an issue Jan 25, 2025 that may be closed by this pull request
@moi15moi moi15moi deleted the Use-WinDLL/OleDLL-for-events branch January 25, 2025 13:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants