亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? mdlstorage.bas

?? 結構化存儲文件我們平時大量接觸的Word,Excel文件實際上都是結構化存儲文件
?? BAS
字號:
Attribute VB_Name = "mdlStorage"
'*********************************************************************************************
'
' DocumentProperties/Storage
'
' Support functions and declarations module
'
'*********************************************************************************************
'
' Author: Eduardo Morcillo
' E-Mail: edanmo@geocities.com
' Web Page: http://www.domaildlx.com/e_morcillo
'
' Created: 07/31/1999
' Updates:
'           08/12/1999. The comments were revised and enhaced.
'           08/02/1999. IsValidVariant was removed.
'           12/13/1999. Added 1 parameter to CreateFileStorage
'*********************************************************************************************

Option Explicit

Public FMTID_SummaryInformation As IID
Public FMTID_DocSummaryInformation As IID
Public FMTID_UserProperties As IID

Public FMTID_Init As Boolean

Public Declare Function lstrcpyA Lib "kernel32" (ByVal Dest As Any, Src As Any) As Long

Public Const CLSCTX_INPROC_SERVER = 1

Declare Function CoCreateInstance Lib "ole32" (rclsid As IID, ByVal pUnkOuter As Long, ByVal dwClsContext As Long, riid As IID, ppv As Object) As Long

Declare Function GetTempFileName Lib "kernel32" Alias "GetTempFileNameA" (ByVal lpPathName As String, ByVal lpPrefixString As String, ByVal uUnique As Long, ByVal lpTempFileName As String) As Long
Declare Function OleLoadPictureFile Lib "oleaut32" (ByVal varFileName As Variant, lplpdispPicture As Object) As Long

'*********************************************************************************************
'
' Creates the standar property sets in the given storage
'
' Parameters:
'
' Stg: source storage where the property set will be created.
' ANSI: indicates if properties are written in ANSI or Unicode. Default is ANSI.
'
' Returns: True if there's no error.
'
'*********************************************************************************************
Public Function CreatePropertySets(ByVal Stg As Storage, Optional ByVal ANSI As Boolean = True) As Boolean
Dim IPSS As IPropertySetStorage, FMTID As IID, Clsid As IID
Dim Flgs As Long

    On Error Resume Next
    
    ' Get IPropertySetStorage
    Set IPSS = Stg.Storage
    
    ' Set flags
    If ANSI Then
        Flgs = PROPSETFLAG_ANSI
    Else
        Flgs = PROPSETFLAG_DEFAULT
    End If
    
    ' Create SummaryInformation and
    ' DocumentSummaryInformation property
    ' storages
    IIDFromString FMTID_SummaryInformationStr, FMTID
    IPSS.create FMTID, Clsid, Flgs, STGM_CREATE Or STGM_READWRITE Or STGM_SHARE_EXCLUSIVE
    
    IIDFromString FMTID_DocSummaryInformationStr, FMTID
    IPSS.create FMTID, Clsid, Flgs, STGM_CREATE Or STGM_READWRITE Or STGM_SHARE_EXCLUSIVE
    
    IIDFromString FMTID_UserPropertiesStr, FMTID
    IPSS.create FMTID, Clsid, Flgs, STGM_CREATE Or STGM_READWRITE Or STGM_SHARE_EXCLUSIVE

    CreatePropertySets = Err.Number = 0
    
End Function

'*********************************************************************************************
'
' Opens an storage file
'
' Parameters:
'
' Filename: full path & name of the file
'
'*********************************************************************************************
Function OpenFileStorage(ByVal FileName As String) As Storage

    Set OpenFileStorage = New Storage
    
    Set OpenFileStorage.Storage = StgOpenStorage(FileName, , STGM_READWRITE Or STGM_SHARE_EXCLUSIVE)
    
End Function

