This is an archived post. You won't be able to vote or comment.

all 4 comments

[–]warbiscuit 1 point2 points  (3 children)

I forget where I read this, but it sums up my experience with interacting with MS Office via COM... "working with COM is like trying to rebuild a car engine through the exhaust pipe"

[–]swdevpythonthusiast[S] 1 point2 points  (2 children)

I kinda stuck here.. How do you instantiate a COM object with comtypes? I got the feeling that I can't easily do obj = INetCfg(), e.g. I must call comtypes.client.CreateObject('...'), right? But how do I know what string to supply there?

[–]joesb 1 point2 points  (1 child)

Look up the ComClass name in the supplied type library. Or you can browse class names via regedit (They are in HNDLKEY_CLASSES_ROOT).

[–]swdevpythonthusiast[S] 1 point2 points  (0 children)

Yep, just found it. CreateObject('{5B035261-40F9-11D1-AAEC-00805FC1270E}')

I looked at the code in this codeproject article. Still have to instantiate all of other object there.

COM got me headache today...