[Bruce Peterson wrote]
> The ActiveState documentation discusses how to use the Windows api using
> modules such as win32api. However other methods, in particular
> CreateCompatibleBitmap, are shown as being a PyCDgiObject with no
> indication of what module these methods are in. They're not in win32gui --
> which would be my first guess. Has anyone worked with this or can point to
> where the module with these Win32 methods might reside?
The only attributes and methods in PyWin32-land that include "bitmap"
(that I can find) are the following:
D:\>pywin32where Bitmap
Found approximate match: 'win32clipboard.CF_BITMAP'.
Found approximate match: 'win32clipboard.CF_DSPBITMAP'.
Found approximate match: 'win32gui.IMAGE_BITMAP'.
Found approximate match: 'win32con.BS_BITMAP'.
Found approximate match: 'win32con.CF_BITMAP'.
Found approximate match: 'win32con.CF_DSPBITMAP'.
Found approximate match: 'win32con.DCTT_BITMAP'.
Found approximate match: 'win32con.DMTT_BITMAP'.
Found approximate match: 'win32con.DST_BITMAP'.
Found approximate match: 'win32con.GGO_BITMAP'.
Found approximate match: 'win32con.IMAGE_BITMAP'.
Found approximate match: 'win32con.MFT_BITMAP'.
Found approximate match: 'win32con.MF_BITMAP'.
Found approximate match: 'win32con.MF_USECHECKBITMAPS'.
Found approximate match: 'win32con.MIIM_BITMAP'.
Found approximate match: 'win32con.OBJ_BITMAP'.
Found approximate match: 'win32con.RC_BITMAP64'.
Found approximate match: 'win32con.RC_DI_BITMAP'.
Found approximate match: 'win32con.RC_SAVEBITMAP'.
Found approximate match: 'win32con.RT_BITMAP'.
Found approximate match: 'win32con.SS_BITMAP'.
Found approximate match: 'win32ui.CreateBitmap'.
Found approximate match: 'win32ui.CreateBitmapFromHandle'.
No "CreateCompatibleBitmap". There are many Win32 API methods that are
not implemented in PyWin32 (Mark Hammond is always accepting patches,
though. :)
I have attached the little 'pywin32where' script that I use to track
down methods and attributes in PyWin32.
Cheers,
Trent
--
Trent Mick
[EMAIL PROTECTED]
"""
Find a symbol in PyWin32-land.
Usage:
python pywin32where.py [<symbols>...]
This will print the full import path to the given symbol.
Approximate matches are printed on
"""
#TODO:
# - add my standard command line options: -h, -v, etc.
from __future__ import generators
import os
import sys
gModules = ["odbc",
"perfmon",
"pywintypes",
#XXX Dunno about this one.
#"servicemanager",
"win2kras",
"win32api",
"win32clipboard",
"win32event",
"win32evtlog",
"win32file",
"win32gui",
"win32help",
"win32lz",
"win32net",
"win32pdh",
"win32pipe",
"win32print",
"win32process",
"win32ras",
"win32security",
"win32service",
"win32wnet",
"win32con",
#"wincerapi", # ActivePython does not include this.
#XXX Dunno about these:
#"IADsContainer",
#"IADsUser",
#"IDirectoryObject",
"win32com.axcontrol",
"win32com.axdebug",
"win32com.axscript",
"win32com.shell",
"win32com.shell.shell",
"win32com.shell.shellcon",
#XXX Dunno about these two.
#"win32com.exchange",
#"win32com.exchdapi",
"win32com.internet",
"win32com.mapi",
"pythoncom",
"win32com.shell",
"win32ui",
"win32uiole",
"dde", # has to be imported after 'win32ui'
]
def _getObject(importPath):
parts = importPath.split('.')
if len(parts) == 1:
module = __import__(parts[0])
return module
else:
module = __import__('.'.join(parts[:-1]), globals(), locals(),
parts[-1:])
return getattr(module, parts[-1])
def where(symbol):
"""Return the full Python import path to the given symbol in
PyWin32-land."""
global gModules
for moduleName in gModules:
module = _getObject(moduleName)
if symbol in dir(module):
yield module.__name__ + '.' + symbol
for s in dir(module):
approx = None
if s.lower().find( symbol.lower() ) != -1 and s != symbol:
approx = module.__name__ + '.' + s
elif symbol.lower().find( s.lower() ) != -1 and s != symbol:
approx = module.__name__ + '.' + s
if approx is not None and approx != symbol:
sys.stderr.write("Found approximate match: '%s'.\n"\
% approx)
def main(argv):
for arg in argv[1:]:
for result in where(arg):
print result
if __name__ == "__main__":
sys.exit( main(sys.argv) )