'*********************************************************************************************
'
' Creates a new structured storage file
'
' Parameters:
'
' FileName: full path and name of the file
' CreatePropSets: automatically creates the standard property sets
' KillPrevious: deletes the any previous file with the same name
'
'*********************************************************************************************
Function CreateFileStorage(ByVal FileName As String, Optional CreatePropSets As Boolean = True, Optional ByVal ANSI As Boolean = True, Optional KillPrevious As Boolean = False) As Storage

    On Error Resume Next
    
    ' Create a new Storage object
    Set CreateFileStorage = New Storage
        
    ' Create storage file
    Set CreateFileStorage.Storage = StgCreateDocfile(FileName, STGM_READWRITE Or STGM_SHARE_EXCLUSIVE Or (-STGM_CREATE * KillPrevious))
    
    ' The storage file already
    ' exists
    If Err.Number = 58 Then
            
        ' Open the file
        Set CreateFileStorage.Storage = StgOpenStorage(FileName, , STGM_READWRITE Or STGM_SHARE_EXCLUSIVE)
        
        CreatePropSets = False
        
    End If
    
    If CreatePropSets Then CreatePropertySets CreateFileStorage, ANSI
    
End Function

'*********************************************************************************************
'
' Initializes FMTIDs from the FMTID strings
'
'*********************************************************************************************
Public Sub InitFMTIDs()

    FMTID_Init = True
    
    IIDFromString FMTID_SummaryInformationStr, FMTID_SummaryInformation
    IIDFromString FMTID_DocSummaryInformationStr, FMTID_DocSummaryInformation
    IIDFromString FMTID_UserPropertiesStr, FMTID_UserProperties

End Sub

'*********************************************************************************************
'
' Returns a String from a LPxSTR pointer
'
' Parameters:
'
' Ptr: pointer to the string
' FreeSource: If True the source string pointer if freed.
' Unicode: Indicates if the source string is Unicode or ANSI. Default is ANSI.
'
'*********************************************************************************************
Public Function Ptr2Str(Ptr As Long, Optional FreeSource As Boolean, Optional ByVal Unicode As Boolean) As String

    If Unicode Then
        
        ' The string is Unicode
        
        ' Get string length to initialize
        ' the string.
        Ptr2Str = String$(lstrlenW(Ptr), 0)
        
        ' Copy the string
        MoveMemory ByVal StrPtr(Ptr2Str), ByVal Ptr, Len(Ptr2Str) * 2
    
    Else
        
        ' Get string length to initialize
        ' the string.
        Ptr2Str = String$(lstrlenA(Ptr), 0)
        
        ' Copy the string
        lstrcpyA Ptr2Str, ByVal Ptr
        
    End If

    If FreeSource Then CoTaskMemFree Ptr: Ptr = 0
    
End Function

'*********************************************************************************************
'
' Converts a LPSTR or LPWSTR variant to String.
'
' Parameters:
'
' Var: source variant
'
'*********************************************************************************************
Public Function ToBSTR(Var As Variant) As String
Dim VType As Integer, Ptr As Long

    ' Get variant type
    VType = VarType(Var)
            
    If VType = VT_LPSTR Then
    
        ' ANSI String
        
        ' Get string pointer
        MoveMemory Ptr, ByVal VarPtr(Var) + 8, 4
    
        ' Copy string from pointer
        ToBSTR = Ptr2Str(Ptr, , False)
        
    ElseIf VType = VT_LPWSTR Then
        
        ' Unicode String
           
        ToBSTR = Ptr2Str(Ptr, , True)
        
    End If
    
    ' Clear the variant
    PropVariantClear Var
    
End Function

'*********************************************************************************************
'
' Converts a FILETIME variant to Date
'
' Parameters:
'
' Var: source variant
'
'*********************************************************************************************
Public Function ToDate(Var As Variant) As Date
Dim FT As Currency, ST As SYSTEMTIME, LocalFT As Currency
Dim Serial As Double

    ' Get FILETIME from variant
    MoveMemory FT, ByVal VarPtr(Var) + 8, Len(FT)
    
    ' Date properties are in UTC. Convert to
    ' Local time.
    FileTimeToLocalFileTime FT, LocalFT
    
    ' Convert FILETIME to SYSTEMTIME
    FileTimeToSystemTime LocalFT, ST
    
    ' Convert SYSTEMTIME to Date
    SystemTimeToVariantTime ST, Serial
    
    ' Set the return value
    ToDate = Serial
    
    ' Clear source variant
    PropVariantClear Var
    
End Function

