makepy.py會彈出視窗,選擇要使用的組件后會生成一些檔案
__pycache__ 檔案夾
__init__.py
2206CEB0-19C1-11D1-89E0-00C04FD7A829x0x1x0.py像是用CLID命名的
dicts.dat 不知道干什么用
問題是這個怎么使用,有例子沒有?我把名字最長的改名放到目錄里,用里面的類都是錯誤,網上搜索的全是相互抄的東西,沒干貨
最好能有個例子
附上中間層生成的代碼,這里能看出來函式都是組件的
# -*- coding: mbcs -*-
# Created by makepy.py version 0.5.01
# By python version 3.5.4 (v3.5.4:3f56838, Aug 8 2017, 02:07:06) [MSC v.1900 32 bit (Intel)]
# From type library 'oledb32.dll'
# On Wed Aug 30 13:28:14 2017
'Microsoft OLE DB Service Component 1.0 Type Library'
makepy_version = '0.5.01'
python_version = 0x30504f0
import win32com.client.CLSIDToClass, pythoncom, pywintypes
import win32com.client.util
from pywintypes import IID
from win32com.client import Dispatch
# The following 3 lines may need tweaking for the particular server
# Candidates are pythoncom.Missing, .Empty and .ArgNotFound
defaultNamedOptArg=pythoncom.Empty
defaultNamedNotOptArg=pythoncom.Empty
defaultUnnamedArg=pythoncom.Empty
CLSID = IID('{2206CEB0-19C1-11D1-89E0-00C04FD7A829}')
MajorVersion = 1
MinorVersion = 0
LibraryFlags = 8
LCID = 0x0
from win32com.client import DispatchBaseClass
class IDataSourceLocator(DispatchBaseClass):
'Microsoft OLE DB Service Component Automation Interface'
CLSID = IID('{2206CCB2-19C1-11D1-89E0-00C04FD7A829}')
coclass_clsid = IID('{2206CDB2-19C1-11D1-89E0-00C04FD7A829}')
def PromptEdit(self, ppADOConnection=defaultNamedNotOptArg):
'PromptEdit'
return self._ApplyTypes_(1610743811, 1, (11, 0), ((16393, 3),), 'PromptEdit', None,ppADOConnection
)
def PromptNew(self):
'PromptNew'
ret = self._oleobj_.InvokeTypes(1610743810, LCID, 1, (9, 0), (),)
if ret is not None:
ret = Dispatch(ret, 'PromptNew', None)
return ret
_prop_map_get_ = {
"hWnd": (1610743808, 2, (3, 0), (), "hWnd", None),
}
_prop_map_put_ = {
"hWnd": ((1610743808, LCID, 4, 0),()),
}
def __iter__(self):
"Return a Python iterator for this object"
try:
ob = self._oleobj_.InvokeTypes(-4,LCID,3,(13, 10),())
except pythoncom.error:
raise TypeError("This object does not support enumeration")
return win32com.client.util.Iterator(ob, None)
from win32com.client import CoClassBaseClass
# This CoClass is known by the name 'DataLinks'
class DataLinks(CoClassBaseClass): # A CoClass
# Microsoft OLE DB Service Component Data Link
CLSID = IID('{2206CDB2-19C1-11D1-89E0-00C04FD7A829}')
coclass_sources = [
]
coclass_interfaces = [
IDataSourceLocator,
]
default_interface = IDataSourceLocator
# This CoClass is known by the name 'MSDASC.MSDAINITIALIZE.1'
class MSDAINITIALIZE(CoClassBaseClass): # A CoClass
# Microsoft OLE DB Service Component Initialization Component
CLSID = IID('{2206CDB0-19C1-11D1-89E0-00C04FD7A829}')
coclass_sources = [
]
coclass_interfaces = [
]
# This CoClass is known by the name 'MSDASC.PDPO.1'
class PDPO(CoClassBaseClass): # A CoClass
# Persisted Datasource/Pooling Object
CLSID = IID('{CCB4EC60-B9DC-11D1-AC80-00A0C9034873}')
coclass_sources = [
]
coclass_interfaces = [
]
# This CoClass is known by the name 'MSDAURL.Binder.1'
class RootBinder(CoClassBaseClass): # A CoClass
# Microsoft OLE DB Root Binder
CLSID = IID('{FF151822-B0BF-11D1-A80D-000000000000}')
coclass_sources = [
]
coclass_interfaces = [
]
IAuthenticate_vtables_dispatch_ = 0
IAuthenticate_vtables_ = [
(( 'Authenticate' , 'phwnd' , 'pszUsername' , 'pszPassword' , ), 1610678272, (1610678272, (), [
(36, 2, None, None) , (16415, 2, None, None) , (16415, 2, None, None) , ], 1 , 1 , 4 , 0 , 12 , (3, 0, None, None) , 0 , )),
]
IBindResource_vtables_dispatch_ = 0
IBindResource_vtables_ = [
(( 'RemoteBind' , 'pUnkOuter' , 'pwszURL' , 'dwBindURLFlags' , 'rguid' ,
'riid' , 'pAuthenticate' , 'pSessionUnkOuter' , 'piid' , 'ppSession' ,
'pdwBindStatus' , 'ppUnk' , ), 1610678272, (1610678272, (), [ (13, 1, None, None) , (31, 1, None, None) ,
(19, 1, None, None) , (36, 1, None, None) , (36, 1, None, None) , (13, 1, None, "IID('{79EAC9D0-BAF9-11CE-8C82-00AA004BA90B}')") , (13, 1, None, None) ,
(36, 1, None, None) , (16397, 3, None, None) , (16403, 3, None, None) , (16397, 2, None, None) , ], 1 , 1 , 4 , 0 , 12 , (3, 0, None, None) , 0 , )),
]
ICreateRow_vtables_dispatch_ = 0
ICreateRow_vtables_ = [
(( 'RemoteCreateRow' , 'pUnkOuter' , 'pwszURL' , 'dwBindURLFlags' , 'rguid' ,
'riid' , 'pAuthenticate' , 'pSessionUnkOuter' , 'piid' , 'ppSession' ,
'pdwBindStatus' , 'ppwszNewURL' , 'ppUnk' , ), 1610678272, (1610678272, (), [ (13, 1, None, None) ,
(31, 1, None, None) , (19, 1, None, None) , (36, 1, None, None) , (36, 1, None, None) , (13, 1, None, "IID('{79EAC9D0-BAF9-11CE-8C82-00AA004BA90B}')") ,
(13, 1, None, None) , (36, 1, None, None) , (16397, 3, None, None) , (16403, 3, None, None) , (16415, 3, None, None) ,
(16397, 2, None, None) , ], 1 , 1 , 4 , 0 , 12 , (3, 0, None, None) , 0 , )),
]
IDBBinderProperties_vtables_dispatch_ = 0
IDBBinderProperties_vtables_ = [
(( 'Reset' , ), 1610743808, (1610743808, (), [ ], 1 , 1 , 4 , 0 , 24 , (3, 0, None, None) , 0 , )),
]
IDBPromptInitialize_vtables_dispatch_ = 0
IDBPromptInitialize_vtables_ = [
(( 'PromptDataSource' , 'pUnkOuter' , 'hWndParent' , 'dwPromptOptions' , 'cSourceTypeFilter' ,
'rgSourceTypeFilter' , 'pwszszzProviderFilter' , 'riid' , 'ppDataSource' , ), 1610678272, (1610678272, (), [
(13, 1, None, None) , (36, 1, None, None) , (19, 1, None, None) , (19, 1, None, None) , (16403, 1, None, None) ,
(31, 1, None, None) , (36, 1, None, None) , (16397, 3, None, None) , ], 1 , 1 , 4 , 0 , 12 , (3, 0, None, None) , 0 , )),
(( 'PromptFileName' , 'hWndParent' , 'dwPromptOptions' , 'pwszInitialDirectory' , 'pwszInitialFile' ,
'ppwszSelectedFile' , ), 1610678273, (1610678273, (), [ (36, 1, None, None) , (19, 1, None, None) , (31, 1, None, None) ,
(31, 1, None, None) , (16415, 2, None, None) , ], 1 , 1 , 4 , 0 , 16 , (3, 0, None, None) , 0 , )),
]
IDBProperties_vtables_dispatch_ = 0
IDBProperties_vtables_ = [
(( 'RemoteGetProperties' , 'cPropertyIDSets' , 'rgPropertyIDSets' , 'pcPropertySets' , 'prgPropertySets' ,
'ppErrorInfoRem' , ), 1610678272, (1610678272, (), [ (19, 1, None, None) , (36, 1, None, None) , (16403, 3, None, None) ,
(16420, 2, None, None) , (16397, 2, None, "IID('{1CF2B120-547D-101B-8E65-08002B2BD119}')") , ], 1 , 1 , 4 , 0 , 12 , (3, 0, None, None) , 0 , )),
(( 'RemoteGetPropertyInfo' , 'cPropertyIDSets' , 'rgPropertyIDSets' , 'pcPropertyInfoSets' , 'prgPropertyInfoSets' ,
'pcOffsets' , 'prgDescOffsets' , 'pcbDescBuffer' , 'ppDescBuffer' , 'ppErrorInfoRem' ,
), 1610678273, (1610678273, (), [ (19, 1, None, None) , (36, 1, None, None) , (16403, 3, None, None) , (16420, 2, None, None) ,
(16403, 3, None, None) , (16403, 2, None, None) , (16403, 3, None, None) , (16402, 3, None, None) , (16397, 2, None, "IID('{1CF2B120-547D-101B-8E65-08002B2BD119}')") , ], 1 , 1 , 4 , 0 , 16 , (3, 0, None, None) , 0 , )),
(( 'RemoteSetProperties' , 'cPropertySets' , 'rgPropertySets' , 'cTotalProps' , 'rgPropStatus' ,
'ppErrorInfoRem' , ), 1610678274, (1610678274, (), [ (19, 1, None, None) , (36, 1, None, None) , (19, 1, None, None) ,
(16403, 2, None, None) , (16397, 2, None, "IID('{1CF2B120-547D-101B-8E65-08002B2BD119}')") , ], 1 , 1 , 4 , 0 , 20 , (3, 0, None, None) , 0 , )),
]
IDataInitialize_vtables_dispatch_ = 0
IDataInitialize_vtables_ = [
(( 'GetDataSource' , 'pUnkOuter' , 'dwClsCtx' , 'pwszInitializationString' , 'riid' ,
'ppDataSource' , ), 1610678272, (1610678272, (), [ (13, 1, None, None) , (19, 1, None, None) , (31, 1, None, None) ,
(36, 1, None, None) , (16397, 3, None, None) , ], 1 , 1 , 4 , 0 , 12 , (3, 0, None, None) , 0 , )),
(( 'GetInitializationString' , 'pDataSource' , 'fIncludePassword' , 'ppwszInitString' , ), 1610678273, (1610678273, (), [
(13, 1, None, None) , (16, 1, None, None) , (16415, 2, None, None) , ], 1 , 1 , 4 , 0 , 16 , (3, 0, None, None) , 0 , )),
(( 'CreateDBInstance' , 'clsidProvider' , 'pUnkOuter' , 'dwClsCtx' , 'pwszReserved' ,
'riid' , 'ppDataSource' , ), 1610678274, (1610678274, (), [ (36, 1, None, None) , (13, 1, None, None) ,
(19, 1, None, None) , (31, 1, None, None) , (36, 1, None, None) , (16397, 2, None, None) , ], 1 , 1 , 4 , 0 , 20 , (3, 0, None, None) , 0 , )),
(( 'RemoteCreateDBInstanceEx' , 'clsidProvider' , 'pUnkOuter' , 'dwClsCtx' , 'pwszReserved' ,
'pServerInfo' , 'cmq' , 'rgpIID' , 'rgpItf' , 'rghr' ,
), 1610678275, (1610678275, (), [ (36, 1, None, None) , (13, 1, None, None) , (19, 1, None, None) , (31, 1, None, None) ,
(36, 1, None, None) , (19, 1, None, None) , (16420, 1, None, None) , (16397, 2, None, None) , (16387, 2, None, None) , ], 1 , 1 , 4 , 0 , 24 , (3, 0, None, None) , 0 , )),
(( 'LoadStringFromStorage' , 'pwszFileName' , 'ppwszInitializationString' , ), 1610678276, (1610678276, (), [ (31, 1, None, None) ,
(16415, 2, None, None) , ], 1 , 1 , 4 , 0 , 28 , (3, 0, None, None) , 0 , )),
(( 'WriteStringToStorage' , 'pwszFileName' , 'pwszInitializationString' , 'dwCreationDisposition' , ), 1610678277, (1610678277, (), [
(31, 1, None, None) , (31, 1, None, None) , (19, 1, None, None) , ], 1 , 1 , 4 , 0 , 32 , (3, 0, None, None) , 0 , )),
]
IDataSourceLocator_vtables_dispatch_ = 1
IDataSourceLocator_vtables_ = [
(( 'hWnd' , 'phwndParent' , ), 1610743808, (1610743808, (), [ (16387, 10, None, None) , ], 1 , 2 , 4 , 0 , 28 , (3, 0, None, None) , 0 , )),
(( 'hWnd' , 'phwndParent' , ), 1610743808, (1610743808, (), [ (3, 1, None, None) , ], 1 , 4 , 4 , 0 , 32 , (3, 0, None, None) , 0 , )),
(( 'PromptNew' , 'ppADOConnection' , ), 1610743810, (1610743810, (), [ (16393, 10, None, None) , ], 1 , 1 , 4 , 0 , 36 , (3, 0, None, None) , 0 , )),
(( 'PromptEdit' , 'ppADOConnection' , 'pbSuccess' , ), 1610743811, (1610743811, (), [ (16393, 3, None, None) ,
(16395, 10, None, None) , ], 1 , 1 , 4 , 0 , 40 , (3, 0, None, None) , 0 , )),
]
IErrorInfo_vtables_dispatch_ = 0
}
uj5u.com熱心網友回復:
大神,這個中間層的py檔案怎么生成的?makepy這個模塊怎么用啊!轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/44988.html
