用VB6.0编写自我升级的程序(一)(5)
中华网科技 http://tech.china.com
2005-06-20 13:38:17
|
|
|
‘ 读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
首页 上页 | ...2| 3 | 4 | 5 | 下页 尾页 共 5 页 |