📄 modulewintop.bas
字号:
Attribute VB_Name = "ModuleWinTop"
'使窗体始终保持在最前面
Public Declare Function SetWindowPos Lib "user32" _
(ByVal hWnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, _
ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Const HWND_TOPMOST = -1
Const SWP_NOMOVE = &H2
Const SWP_NOSIZE = &H1
Public db As New ADODB.Connection
Public Rs As ADODB.Recordset
Public sSql As String
Public Bill As String
Public RemId As Integer
Public SqlBase As String
Public PublicPath As String
Public CRXApplication As New CRAXDRT.Application
Public CRCommand As New ADODB.Command
Public Function PutWindowOnTop(pFrm As Form)
Dim lngWindowPosition As Long
lngWindowPosition = SetWindowPos(pFrm.hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE)
End Function
Sub delay(ByVal n As Single)
Dim tm1 As Single, tm2 As Single
tm1 = Timer
Do
tm2 = Timer
If tm2 < tm1 Then tm2 = tm2 + 86400
If tm2 - tm1 > n Then Exit Do
DoEvents
Loop
End Sub
Sub main()
sConnect = "Provider=MSDASQL.1;Persist Security Info=False;User ID=admin;PassWord=thsky;Data Source=MS Access Database;Initial Catalog=" & App.Path & "\kcgl.mdb"
' sConnect = "Provider=MSDASQL.1;Persist Security Info=False;Data Source=MS Access Database;Initial Catalog=" & App.Path & "\kcgl.mdb"
db.Open sConnect
' 显示"标志",并且等待 2 秒
MDIFrmMain.Show
delay 0.9
FrmHY.Show
delay 1
Unload FrmHY
' 显示"登录"窗体,采取强制响应方式
frmLogin.Show vbModal
' If Not frmLogin.cmdOK Then
' MsgBox "未完成用户名称和密码输入", vbCritical
' End
' End If
' Unload frmLogin
' 显示"主"窗体
' Form1.Show
' Sub Main() 的工作大功告成
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -