<DllImport("user32.dll", SetLastError:=True, CharSet:=CharSet.Auto)> Public Shared Function SetWindowText(hWnd As IntPtr, lpString As String) As Boolean End Function Private Declare Function GetLastError Lib "kernel32" () As Integer Dim aa As Integer SetWindowText(New IntPtr(123), "123") aa = GetLastError