⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 globals.bas

📁 Data monkey是一个强大的是数据传输和转换应用程序。使用DataMonkey用户可以把复杂的文本文件格式
💻 BAS
字号:
Attribute VB_Name = "Globals"
' DataMonkey Data Conversion Application. Written by Theodore L. Ward
' Copyright (C) 2002 AstroComma Incorporated.
'
' This program is free software; you can redistribute it and/or
' modify it under the terms of the GNU General Public License
' as published by the Free Software Foundation; either version 2
' of the License, or (at your option) any later version.
'
' This program is distributed in the hope that it will be useful,
' but WITHOUT ANY WARRANTY; without even the implied warranty of
' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
' GNU General Public License for more details.
'
' You should have received a copy of the GNU General Public License
' along with this program; if not, write to the Free Software
' Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
' The author may be contacted at:
' TheodoreWard@Hotmail.com or TheodoreWard@Yahoo.com

Option Explicit

'Declare Function GetPrivateProfileString Lib "kernel32" Alias "GetPrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Long, ByVal lpFileName As String) As Long
'Declare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpString As Any, ByVal lpFileName As String) As Long
Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Declare Function SQLDataSources Lib "ODBC32.DLL" (ByVal henv&, ByVal fDirection%, ByVal szDSN$, ByVal cbDSNMax%, pcbDSN%, ByVal szDescription$, ByVal cbDescriptionMax%, pcbDescription%) As Integer
Declare Function SQLAllocEnv% Lib "ODBC32.DLL" (env&)

Global Const LB_GETTOPINDEX = &H400 + 15

Global GDataTypes
Global Const GVersion = "0.5"
Global Const gPROGRAM_TITLE = "Importing Program"

Global GWorkingDirectory As String
Global GTemplateDirectory As String
Global GOutputSourceDirectory As String
Global GImportInProgress As Boolean
Global GCancelImport As Boolean

'*************************************************************
' Used to specify the return value from forms whenever needed.
'*************************************************************

Global GFormReturnValue As Integer

Public Sub InitializeGlobals()
    GDataTypes = Array("INTEGER", "LONG", "FLOAT")
    GWorkingDirectory = App.Path
    GOutputSourceDirectory = GWorkingDirectory & "\Output Sources"
    GTemplateDirectory = GWorkingDirectory & "\Templates"
End Sub

Public Function GetUniqueID() As String
    Static uniqueIndex As Long
    
    ' Add a letter to the uniqueid so we can use it for a key in a collection.
    uniqueIndex = uniqueIndex + 1
    GetUniqueID = "T" + Trim(CStr(uniqueIndex))
End Function

' This function reads the name of an output source from
' the given output source file.
Function GetNameFromFile(fileName As String, ByRef ReturnName As String) As Boolean
    On Error GoTo eHandler
    GetNameFromFile = False
    
    Dim arc As New CArchive
    Dim item As String, value As Variant, retVal As Integer

    arc.fileName = fileName
    
    ' Read from the input file until we find the name.
    Do
        retVal = arc.GetNextItem(item, value)
        If item = "NAME" Then
            ReturnName = value
            GetNameFromFile = True
            arc.CloseFile
            Exit Function
        End If
    Loop While retVal <> cENDITEM And retVal <> cERROR
    
    LogError "Globals", "GetNameFromFile", "Invalid file '" & fileName & "'", False
    Exit Function

eHandler:
    LogError "Globals", "GetNameFromFile", Error(Err), False
End Function

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -