?? modglobals.bas
字號:
strBuffer = Mid$(strBuffer, 1, InStr(strBuffer, Chr(0)) - 1)
strVersionInfo(intTemp) = strBuffer
Else
' property not found
strVersionInfo(intTemp) = "?"
End If
Next intTemp
End If
End If
End If
' assign array to user-defined-type
FileInfo.CompanyName = strVersionInfo(0)
FileInfo.FileDescription = strVersionInfo(1)
FileInfo.FileVersion = strVersionInfo(2)
FileInfo.InternalName = strVersionInfo(3)
FileInfo.LegalCopyright = strVersionInfo(4)
FileInfo.OrigionalFileName = strVersionInfo(5)
FileInfo.ProductName = strVersionInfo(6)
FileInfo.ProductVersion = strVersionInfo(7)
FileInfo.LanguageID = strLangCharset2
BACKUP = FileInfo
End Function
'*****************************
'The following functions are used for COM
'*****************************
Public Function GetBoolean(FileNum As Variant) As Boolean
'*****************************
'Purpose: Get a boolean value from a file offset
'*****************************
Dim k As Boolean
Get FileNum, , k
GetBoolean = k
End Function
Public Function GetByte2(FileNum As Variant) As Byte
'*****************************
'Purpose: Get a byte value from a file offset
'*****************************
Dim k As Byte
Get FileNum, , k
GetByte2 = k
End Function
Public Function GetInteger(FileNum As Variant) As Integer
'*****************************
'Purpose: Get an integer value from a file offset
'*****************************
Dim k As Integer
Get FileNum, , k
GetInteger = k
End Function
Public Function GetLong(FileNum As Variant) As Long
'*****************************
'Purpose: Get a long value from a file offset
'*****************************
Dim k As Long
Get FileNum, , k
GetLong = k
End Function
Public Function GetSingle(FileNum As Variant) As Single
'*****************************
'Purpose: Get a single value from a file offset
'*****************************
Dim k As Single
Get FileNum, , k
GetSingle = k
End Function
Public Function GetString(FileNum As Variant) As String
'*****************************
'Purpose: Get VB String(Not Used)
'*****************************
'Not used...
Dim k As String
Seek FileNum, (Loc(FileNum) + 3)
Get FileNum, , k
GetString = k
End Function
Public Function GetAllString(FileNum As Variant) As String
'*****************************
'Purpose: Get any kind of string Unicode or Ascii
'*****************************
Dim length As Integer
Get FileNum, , length
Dim strText As String
strText = GetUntilNull(FileNum)
'MsgBox strText
If Len(strText) < length Then
'get unicode string
' MsgBox "unicode"
If length < 100 Then
Seek FileNum, Loc(FileNum) - 2
strText = GetUnicodeString(FileNum, length)
Seek FileNum, Loc(FileNum) + 1
End If
End If
GetAllString = strText
End Function
Sub AddText(strText As String)
'*****************************
'Purpose:Adds text to the current form's textbox. And idents it.
'*****************************
If gIdentSpaces < 0 Then gIdentSpaces = 0
frmMain.txtFinal(frmMain.txtFinal.UBound).Text = frmMain.txtFinal(frmMain.txtFinal.UBound).Text & Space(gIdentSpaces * 5) & strText & vbCrLf
End Sub
Sub LoadNewFormHolder(FormName As String)
'*****************************
'Purpose:To load a new textbox to hold each form's information
'*****************************
Dim i As Integer
For i = 0 To frmMain.txtFinal.UBound
If frmMain.txtFinal(i).Tag = "" Then
' frmMain.txtFinal(i).Tag = FormName
'frmMain.txtFinal(i).Text = ""
' Exit Sub
End If
Next
i = frmMain.txtFinal.UBound + 1
Load frmMain.txtFinal(i)
With frmMain.txtFinal(i)
.Tag = FormName
End With
End Sub
Sub LoadCOMFIX()
'*****************************
'Load the COM Hacks
'Com Hack File Format
'Objectname,PropertyName,NewDataType
'Notes on NewDataType: Can be either Byte Boolean Integer Long Single String
'One more thing to remember all these Properties are case sensetive
'*****************************
ReDim gComFix(0)
Open App.path & "\ComFix.txt" For Input As #1
Dim data As String
Dim Temp
Do While Not EOF(1)
Line Input #1, data
Temp = Split(data, ",")
gComFix(UBound(gComFix)).ObjectName = Temp(0)
gComFix(UBound(gComFix)).PropertyName = Temp(1)
gComFix(UBound(gComFix)).NewType = Temp(2)
ReDim Preserve gComFix(UBound(gComFix) + 1)
Loop
Close #1
ReDim Preserve gComFix(UBound(gComFix) - 1)
End Sub
Function ReturnGuid(FileNum As Variant) As String
'*****************************
'Gets a guid from a file, then corrects it into a real guid
'*****************************
Dim bArray(15) As Byte
Dim strArray(15) As String
Get FileNum, , bArray
Dim i As Integer
For i = 0 To 15
If i = 0 Then
strArray(0) = Hex(bArray(0) - 2)
Else
strArray(i) = Hex(bArray(i))
End If
If Len(strArray(i)) = 1 Then
strArray(i) = ("0" & strArray(i))
End If
Next
Dim strFinal As String
' strFinal = "{" & Hex(bArray(3)) & Hex(bArray(2)) & Hex(bArray(1)) & Hex(bArray(0) - 2)
' strFinal = strFinal & "-" & Hex(bArray(5)) & Hex(bArray(4))
' strFinal = strFinal & "-" & Hex(bArray(7)) & Hex(bArray(6))
' strFinal = strFinal & "-" & Hex(bArray(8)) & Hex(bArray(9))
' strFinal = strFinal & "-" & Hex(bArray(10)) & Hex(bArray(11)) & Hex(bArray(12)) & Hex(bArray(13)) & Hex(bArray(14)) & Hex(bArray(15)) & "}"
strFinal = "{" & strArray(3) & strArray(2) & strArray(1) & strArray(0)
strFinal = strFinal & "-" & strArray(5) & strArray(4)
strFinal = strFinal & "-" & strArray(7) & strArray(6)
strFinal = strFinal & "-" & strArray(8) & strArray(9)
strFinal = strFinal & "-" & strArray(10) & strArray(11) & strArray(12) & strArray(13) & strArray(14) & strArray(15) & "}"
ReturnGuid = strFinal
End Function
Function ReturnGuidByString(strGuid As String) As String
'*****************************
'Purpose: Experimantal
'*****************************
'Gets and generates the Guid
Dim bArray(15) As Byte
Dim strArray(15) As String
Dim i As Integer
For i = 1 To Len(strGuid)
bArray(i - 1) = Asc(Mid(strGuid, i, 1))
Next
For i = 0 To 15
If i = 0 Then
strArray(0) = Hex(bArray(0) - 2)
Else
strArray(i) = Hex(bArray(i))
End If
If Len(strArray(i)) = 1 Then
strArray(i) = ("0" & strArray(i))
End If
Next
Dim strFinal As String
strFinal = "{" & strArray(3) & strArray(2) & strArray(1) & strArray(0)
strFinal = strFinal & "-" & strArray(5) & strArray(4)
strFinal = strFinal & "-" & strArray(7) & strArray(6)
strFinal = strFinal & "-" & strArray(8) & strArray(9)
strFinal = strFinal & "-" & strArray(10) & strArray(11) & strArray(12) & strArray(13) & strArray(14) & strArray(15) & "}"
ReturnGuidByString = strFinal
End Function
Sub WriteApiList()
'*****************************
'Purpose: To write the Api's
'*****************************
Dim i As Integer
frmMain.txtCode.Text = ""
For i = 0 To UBound(gApiList) - 1
Next
End Sub
Public Function GetFirstChar(Start As Long, TextToFind As RichTextBox, ListToLike As String) As FIRSTCHAR_INFO
Dim i As Long, Cursor As Long, TheChar As String, theCursor As Long, SStart As Long, SLength As Long
SStart = TextToFind.SelStart
SLength = TextToFind.SelLength
Cursor = Len(TextToFind.Text)
For i = 1 To Len(ListToLike)
theCursor = TextToFind.Find(Mid(ListToLike, i, 1), Start - 1) + 1
If theCursor < Cursor And theCursor > 0 Then
Cursor = theCursor
TheChar = Mid(ListToLike, i, 1)
End If
Next i
TextToFind.SelStart = SStart
TextToFind.SelLength = SLength
If Cursor < Start Then
Cursor = Start
Else
GetFirstChar.lCursor = Cursor
End If
GetFirstChar.sChar = TheChar
End Function
Public Function GetPart(DataStr As String, DataId As Long, Separator As String) As String
Dim Pointer As Long
On Error Resume Next
For i = 1 To DataId
Pointer = InStr(Pointer + 1, DataStr, Separator)
Next i
GetPart = Mid(DataStr, Pointer + 1, InStr(Pointer + 1, DataStr, Separator) - Pointer - 1)
End Function
Public Function CountParts(DataStr As String, Separator As String) As Long
Dim Pointer As Long
Pointer = 1
While Pointer <> 0
Pointer = InStr(Pointer + 1, DataStr, Separator)
CountParts = CountParts + 1
Wend
CountParts = CountParts - 1
End Function
Sub AddPropertyToTheList(strPropertyName As String, Value As Variant, VarType As String, offset As Long, HelpString As String)
'*****************************
'Purpose: Used for Form Editor. To add a textbox and label to hold property name and value
'*****************************
Dim i As Integer
i = frmMain.txtEditArray.UBound + 1
Load frmMain.txtEditArray(i)
With frmMain.txtEditArray(i)
.Text = Value
.Tag = VarType
.Top = frmMain.txtEditArray(i - 1).Top + 300
.Left = frmMain.txtEditArray(0).Left
If VarType = "String" Then
.MaxLength = Len(Value)
End If
.ToolTipText = HelpString
' .BackColor = vbRed
.Visible = True
End With
Load frmMain.lblArrayEdit(i)
With frmMain.lblArrayEdit(i)
.Caption = strPropertyName
.Top = frmMain.lblArrayEdit(i - 1).Top + 300 ' frmMain.lblArrayEdit(i - 1).Top + frmMain.lblArrayEdit(i - 1).Height
.Left = frmMain.lblArrayEdit(0).Left
.Tag = offset
If VarType = "String" Then
.Tag = (offset - Len(Value))
End If
.Visible = True
End With
'MsgBox strPropertyName
End Sub
Public Function FileExists(path) As Boolean
'*****************************
'Purpose: Checks wether a FileExists or not
'*****************************
If Len(path) = 0 Then Exit Function
If Dir(path, vbHidden Or vbNormal Or vbReadOnly Or vbSystem) <> "" Then FileExists = True
End Function
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -