|
|
|
Click here to copy the following block | 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 Declare Function CharUpperBuff Lib "user32" Alias "CharUpperBuffA" ( _ ByVal lpsz As String, _ ByVal cchLength As Long) As Long
Private Declare Function CharLower Lib "user32" Alias "CharLowerA" ( _ ByVal lpsz As String) As Long
Private Declare Function CharUpper Lib "user32" Alias "CharUpperA" ( _ ByVal lpsz As String) As Long
Private Declare Function IsCharAlpha Lib "user32" Alias "IsCharAlphaA" ( _ ByVal cChar As Byte) As Long
Private Declare Function IsCharAlphaNumeric Lib "user32" Alias "IsCharAlphaNumericA" ( _ ByVal cChar As Byte) As Long
Private Declare Function IsCharLower Lib "user32" Alias "IsCharLowerA" ( _ ByVal cChar As Byte) As Long
Private Declare Function IsCharUpper Lib "user32" Alias "IsCharUpperA" ( _ ByVal cChar As Byte) As Long
Private Sub Form_Load() Dim str1 As String, str2 As String Dim strTest As String MsgBox ApiConcate("Hello ", "World"), , "Concate strings"
str1 = "This is string to copy" Call ApiCopyString(str1, str2, 8) MsgBox str2, , "Copy string"
MsgBox ApiDoLower("ABCDEFGHIJK", 5), , "Convert to lower case"
MsgBox ApiDoUpper("abcdefghijk", 5), , "Convert to upper case" End Sub
Function ApiConcate(str1 As String, str2 As String) As String Dim strTemp As String strTemp = String(lstrlen(str1) + lstrlen(str2), 0)
lstrcat strTemp, str1 lstrcat strTemp, str2
ApiConcate = strTemp End Function
Function ApiDoUpper(strSrc As String, Optional NChar As Long = 0) As String If NChar = 0 Then ApiDoUpper = String(lstrlen(strSrc), 0) CharUpper strSrc ApiDoUpper = strSrc Else CharUpperBuff strSrc, NChar ApiDoUpper = strSrc End If End Function
Function ApiDoLower(strSrc As String, Optional NChar As Long = 0) As String If NChar = 0 Then ApiDoLower = String(lstrlen(strSrc), 0) CharLower strSrc ApiDoLower = strSrc Else CharLowerBuff strSrc, NChar ApiDoLower = strSrc End If End Function
Function ApiCopyString(strSrc As String, strDest As String, Optional NChar As Long = 0) If NChar = 0 Then strDest = String(lstrlen(strSrc), 0) lstrcpy strDest, strSrc Else strDest = String(NChar, 0)
lstrcpyn strDest, strSrc, NChar End If End Function
Function ApiCompare(str1 As String, str2 As String, Optional IsCaseSensitive As Boolean = False) As Boolean If IsCaseSensitive = True Then If lstrcmp(str1, str2) = 0 Then ApiCompare = True Else ApiCompare = False End If Else If lstrcmpi(str1, str2) = 0 Then ApiCompare = True Else ApiCompare = False End If End If End Function
Private Sub Form_KeyPress(KeyAscii As Integer) Dim strMsg As String
If IsCharAlphaNumeric(KeyAscii) Then strMsg = " AlphaNumeric " If IsCharAlpha(KeyAscii) Then strMsg = "Alpha " If IsCharLower(KeyAscii) Then strMsg = strMsg + " Lower " If IsCharUpper(KeyAscii) Then strMsg = strMsg + " Upper "
strMsg = "You pressed: " + Chr$(KeyAscii) & vbCrLf & "Key is >>" & strMsg MsgBox strMsg End Sub |
|
|
|
Submitted By :
Nayan Patel
(Member Since : 5/26/2004 12:23:06 PM)
|
|
|
Job Description :
He is the moderator of this site and currently working as an independent consultant. He works with VB.net/ASP.net, SQL Server and other MS technologies. He is MCSD.net, MCDBA and MCSE. In his free time he likes to watch funny movies and doing oil painting. |
View all (893) submissions by this author
(Birth Date : 7/14/1981 ) |
|
|