Interfaces are definitely different and cannot be used with IDispatch, etc.

Someone with more experience might be able to direct you to something, but as 
far as I know, that’s reserved for C++ (or likely ctypes in python…  but that’s 
on the fringe of what I’m capable of helping with – and completely outside the 
scope of the pywin32 module).

But to make it more clear..  ctypes is how python can call things like that C++ 
code, but my one endeavor into that space was a VERY long and frustrating road 
as making sure that all the prerequisite data structures were created (and 
defined correctly) was a daunting task, and someone ended up figuring it out 
for me – as I was totally missing different structures that needed to be 
defined (it was for some data from Terminal Server that is not publicly 
supported – but totally capable of being read from Windows).

HTH

Steven
From: python-win32 <python-win32-bounces+steven=manross....@python.org> On 
Behalf Of name zero via python-win32
Sent: Tuesday, May 30, 2023 10:32 PM
To: python-win32@python.org
Subject: Re: [python-win32] Setting Focus Assist Mode via COM

Hi,

thanks for explaining the issue with clsids.

The "application" is basically part of MS Windows. Talking to it via COM is 
100% possible, as the C++ code (that is part of the GitHub-Gist) 
demonstrates<https://gist.github.com/riverar/085d98ffb1343e92225a10817109b2e3#file-quiethours_example-cpp-L23>.
 It just doesn't work with pywin32.

When I look for "6bff4732-81ec-4ffb-ae67-b6c1bc29631f" in the Windows registry, 
I only find an entry in "HKEY_CLASSES_ROOT\Interface" (there is no entry in 
HKEY_CLASSES_ROOT\clsid) with a default value of  "IQuietHoursSettings". But 
win32com.client.Dispatch('IQuietHoursSettings') fails with the error message 
"Invalid class string".

Best regards!


On Tuesday, May 30, 2023 at 11:41:25 PM GMT+2, Steven Manross 
<ste...@manross.net<mailto:ste...@manross.net>> wrote:



While I haven’t worked on exactly what you are working on:



I’d first verify suggest that the application that installs this class needs to 
be installed on the PC you are trying to create the automation from, because 
“Class not Registered” isn’t a python error, and it talks more directly to the 
fact that the appropriate class from the software you are trying to automate 
isn’t on the computer you are running python from: so either you have the wrong 
CLSID or are doing something else wrong (missing software???).



Classes are listed in the registry here:



HKEY_CLASSES_ROOT\clsid\{6bff4732-81ec-4ffb-ae67-b6c1bc29631f}

… and your CLSID would need to exist (as installed from whatever software you 
are trying to automate) prior to python being able to automate it.



Here is an example that should work on your system…



ms_dict = win32com.client.Dispatch('Scripting.Dictionary')



… because the scripting dictionary object class is installed in just about 
every Windows OS since pre-WindowsXP



I hope this helps.  Enjoy your day.



Steven

From: python-win32 
<python-win32-bounces+steven=manross....@python.org<mailto:python-win32-bounces+steven=manross....@python.org>>
 On Behalf Of name zero via python-win32
Sent: Monday, May 29, 2023 6:02 AM
To: python-win32@python.org<mailto:python-win32@python.org>
Subject: [python-win32] Setting Focus Assist Mode via COM



Hi,



could someone help me out with first steps for how to set Focus Assist via COM, 
which https://gist.github.com/riverar/085d98ffb1343e92225a10817109b2e3 
demonstrates for a C++ code base? Something like



win32com.client.Dispatch('{6bff4732-81ec-4ffb-ae67-b6c1bc29631f}', 
clsctx=pythoncom.CLSCTX_LOCAL_SERVER)



fails with "pywintypes.com_error: (-2147221164, 'Class not registered', None, 
None)"



Thank you and best regards!
_______________________________________________
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32

Reply via email to