Hi,

I have modified the test_showevents.py with the following code:
def test(self):
        o = comtypes.client.GetActiveObject("Word.Application")
        o.Visible = 1
        toolbar = o.CommandBars("Standard")
        print toolbar
        
comtypes.client.GetModule(os.path.join(os.environ["CommonProgramFiles"], 
r"Microsoft Shared\OFFICE11\MSO.dll"))
        from comtypes.gen import Office
        print Office.CommandBars, Office.CommandBarControl   
        while 1:
            conn = comtypes.client.ShowEvents(toolbar)
    
            self.pump_messages_with_timeout(1000)
    
            stream = sys.stdout
            stream.flush()
            sys.stdout = self.old_stdout
            try:
                output = stream.getvalue().splitlines()
                print "output is: "
                print output
            except:
                pass


but I get the following error :

Traceback (most recent call last):
  File "D:\Test\test.py", line 78, in test
    conn = comtypes.client.ShowEvents(toolbar)
  File "c:\Python24\lib\site-packages\comtypes\client\_events.py", line 207, in
ShowEvents
    return comtypes.client.GetEvents(source, sink=EventDumper(), interface=inter
face)
  File "c:\Python24\lib\site-packages\comtypes\client\_events.py", line 180, in
GetEvents
    interface = FindOutgoingInterface(source)
  File "c:\Python24\lib\site-packages\comtypes\client\_events.py", line 97, in F
indOutgoingInterface
    raise TypeError("cannot determine source interface")
TypeError: cannot determine source interface

Is it possible to get events generated by the toolbar?

Thanks a million.
Radu.

I 





__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
comtypes-users mailing list
comtypes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/comtypes-users

Reply via email to