![]() |
Private Declare Function lstrcat Lib "kernel32" Alias "lstrcatA" (ByVal lpString1 As String, ByVal lpString2 As String) As Long Private Declare Function lstrcmp Lib "kernel32" Alias "lstrcmpA" (ByVal lpString1 As String, ByVal lpString2 As String) As Long Private Declare Function lstrcmpi Lib "kernel32" Alias "lstrcmpiA" (ByVal lpString1 As String, ByVal lpString2 As String) As Long Private Declare Function lstrcpy Lib "kernel32" Alias "lstrcpyA" (ByVal lpString1 As String, ByVal lpString2 As String) As Long Private Declare Function lstrcpyn Lib "kernel32" Alias "lstrcpynA" (ByVal lpString1 As String, ByVal lpString2 As String, ByVal iMaxLength As Long) As Long Private Declare Function lstrlen Lib "kernel32" Alias "lstrlenA" (ByVal lpString As String) As Long Private Declare Function CharLowerBuff Lib "user32" Alias "CharLowerBuffA" (ByVal lpsz As String, ByVal cchLength As Long) As Long Private Sub Form_Paint() 'KPD-Team 1999 'URL: http://www.allapi.net/ 'E-Mail: KPDTeam@Allapi.net Dim TestStr As String, CaseStr As String Const sKPD = "KPD-Team " Const sDate = "1999" Me.Cls 'Create a buffer TestStr = String(lstrlen(sKPD) + lstrlen(sDate), 0) 'Append two strings lstrcat TestStr, sKPD lstrcat TestStr, sDate 'Print the result on the form Me.Print TestStr 'Create a buffer CaseStr = String(lstrlen(TestStr), 0) 'Copy the string into the buffer lstrcpy CaseStr, TestStr Me.Print CaseStr 'Check if the strings are the same If lstrcmp(TestStr, CaseStr) = 0 Then Me.Print "The strings are the same (case sensitive)" End If 'convert the string to lowercase CharLowerBuff CaseStr, lstrlen(CaseStr) Me.Print CaseStr 'Check if the strings are the same If lstrcmpi(TestStr, CaseStr) = 0 Then Me.Print "The strings are the same (case insensitive)" End If Me.Print "Our original string: " + TestStr 'Copy the string lstrcpyn TestStr, sDate, lstrlen(sDate) + 1 Me.Print "Our altered string: " + TestStr End Sub |