📄 module1.bas
字号:
Attribute VB_Name = "Module1"
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
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
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
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
Public Sub LoadINI()
Dim lngResult As Long
Dim strFileName
Dim strResult As String * 50
strFileName = App.Path & "\Settings.ini" 'Declare your ini file !
lngResult = GetPrivateProfileString(KeySection, _
KeyKey, strFileName, strResult, Len(strResult), _
strFileName)
If lngResult = 0 Then
'An error has occurred
Call MsgBox("An error has occurred while calling the API function(The INI file probably doesn't exist)", vbExclamation)
Else
KeyValue = Trim(strResult)
End If
End Sub
Public Sub SaveINI()
Dim lngResult As Long
Dim strFileName
strFileName = App.Path & "\Settings.ini" 'Declare your ini file !
lngResult = WritePrivateProfileString(KeySection, _
KeyKey, KeyValue, strFileName)
If lngResult = 0 Then
'An error has occurred
Call MsgBox("An error has occurred while calling the API function", 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
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -