?? textprocessing.vb
字號:
Option Strict On
Option Explicit On
Public Class TextProcessing
Friend Function ResultOfAPICall _
(ByRef FunctionName As String) _
As String
'Purpose : Get text that describes the result of an API call.
'Accepts : FunctionName - the name of the API function.
'Returns : The text.
Dim Bytes As Integer
Dim ResultCode As Integer
Dim ResultString As String
Try
ResultString = New String(Chr(0), 129)
'Returns the result code for the last API call.
ResultCode = System.Runtime.InteropServices.Marshal.GetLastWin32Error
'Get the result message that corresponds to the code.
Bytes = FormatMessage _
(FORMAT_MESSAGE_FROM_SYSTEM, _
0, _
ResultCode, _
0, _
ResultString, _
128, _
0)
'Subtract two characters from the message to strip the CR and LF.
If Bytes > 2 Then
ResultString = ResultString.Remove(Bytes - 2, 2)
End If
'Create the string to return.
ResultString = vbCrLf & FunctionName & vbCrLf & _
"Result = " & ResultString & vbCrLf
Return ResultString
Catch ex As Exception
End Try
End Function
End Class
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -