新建From1(窗体),新建Command1(按钮CommandButton),代码:
Private Declare Function lstrlen Lib "kernel32.dll" Alias "lstrlenA" (ByVal lpString As Any) As Long
Private Sub Command1_Click()
Dim slength As Long
slength = lstrlen("Hi码农库") ' 显示8个字符
MsgBox slength & " characters."
End Sub