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

📄 mdumain.bas

📁 基于VC++串口编程。经过好长时间的寻找
💻 BAS
字号:
Attribute VB_Name = "mduMain"
Option Explicit

'API 声明
Public Declare Function OSWinHelp% Lib "user32" Alias "WinHelpA" (ByVal hWnd&, ByVal HelpFile$, ByVal wCommand%, dwData As Any)

Public Const g_MYPASSWORD = "SEP750207"

Public g_NorPassWord As String
Public g_SpecPassWord As String   '特殊密码
Public g_UserPassWord As String   '用户输入密码

Public g_myDB As Database
Public g_bDeleted As Boolean  '删除指定日期前记录后刷新主窗体列表
Public g_nNewRecID As Long    '形成新纪录之前加 1
Public g_nNewPrintID As Long  '形成新打印之前加 1
Public g_lCurRecID As Long    '当前记录ID,用于frmMidi
Public g_bPrinted As Boolean   '记录用户修改记录后是否打印了
Public g_nGetDataInterval As Single '隔多少时间取各终端数据


'启动系统
Sub Main()
    '防止多个程序运行
    If App.PrevInstance = True Then
        End
    End If
    '获得特殊密码
    g_SpecPassWord = GetSpecPassWord
    Call GetInitSet
    frmSplash.Show
    DoEvents
    Load frmServer
    
End Sub

'获取特殊密码
Private Function GetSpecPassWord() As String
    GetSpecPassWord = GetSetting("SEP", "PassWord", "SpecPassWord", "111111")
End Function

'获取Ini设置,时间间隔设置和打印开始编号
Private Sub GetInitSet()
Dim sFile As String, hF As Integer
Dim tmp
    On Error Resume Next
    sFile = GetAppPath & "server.ini"
    hF = FreeFile
    Open sFile For Input As #hF
    Input #hF, g_nGetDataInterval, tmp
    Input #hF, g_nNewPrintID, tmp
    Close #hF
    
    If g_nGetDataInterval <= 0.5 Then
        g_nGetDataInterval = 6
    End If
End Sub

Public Function GetAppPath() As String
    If Right(App.Path, 1) = "\" Then
        GetAppPath = App.Path
    Else
        GetAppPath = App.Path & "\"
    End If
End Function

'格式化打印编号
Public Function FormatPrintNo(ByVal pID As Long) As String
Const sNo = "No 0000000"
Dim s As String
    s = Format(pID)
    FormatPrintNo = Left(sNo, Len(sNo) - Len(s)) & s
End Function


⌨️ 快捷键说明

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