'*********************************************************************************************
'
' Converts a Date to FILETIME variant
'
' Parameters:
'
' Value: source date
' Var: destination variant
'
'*********************************************************************************************
Public Sub ToFILETIME(ByVal Value As Date, Var As Variant)
Dim ST As SYSTEMTIME, FT As Currency

    ' Convert Date to SYSTEMTIME
    VariantTimeToSystemTime Value, ST
    
    ' Convert SYSTEMTIME to FILETIME
    SystemTimeToFileTime ST, FT
    
    ' Convert Local FILETIME to UTC FILETIME.
    ' Date properties must be saved in UTC.
    LocalFileTimeToFileTime FT, FT

    ' Clear any previous content
    PropVariantClear Var
    
    ' Set the variant type
    MoveMemory ByVal VarPtr(Var), VT_FILETIME, 2
    
    ' Copy the FILETIME to the variant
    MoveMemory ByVal VarPtr(Var) + 8, FT, Len(FT)
    
End Sub

'*********************************************************************************************
'
' Creates a LPSTR or LPWSTR variant from VB string
'
' Parameters:
'
' BSTR: Source string
' Var: destination variant
' Unicode: indicates if the result string must be ANSI or Unicode. Default is ANSI.
'
'*********************************************************************************************
Public Sub ToLPSTR(ByVal BSTR As String, Var As Variant, Optional ByVal Unicode As Boolean)
Dim VarType As Integer, Ptr As Long

    ' Set the string type
    If Unicode Then
        VarType = VT_LPWSTR ' Unicode
    Else
        VarType = VT_LPSTR  ' ANSI
    End If
    
    ' Add null char at the end of the
    ' string.
    BSTR = BSTR & vbNullChar
    
    If Unicode Then
        
        ' Allocate memory for the new string
        Ptr = CoTaskMemAlloc(Len(BSTR) * 2)
        
        ' Copy string from BSTR to the
        ' allocated memory
        MoveMemory ByVal Ptr, ByVal BSTR, Len(BSTR) * 2
    
    Else
    
        ' Allocate memory for the new string
        Ptr = CoTaskMemAlloc(Len(BSTR))
        
        ' Copy string from BSTR to the
        ' allocated memory
        lstrcpyA Ptr, ByVal BSTR
    
    End If
    
    ' Clear any previuos content from
    ' the variant
    PropVariantClear Var
    
    ' Write variant type
    MoveMemory Var, VarType, 2
 
    ' Write pointer
    MoveMemory ByVal VarPtr(Var) + 8, Ptr, 4

End Sub

'*********************************************************************************************
'
' Creates a array of strings from a variant containing a counted array of LPWSTR or LPSTR
'
' Parameters:
'
' Var: source variant
' Unicode: indicates if the source is ANSI or Unicode. Default is ANSI.
'
'*********************************************************************************************
Public Function ToBSTRArray(Var As Variant, Optional ByVal Unicode As Boolean) As Variant
Dim A() As String, Cnt As Long, PtrElem As Long
Dim PtrStr As Long

    ' Get element count from variant
    MoveMemory Cnt, ByVal VarPtr(Var) + 8, 4
    
    ' Get pointer to first element
    MoveMemory PtrElem, ByVal VarPtr(Var) + 12, 4

    ' Reallocate the VB array
    ReDim A(0 To Cnt - 1)
    
    For Cnt = 0 To Cnt - 1
        
        ' Get pointer to the string
        MoveMemory PtrStr, ByVal PtrElem, 4
        
        ' Copy the string from the pointer
        If Unicode Then
        
            A(Cnt) = Space$(lstrlenW(PtrStr))
            MoveMemory ByVal StrPtr(A(Cnt)), ByVal PtrStr, Len(A(Cnt)) * 2
            
        Else
        
            A(Cnt) = Space$(lstrlenA(PtrStr))
            lstrcpyA A(Cnt), ByVal PtrStr
            
        End If
        
        ' Move to next element
        PtrElem = PtrElem + 4
        
    Next
    
    ' Clear the source variant
    PropVariantClear Var
        
    ' Return the VB array
    ToBSTRArray = A
    
End Function

'*********************************************************************************************
'
' Creates a counted array of LPSTR from a VB array of strings
'
' Parameters:
'
' Value: source array
' Var: destination variant
'
'*********************************************************************************************
Public Sub ToLPSTRArray(Value As Variant, Var As Variant)
Dim ArrPtr As Long, ElemPtr As Long, PtrStr As Long
Dim Cnt As Long, I As Long, TmpStr As String

    ' Get element count
    Cnt = UBound(Value) - LBound(Value) + 1

    ' Alloc memory for the array. We
    ' must save each string pointer
    ' in the array. Each pointer have
    ' 4 bytes.
    ArrPtr = CoTaskMemAlloc(Cnt * 4)
    
    ' Set pointer to first element
    ElemPtr = ArrPtr
        
    For I = LBound(Value) To UBound(Value)
    
        ' Alloc memory for the string
        PtrStr = CoTaskMemAlloc(Len(Value(I)) + 1)
        
        ' Copy string pointer to array element
        MoveMemory ByVal ElemPtr, PtrStr, 4
        
        ' Copy string to string pointer
        TmpStr = Value(I) & vbNullChar
        lstrcpyA PtrStr, ByVal TmpStr
                
        ' Move element pointer to next element
        ElemPtr = ElemPtr + 4
        
    Next
    
    ' Set variant type
    MoveMemory ByVal VarPtr(Var), VT_VECTOR Or VT_LPSTR, 2
    
    ' Set variant element count
    MoveMemory ByVal VarPtr(Var) + 8, Cnt, 4
    
    ' Set Array pointer
    MoveMemory ByVal VarPtr(Var) + 12, ArrPtr, 4
    
End Sub


