?? module1.bas
字號(hào):
Attribute VB_Name = "Module1"
'==============
'INI文件處理模塊
'===============
'設(shè)置窗體位置API函數(shù)
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
Global Const SWP_NOMOVE = 2
Global Const SWP_NOSIZE = 1
Global Const FLAGS = SWP_NOMOVE Or SWP_NOSIZE
Global Const HWND_TOPMOST = -1
Global Const HWND_NOTOPMOST = -2
' =========================
Public RTChatRemoteIP As String
Public RTChatRemoteNick As String
Public RTCListen As Boolean
Public FileSendRemoteIP As String
Public FileSendRemoteNick As String
Public KeySection As String
Public KeyKey As String
Public KeyValue As String
Public RemoteNick As String
Public gFileNum As Long
Public RTChatTemp As String
Public MyPersonalInfo As MyPersonalData
'用戶信息結(jié)構(gòu)
Public Type MyPersonalData
Sex As String * 7
Country As String * 21
BirthDay As String * 11
Age As String * 4
Webpage As String * 101
About As String * 451
End Type
'寫INI文件API函數(shù)
Declare Function WritePrivateProfileString _
Lib "KERNEL32" Alias "WritePrivateProfileStringA" _
(ByVal lpApplicationName As String, ByVal _
lpKeyName As Any, ByVal lsString As Any, _
ByVal lplFilename As String) As Long
'讀INI文件API函數(shù)
Declare Function GetPrivateProfileString Lib _
"KERNEL32" Alias "GetPrivateProfileStringA" _
(ByVal lpApplicationName As String, ByVal _
lpKeyName As String, ByVal lpDefault As _
String, ByVal lpReturnedString As String, _
ByVal nSize As Long, ByVal lpFileName As _
String) As Long
'================
'讀INI文件
'================
Public Sub LoadINI()
Dim lngResult As Long
Dim strFileName
Dim strResult As String * 50
strFileName = App.Path & "\Settings.ini" 'ini文件名
'讀INI文件
lngResult = GetPrivateProfileString(KeySection, _
KeyKey, strFileName, strResult, Len(strResult), _
strFileName)
If lngResult = 0 Then
Call MsgBox("讀INI文件時(shí)出錯(cuò),請檢查相關(guān)設(shè)置", vbExclamation)
Else
KeyValue = Trim(strResult)
End If
End Sub
'==============
'寫INI文件函數(shù)
'==============
Public Sub SaveINI()
Dim lngResult As Long
Dim strFileName
strFileName = App.Path & "\Settings.ini"
lngResult = WritePrivateProfileString(KeySection, _
KeyKey, KeyValue, strFileName)
If lngResult = 0 Then
Call MsgBox("寫INI文件時(shí)出錯(cuò),請檢查相關(guān)設(shè)置", vbExclamation)
End If
End Sub
'I don't actually use this function(the reason for it being turned into comments), I was just bored and wanted to see if I could make one, the reason I didn't delete is it may give someone an idea on how Replace() works
'Public Function MyReplace(Source As String, Find As String, Replace As String) As String
'Dim FirstHalf As String
'Dim SecondHalf As String
'Dim TempBegin As Integer
'TempBegin = 0
'Do While InStr(TempBegin + 1, Source, Find) > 0
' TempBegin = InStr(TempBegin + 1, Source, Find)
' FirstHalf = Mid(Source, 1, TempBegin - 1)
' SecondHalf = Mid(Source, TempBegin + Len(Find), Len(Source) - TempBegin)
' Source = FirstHalf & Replace
' Source = Source & SecondHalf
'Loop
'MyReplace = Source
'End Function
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -