Imports System.Runtime.InteropServices
Module module_name
<DllImport("user32.dll", CharSet:=CharSet.Auto, _
CallingConvention:=CallingConvention.StdCall)> _
Public Function FindWindow( _
ByVal lpClassName As String, _
ByVal lpWindowName As String) As Integer
End Function
<DllImport("user32.dll", CharSet:=CharSet.Auto, _
CallingConvention:=CallingConvention.StdCall)> _
Public Function SendMessage( _
ByVal hWnd As Integer, _
ByVal wMsg As Integer, _
ByVal wParam As Integer, _
ByVal lParam As Integer) As Integer
End Function
<DllImport("kernel32.dll", CharSet:=CharSet.Unicode, _
CallingConvention:=CallingConvention.StdCall)> _
Public Function GlobalGetAtomName( _
ByVal nAtom As Integer, _
ByVal lpBuffer As System.Text.StringBuilder, _
ByVal nSize As Integer) As Integer
End Function
<DllImport("kernel32.dll", CharSet:=CharSet.Unicode, _
CallingConvention:=CallingConvention.StdCall)> _
Public Function GlobalDeleteAtom( _
ByVal nAtom As Integer) As Integer
End Function
Public Const UOA_CLASSNAME As String = "UOASSIST-TP-MSG-WND"
Public UOA_hWnd As Integer
Public Const WM_USER As Short = &H400S
Public Const WM_UOA_REQUEST_DATA As Integer = WM_USER + 200
Public Const WM_UOA_UCOUNT_RESOURCES As Integer = WM_USER + 201
Public Const WM_UOA_GET_COORDS As Integer = WM_USER + 202
Public Const WM_UOA_GET_SKILL As Integer = WM_USER + 203
Public Const WM_UOA_GET_STAT As Integer = WM_USER + 204
Public Const WM_UOA_SET_ACTIVE_MACRO As Integer = WM_USER + 205
Public Const WM_UOA_PLAY_MACRO As Integer = WM_USER + 206
Public Const WM_UOA_DISPLAY_TEXT As Integer = WM_USER + 207
Public Const WM_UOA_REQUEST_HOUSE_BOAT_INFO As Integer = WM_USER + 208
Public Const WM_UOA_ADD_COMMAND_LINE As Integer = WM_USER + 209
Public Const WM_UOA_GET_USER_ID As Integer = WM_USER + 210
Public Const WM_UOA_GET_SHARD_NAME As Integer = WM_USER + 211
Public Const WM_UOA_ADD_USER_TO_PARTY As Integer = WM_USER + 212
Public Const WM_UOA_GET_UO_WINDOW_HANDLE As Integer = WM_USER + 213
Public Const WM_UOA_GET_POISON_STATUS As Integer = WM_USER + 214
Public Const WM_UOA_SET_SKILL_LOCK As Integer = WM_USER + 215
Public Const WM_UOA_GET_ACCOUNT_IDENTIFIER As Integer = WM_USER + 216
Public Const WM_UOA_RESOURCE_COUNT_FINISHED As Integer = WM_USER + 301
Public Const WM_UOA_SPELL_WAS_ATTEMPTED As Integer = WM_USER + 302
Public Const WM_UOA_LOGON As Integer = WM_USER + 303
Public Const WM_UOA_MAGERY_SKILL_LEVEL As Integer = WM_USER + 304
Public Const WM_UOA_CURRENT_INT_AND_MANA As Integer = WM_USER + 305
Public Const WM_UOA_SKILL_LEVEL As Integer = WM_USER + 306
Public Const WM_UOA_MACRO_FINISHED As Integer = WM_USER + 307
Public Const WM_UOA_LOGOUT As Integer = WM_USER + 308
Public Const WM_UOA_CURRENT_MAX_HP_AND_HP As Integer = WM_USER + 309
Public Const WM_UOA_CURRENT_DEX_AND_STAM As Integer = WM_USER + 310
Public Const WM_UOA_ADD_HOUSE_BOAT As Integer = WM_USER + 311
Public Const WM_UOA_DELETE_HOUSE_BOAT As Integer = WM_USER + 312
Public Const WM_UOA_FACET_LAND_INFO As Integer = WM_USER + 313
Public Const WM_UOA_POWER_HOUR_ENTERED As Integer = WM_USER + 314
Public Function fncGetHIWORD( _
ByVal i As Integer) As Integer
Dim HIWORD As Integer = ((i And &HFFFF0000) \ 65536) And 65535
Return HIWORD
End Function
Public Function fncGetLOWORD( _
ByVal i As Integer) As Integer
Dim LOWORD As Integer = i And 65535
Return LOWORD
End Function
Public Function fncGetHILO( _
ByVal HI As Integer, _
ByVal LO As Integer) As Integer
Dim i As Integer
i = HI * 65536
i = i Or (LO And 65535)
Return i
End Function
Public Function fncGetWindowHandle( _
ByVal pClassName As String) As Integer
Return FindWindow(pClassName, vbNullString)
End Function
Public Function UOALink_SendMessage( _
ByVal WM_UOA As Integer, _
ByVal wParam As Integer, _
ByVal lParam As Integer) As Integer
Dim Result As Integer
mUOAWnd = fncGetWindowHandle(UOA_CLASSNAME)
If mUOAWnd = 0 Then
Return -1
End If
Result = SendMessage(mUOAWnd, WM_UOA, wParam, lParam)
Return Result
End Function
Public Function fncGetAtomString( _
ByVal nAtom As Integer) As String
Dim tmpLength As Integer = 256
Dim tmpString = New System.Text.StringBuilder(tmpLength)
Dim Result As Integer
Result = GlobalGetAtomName(nAtom, tmpString, tmpLength)
Result = GlobalDeleteAtom(nAtom)
Return tmpString.ToString
End Function
End Module