?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美精品一区二区在线观看| 99久久精品免费精品国产| 欧美激情综合五月色丁香| 日韩亚洲欧美中文三级| 欧美自拍偷拍午夜视频| 日韩**一区毛片| 亚洲成人自拍网| 日本网站在线观看一区二区三区| 久久综合狠狠综合| 久久久国产一区二区三区四区小说| 97精品久久久午夜一区二区三区| 亚洲欧美日韩国产另类专区| 国产精品私人影院| 1024成人网| 亚洲一区二区三区四区的| 久久久久久久性| 国产精品人成在线观看免费| 亚洲素人一区二区| 亚洲国产视频在线| 狠狠色丁香久久婷婷综合_中 | 99久久伊人网影院| 色8久久精品久久久久久蜜| 欧美中文字幕不卡| 日韩美女视频在线| 中文字幕国产一区| 亚洲成人一区二区在线观看| 麻豆成人免费电影| 国产91富婆露脸刺激对白| 91精品办公室少妇高潮对白| 91麻豆精品国产| 中文字幕国产一区| 日本vs亚洲vs韩国一区三区二区| 亚洲天堂av老司机| 天堂精品中文字幕在线| 国产精品66部| 欧美三级资源在线| 中文字幕va一区二区三区| 亚洲一区在线观看免费观看电影高清 | 奇米在线7777在线精品| 国产一级精品在线| 欧美日韩成人高清| 日本一区二区久久| 免费日本视频一区| 日本高清不卡aⅴ免费网站| 精品美女被调教视频大全网站| 欧美欧美午夜aⅴ在线观看| 精品99久久久久久| 亚洲bt欧美bt精品777| 国产不卡视频在线播放| 欧美福利一区二区| 亚洲精品老司机| 成人永久aaa| 精品国产成人在线影院| 亚洲韩国精品一区| 亚洲高清免费在线| 91美女在线观看| 国产在线不卡一卡二卡三卡四卡| 亚洲福利电影网| 成人av片在线观看| 精品国产区一区| 免费成人在线网站| 欧美精品一级二级| 亚洲成年人网站在线观看| 99国产一区二区三精品乱码| 精品国产乱码久久久久久老虎| 久久伊人蜜桃av一区二区| 日韩国产精品久久久| 日本福利一区二区| 亚洲图片有声小说| 欧美三级日韩在线| 亚洲国产欧美在线| 欧亚洲嫩模精品一区三区| 亚洲美女视频在线| 91美女片黄在线| 亚洲一卡二卡三卡四卡| 在线观看视频一区| 亚洲一区免费视频| 欧美三级一区二区| 久久品道一品道久久精品| 毛片不卡一区二区| 久久综合久久综合久久综合| 亚洲人成7777| 日本道色综合久久| 26uuu成人网一区二区三区| 国产精品拍天天在线| 成人免费视频播放| 亚洲视频精选在线| 欧美日韩国产经典色站一区二区三区| 日韩欧美在线影院| 国产精品一区二区男女羞羞无遮挡| 97超碰欧美中文字幕| 亚洲精品日日夜夜| 777a∨成人精品桃花网| 麻豆精品视频在线观看免费| 欧美精品一区二区三区蜜臀| 国产91对白在线观看九色| 亚洲精品乱码久久久久久黑人| 美女视频网站黄色亚洲| 国产丝袜欧美中文另类| 91在线免费视频观看| 五月婷婷综合在线| 精品成人佐山爱一区二区| av在线不卡观看免费观看| 香蕉影视欧美成人| 26uuu久久综合| 色欧美片视频在线观看在线视频| 久久中文娱乐网| 91首页免费视频| 日本一区二区三区dvd视频在线| 日韩精品亚洲一区| 日本一区二区三级电影在线观看 | 日韩精品电影在线观看| 精品av综合导航| 91久久精品一区二区| 麻豆91精品91久久久的内涵| 国产精品三级av在线播放| 欧美日韩和欧美的一区二区| 中文字幕一区二区三区在线播放| 久久69国产一区二区蜜臀| 日韩美女视频19| 欧美成人免费网站| 久久精品国产澳门| 亚洲精品成a人| 久久久久久久久久久久电影| 欧美日韩欧美一区二区| 成人午夜又粗又硬又大| 久久精品免费观看| 精品久久久久一区二区国产| 日韩一区精品视频| 亚洲乱码国产乱码精品精小说 | jizz一区二区| 黄页网站大全一区二区| 亚洲一区二区在线免费看| 欧美性做爰猛烈叫床潮| 国产精品88888| 六月丁香婷婷色狠狠久久| 亚洲欧美日韩综合aⅴ视频| 精品国产91乱码一区二区三区| 九九视频精品免费| 国产日韩精品一区二区三区| 欧美一区二区网站| 久久99日本精品| 天天综合天天做天天综合| 亚洲综合在线视频| 悠悠色在线精品| 亚洲欧美日韩在线| 亚洲日本电影在线| 亚洲四区在线观看| 亚洲国产精品精华液2区45| 久久久久久久久免费| 99久久er热在这里只有精品66| 亚洲综合自拍偷拍| 精品久久久久久无| 欧美精品一区二区三区一线天视频 | 欧美日韩高清在线播放| 在线观看不卡视频| 欧美日韩午夜影院| 欧美三级电影在线观看| 欧美人体做爰大胆视频| 欧美日韩国产高清一区二区三区 | 懂色av噜噜一区二区三区av| 激情六月婷婷综合| 一区二区日韩电影| 夜夜嗨av一区二区三区中文字幕| 欧美一区二区不卡视频| 日韩午夜电影在线观看| 日韩欧美国产电影| 一本大道久久a久久精品综合| 久久激五月天综合精品| 国内精品伊人久久久久av影院| 亚洲黄色小说网站| 午夜国产精品影院在线观看| 三级亚洲高清视频| 国产呦精品一区二区三区网站 | 在线免费观看成人短视频| 欧美在线视频全部完| 国产 欧美在线| 91年精品国产| 91精品欧美综合在线观看最新| 91小宝寻花一区二区三区| 欧美日韩一区国产| 精品久久久久香蕉网| 欧美日韩的一区二区| 久久精品一区二区三区不卡 | 中文字幕在线不卡视频| 亚洲影视在线观看| 日韩毛片高清在线播放| 亚洲第一在线综合网站| 国产在线精品一区二区不卡了 | www国产成人免费观看视频 深夜成人网| 91免费视频大全| 91精品国产91久久综合桃花 | 亚洲天堂成人网| 免费久久99精品国产| eeuss鲁片一区二区三区在线观看| 韩国女主播一区| 在线免费视频一区二区| 26uuu欧美日本| 午夜影院久久久| 午夜精品福利在线|