StringFromBuffer = Left$(Buffer, nPos - 1)
Else
StringFromBuffer = Buffer
End If
End Function
'''' ===============================================
'''' 读Ini文件
''''
'''' ===============================================
Public Function ReadIniFile(ByVal strIniFile As String, ByVal strSection As String, ByVal strKey As String, Optional ByVal strKeyDefault As String = vbNullString) As String
Dim strBuffer As String
strBuffer = Space$(gintMAX_SIZE)
If GetPrivateProfileString(strSection, strKey, strKeyDefault, strBuffer, gintMAX_SIZE, strIniFile) Then
ReadIniFile = StringFromBuffer(strBuffer)
End If
End Function
'''' 检查文件是否存在
Function FileExists(filename As String) As Boolean
On Error Resume Next
FileExists = (Dir$(filename) <> "")
End Function
'''' 改变标签的文本及位置
Public Function ChangeLabelPos(frm As Form, lbl As Label, msg As String)
With lbl
.Caption = msg
.Left = (frm.ScaleWidth - .Width) / 2
.Top = .Height / 2
End With
End Function
''''关闭窗体
Function CloseValidForm(Ret As String) As Boolean
Dim WinWnd As Long
''''搜寻该窗口的句柄
WinWnd = FindWindow(vbNullString, Ret)
If WinWnd <> 0 Then
SendMessage WinWnd, WM_Close, 0&, 0&
End If
CloseValidForm = True
End Function
上一页 [1] [2] [3] 没有相关教程
|