[pywin32-bugs] [ pywin32-Bugs-2787182 ] Implement a com server with a undocument interface
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: SourceForge.net <no...@so...> - 2009-05-05 23:46:35
|
Bugs item #2787182, was opened at 2009-05-05 21:14 Message generated for change (Comment added) made by mhammond You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=551954&aid=2787182&group_id=78018 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: com Group: None >Status: Closed >Resolution: Invalid Priority: 5 Private: No Submitted By: winterTTr (winterttr) Assigned to: Nobody/Anonymous (nobody) Summary: Implement a com server with a undocument interface Initial Comment: I want to use the win32com to implement a com server with the function to display custum inoformation when i move mouse over a txt file in explorer on windows. I search for the method to do this and found a com interface which i can't find it in the current win32com library. It is "IQueryInfo" , and my code as this : ********************************** begin *********************************** import pythoncom from win32com.shell import shell, shellcon import win32gui import win32con import os import winerror from win32com.server.exception import COMException from pywintypes import IID IPersistFile_Methods = "IsDirty Load Save SaveCompleted GetCurFile".split() IID_IQueryInfo = "{00021500-0000-0000-C000-000000000046}" IQueryInfo_Methods = ["GetInfoFlags","GetInfoTip"] class ShellExtension: _reg_progid_ = "ShellExtension.winterTTr" _reg_desc_ = "Shell Extension from winterTTr" _reg_clsid_ = "{EB0D2B97-287A-4B91-A455-D2E021B894AC}" _com_interfaces_ = [ pythoncom.IID_IPersistFile, IID(IID_IQueryInfo)] _public_methods_ = IPersistFile_Methods + IQueryInfo_Methods # =============== IPersistFile : from ====================== def GetInfoFlags(self , Flags ): #raise COMException(desc="No Implemented",scode=winerror.E_NOTIMPL) raise COMException(hresult=winerror.E_NOTIMPL) def GetInfoTip(self , flags ): print flags print "======== GetInfoTip ===========" return "" # =============== IPersistFile : to ====================== # =============== IPersistFile : from ====================== def IsDirty( self ): raise COMException(hresult=winerror.E_NOTIMPL) def Load(self, filename, mode): #self.filename = filename #self.mode = mode print filename def Save( self ,FileName, Remember): raise COMException(hresult=winerror.E_NOTIMPL) def SaveCompleted( self , pszFileName): raise COMException(hresult=winerror.E_NOTIMPL) def GetCurFile( self ): raise COMException(hresult=winerror.E_NOTIMPL) # =============== IPersistFile : to ====================== def DllRegisterServer(): # add to txt type key = _winreg.CreateKey( _winreg.HKEY_CLASSES_ROOT, ".txt\\shellex") subkey = _winreg.CreateKey(key, IID_IQueryInfo) _winreg.SetValueEx(subkey, None, 0, _winreg.REG_SZ, ShellExtension._reg_clsid_) print ShellExtension._reg_desc_, "registration [txt file] complete." def DllUnregisterServer(): # remove txt type try: key = _winreg.DeleteKey( _winreg.HKEY_CLASSES_ROOT, ".txt\\shellex\\%s" % IID_IQueryInfo ) except WindowsError, details: import errno if details.errno != errno.ENOENT: raise print ShellExtension._reg_desc_, "unregistration [txt file] complete." if __name__=='__main__': from win32com.server import register register.UseCommandLine(ShellExtension , finalize_register = DllRegisterServer, finalize_unregister = DllUnregisterServer) ***************************end********************************* and my question is : can i use IQueryInfo IID directly which i can't find it in pywin32com? or is there anything wrong with my coding ? PS: now the function "Load" can be invoked ( which i can see it in from win32traceutil.py when i register the server with --debug option ) but the "GetInfoTip" is not called at all. ---------------------------------------------------------------------- >Comment By: Mark Hammond (mhammond) Date: 2009-05-06 09:46 Message: Sorry but this tracker is for reporting bugs, not for general usage questions. . You might like to resend your question to the python-win32 mailing list. You need to be subscribed to the list before you can post to it - see http://mail.python.org/mailman/listinfo/python-win32 for subscription options. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=551954&aid=2787182&group_id=78018 |