国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > 綜合 > 正文

用VB6創建MTS組件(英,轉貼)

2024-07-21 02:15:40
字體:
來源:轉載
供稿:網友
'隨便貼貼,學過vb的人都應該知道的,不好意思。
'**********************************************************************************************
'                 mts vb6 com component template - by michael gonzalez
'**********************************************************************************************
'(1) you must create a reference to the microsoft transaction server type library (mtxas.dll).
'    if using windows 2000, choose the com+ services library (comsvcs.dll) instead.
'(2) set your classmodule's mtstransactionmode property to 2 - requirestransaction
'    note: only use 2 - requires transaction if you plan on using the component with an msdtc-
'    compliant resource manager such as msmq or sql server - otherwise, use
'    1 - no transactions
'(3) make sure your project's unattended execution property is checked
'(4) make sure your project's component version compatibility is set to binary compatibility
'**********************************************************************************************
'  objectcontrol implements the interface that is used by mts when the object is
'   activated and/or deactivated - this happens when you call one of the components's methods
'  the objectcontrol implementation makes use of three procedures:
'   1) objectcontrol_activate
'   2) objectcontrol_canbepooled
'   3) objectcontrol_deactivate
'**********************************************************************************************
implements objectcontrol

dim objoc as objectcontext

public sub something()
    'this is a user-defined procedure/method
    'the objectcontext object is returned by getobjectcontext
    
    on error goto abort
    
    '*******************************************************
    '       perform whatever you want in this area
    '       visual basic 6 stuff goes here
    '       the something() procedure/method is just
    '       an example - you may use properties and other
    '       methods/procedures as well!
    '*******************************************************
    
finished:
    objoc.setcomplete
        exit sub
abort:
    objoc.setabort
        err.raise err.number, err.source, err.description
        exit sub
end sub

private sub objectcontrol_activate()
    'mts invokes this procedure/method when the component/object is instantiated
    set objoc = getobjectcontext()
    exit sub
end sub

private function objectcontrol_canbepooled() as boolean
    'this enables mts object pooling (not currently supported my mts 2.0)
    objectcontrol_canbepooled = true
end function

private sub objectcontrol_deactivate()
    'mts invokes this procedure/method right before the component/object is released
    set objoc = nothing
    exit sub
end sub

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 墨江| 华池县| 漳州市| 博客| 电白县| 沧州市| 鸡西市| 金华市| 防城港市| 柳林县| 馆陶县| 岚皋县| 临潭县| 平果县| 旅游| 尼木县| 周口市| 吴川市| 朝阳市| 嵊州市| 方城县| 新营市| 淅川县| 荥经县| 长兴县| 广元市| 安庆市| 泗洪县| 淳化县| 万州区| 苍梧县| 溆浦县| 蒲城县| 福贡县| 陕西省| 牡丹江市| 商城县| 南木林县| 巧家县| 池州市| 隆安县|