|
ocx确实是一个带有争议的问题。如果使用ocx,则免注册会变得非常的麻烦。但如果不用ocx,设计界面时的控件的拖放,则又是另一个麻烦的事。这是一个两难的选择。
如果使用ATL方式可以直接免注册ocx,但ATL是采用invoke的方式,这种方式下,vb的原则会被破坏得面目全非。
这是一段在FB下,采用invoke方式对Recordset的封装。如果不看注释的话,你根本无从知道,这代码是在说什么。
Type _Recordset
QueryInterface As tMember = (1610612736,2,2,1) ' As Function(riid As GUID Ptr,ppvObj As any ptr Ptr Ptr) As any ptr
AddRef As tMember = (1610612737,2,0,1) ' As Function() As Uinteger
Release As tMember = (1610612738,2,0,1) ' As Function() As Uinteger
GetTypeInfoCount As tMember = (1610678272,2,1,1) ' As Function(pctinfo As Uinteger Ptr) As any ptr
GetTypeInfo As tMember = (1610678273,2,3,1) ' As Function(itinfo As Uinteger,lcid As Uinteger,pptinfo As any ptr Ptr Ptr) As any ptr
GetIDsOfNames As tMember = (1610678274,2,5,1) ' As Function(riid As GUID Ptr,rgszNames As Byte Ptr Ptr,cNames As Uinteger,lcid As Uinteger,rgdispid As Integer Ptr) As any ptr
Invoke As tMember = (1610678275,2,8,1) ' As Function(dispidMember As Integer,riid As GUID Ptr,lcid As Uinteger,wFlags As Ushort,pdispparams As DISPPARAMS Ptr,pvarResult As VARIANT Ptr,pexcepinfo As EXCEPINFO Ptr,puArgErr As Uinteger Ptr) As any ptr
getProperties As tMember = (500,2,0,2) ' As Function() As Properties Ptr
getAbsolutePosition As tMember = (1000,2,0,2) ' As Function() As PositionEnum_Param
putAbsolutePosition As tMember = (1000,2,1,4) ' As Function( As PositionEnum_Param) As any ptr
setActiveConnection As tMember = (1001,2,1,8) ' As Function( As LPDISPATCH) As any ptr
putActiveConnection As tMember = (1001,2,1,4) ' As Function( As VARIANT) As any ptr
getActiveConnection As tMember = (1001,2,0,2) ' As Function() As VARIANT
getBOF As tMember = (1002,2,0,2) ' As Function() As BOOL
getBookmark As tMember = (1003,2,0,2) ' As Function() As VARIANT
putBookmark As tMember = (1003,2,1,4) ' As Function( As VARIANT) As any ptr
getCacheSize As tMember = (1004,2,0,2) ' As Function() As Integer
putCacheSize As tMember = (1004,2,1,4) ' As Function( As Integer) As any ptr
getCursorType As tMember = (1005,2,0,2) ' As Function() As CursorTypeEnum
putCursorType As tMember = (1005,2,1,4) ' As Function( As CursorTypeEnum) As any ptr
getEOF As tMember = (1006,2,0,2) ' As Function() As BOOL
getFields As tMember = (0,2,0,2) ' As Function() As Fields Ptr
getLockType As tMember = (1008,2,0,2) ' As Function() As LockTypeEnum
putLockType As tMember = (1008,2,1,4) ' As Function( As LockTypeEnum) As any ptr
getMaxRecords As tMember = (1009,2,0,2) ' As Function() As ADO_LONGPTR
putMaxRecords As tMember = (1009,2,1,4) ' As Function( As ADO_LONGPTR) As any ptr
getRecordCount As tMember = (1010,2,0,2) ' As Function() As ADO_LONGPTR
setSource As tMember = (1011,2,1,8) ' As Function( As LPDISPATCH) As any ptr
putSource As tMember = (1011,2,1,4) ' As Function( As BSTR) As any ptr
getSource As tMember = (1011,2,0,2) ' As Function() As VARIANT
AddNew As tMember = (1012,2,10,1) ' As Function(FieldList As VARIANT=Type(0,0,0,0,0),Values As VARIANT=Type(0,0,0,0,0)) As any ptr
CancelUpdate As tMember = (1013,2,0,1) ' As Function() As any ptr
Close As tMember = (1014,2,0,1) ' As Function() As any ptr
Delete As tMember = (1015,2,1,1) ' As Function(AffectRecords As AffectEnum=1) As any ptr
GetRows As tMember = (1016,2,11,1) ' As Function(Rows As Integer=-1,Start As VARIANT=Type(0,0,0,0,0),Fields As VARIANT=Type(0,0,0,0,0)) As VARIANT
Move As tMember = (1017,2,6,1) ' As Function(NumRecords As ADO_LONGPTR,Start As VARIANT=Type(0,0,0,0,0)) As any ptr
MoveNext As tMember = (1018,2,0,1) ' As Function() As any ptr
MovePrevious As tMember = (1019,2,0,1) ' As Function() As any ptr
MoveFirst As tMember = (1020,2,0,1) ' As Function() As any ptr
MoveLast As tMember = (1021,2,0,1) ' As Function() As any ptr
Open As tMember = (1022,2,13,1) ' As Function(Source As VARIANT=Type(0,0,0,0,0),ActiveConnection As VARIANT=Type(0,0,0,0,0),CursorType As CursorTypeEnum=-1,LockType As LockTypeEnum=-1,Options As Integer=-1) As any ptr
Requery As tMember = (1023,2,1,1) ' As Function(Options As Integer=-1) As any ptr
_xResync As tMember = (1610809378,2,1,1) ' As Function(AffectRecords As AffectEnum=3) As any ptr
Update As tMember = (1025,2,10,1) ' As Function(Fields As VARIANT=Type(0,0,0,0,0),Values As VARIANT=Type(0,0,0,0,0)) As any ptr
getAbsolutePage As tMember = (1047,2,0,2) ' As Function() As PositionEnum_Param
putAbsolutePage As tMember = (1047,2,1,4) ' As Function( As PositionEnum_Param) As any ptr
getEditMode As tMember = (1026,2,0,2) ' As Function() As EditModeEnum
getFilter As tMember = (1030,2,0,2) ' As Function() As VARIANT
putFilter As tMember = (1030,2,1,4) ' As Function( As VARIANT) As any ptr
getPageCount As tMember = (1050,2,0,2) ' As Function() As ADO_LONGPTR
getPageSize As tMember = (1048,2,0,2) ' As Function() As Integer
putPageSize As tMember = (1048,2,1,4) ' As Function( As Integer) As any ptr
getSort As tMember = (1031,2,0,2) ' As Function() As BSTR
putSort As tMember = (1031,2,1,4) ' As Function( As BSTR) As any ptr
getStatus As tMember = (1029,2,0,2) ' As Function() As Integer
getState As tMember = (1054,2,0,2) ' As Function() As Integer
_xClone As tMember = (1610809392,2,0,1) ' As Function() As _Recordset Ptr
UpdateBatch As tMember = (1035,2,1,1) ' As Function(AffectRecords As AffectEnum=3) As any ptr
CancelBatch As tMember = (1049,2,1,1) ' As Function(AffectRecords As AffectEnum=3) As any ptr
getCursorLocation As tMember = (1051,2,0,2) ' As Function() As CursorLocationEnum
putCursorLocation As tMember = (1051,2,1,4) ' As Function( As CursorLocationEnum) As any ptr
NextRecordset As tMember = (1052,2,1,1) ' As Function(RecordsAffected As VARIANT Ptr=0) As _Recordset Ptr
Supports As tMember = (1036,2,1,1) ' As Function(CursorOptions As CursorOptionEnum) As BOOL
getCollect As tMember = (-8,2,1,2) ' As Function(Index As VARIANT) As VARIANT
putCollect As tMember = (-8,2,2,4) ' As Function(Index As VARIANT, As VARIANT) As any ptr
getMarshalOptions As tMember = (1053,2,0,2) ' As Function() As MarshalOptionsEnum
putMarshalOptions As tMember = (1053,2,1,4) ' As Function( As MarshalOptionsEnum) As any ptr
Find As tMember = (1058,2,8,1) ' As Function(Criteria As BSTR,SkipRecords As ADO_LONGPTR=0,SearchDirection As SearchDirectionEnum=1,Start As VARIANT=Type(0,0,0,0,0)) As any ptr
Cancel As tMember = (1055,2,0,1) ' As Function() As any ptr
getDataSource As tMember = (1056,2,0,2) ' As Function() As LPUNKNOWN
setDataSource As tMember = (1056,2,1,8) ' As Function( As LPUNKNOWN) As any ptr
_xSave As tMember = (1610874883,2,2,1) ' As Function(FileName As BSTR=0,PersistFormat As PersistFormatEnum=0) As any ptr
getActiveCommand As tMember = (1061,2,0,2) ' As Function() As LPDISPATCH
putStayInSync As tMember = (1063,2,1,4) ' As Function( As BOOL) As any ptr
getStayInSync As tMember = (1063,2,0,2) ' As Function() As BOOL
GetString As tMember = (1062,2,5,1) ' As Function(StringFormat As StringFormatEnum=2,NumRows As Integer=-1,ColumnDelimeter As BSTR=0,RowDelimeter As BSTR=0,NullExpr As BSTR=0) As BSTR
getDataMember As tMember = (1064,2,0,2) ' As Function() As BSTR
putDataMember As tMember = (1064,2,1,4) ' As Function( As BSTR) As any ptr
CompareBookmarks As tMember = (1065,2,2,1) ' As Function(Bookmark1 As VARIANT,Bookmark2 As VARIANT) As CompareEnum
Clone As tMember = (1034,2,1,1) ' As Function(LockType As LockTypeEnum=-1) As _Recordset Ptr
Resync As tMember = (1024,2,2,1) ' As Function(AffectRecords As AffectEnum=3,Values As Enum=2) As any ptr
Seek As tMember = (1066,2,2,1) ' As Function(KeyValues As VARIANT,Option As Enum=1) As any ptr
putIndex As tMember = (1067,2,1,4) ' As Function( As BSTR) As any ptr
getIndex As tMember = (1067,2,0,2) ' As Function() As BSTR
Save As tMember = (1057,2,6,1) ' As Function(Destination As VARIANT=Type(0,0,0,0,0),PersistFormat As PersistFormatEnum=0) As any ptr
pMark As Integer = -1
pThis As Integer
End Type ' _Recordset
|
|