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

IFolderView COM client #2181

Merged
merged 2 commits into from
Feb 20, 2024
Merged

IFolderView COM client #2181

merged 2 commits into from
Feb 20, 2024

Conversation

CristiFati
Copy link
Contributor

I was trying to correct [SO]: How to move desktop icons with python? (@CristiFati's answer), based on [SO]: How to move desktop icons using winapi on C? (@@IInspectable's answer) (which in turn is based on Raymond Chen's [MS.DevBlogs]: Manipulating the positions of desktop icons). All good till at one of the last steps:

folder_view = shell_view.QueryInterface(IID_IFolderView)

which failed because IFolderView is not wrapped by win32comext/shell/shell.pyd. So I investigated what needs to be done in order to add it, and found out about MakeGW. Unfortunately that seems no longer maintained (worked on a side quest: #2180), and the generated files need lots of interventions, so I (temporarily) abandoned this track.

Looking for alternatives (based on [SO]: Implementing a COM interface in Python (@@SimonMourier's answer)), I defined the interface and implementation in Python (using COMTypes), and do all kinds of attempts to register it with PythonCom (call functions from PyCom_RegisterClientType family in pythoncom310.dll), but I wasn;t successful, so I returned to the original approach.

Coming back to the 1st option, after modifying the script generator, and the generated code, I was able to get it working.

Notes:

  • Only the interface (client side) is implemented
  • 2 methods are missing (due to the nightmare of possibilities (in terms of arguments and return values))

But functionally, it's complete as the 2 missing methods can be worked around others.

@CristiFati CristiFati mentioned this pull request Feb 18, 2024
Copy link
Owner

@mhammond mhammond left a comment

Choose a reason for hiding this comment

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

This is great, thanks!

@mhammond mhammond merged commit 3987d6d into mhammond:main Feb 20, 2024
16 checks passed
@CristiFati CristiFati deleted the cfati_dev01 branch March 28, 2024 15:36
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