Jump to content

TSRemote DLL in Autoit Problems


Recommended Posts

Hey all,

i just wrote a few functions to handle with Teamspeak. And the function tsrGetUserInfo have some problems, so $userinfo[11] should be "Warteschleife" and not "rteschleife". The same with $userinfo[4] = 0 should be something like 10.

#include <Array.au3>
Const $tagPlayerInfo = "int PlayerID; int ChannelID; char Nickname[30]; int PlayerChannelPrivileges; int PlayerPrivileges; int PlayerFlags"
Const $tagChannelInfo = "int ChannelID; int ChannelParentID; int PlayerCountInChannel; int ChannelFlags; int Codec; char Name[50]"
Const $tagUserInfo = $tagPlayerInfo & "; " & $tagChannelInfo & "; " & $tagChannelInfo

$userinfo = tsrGetUserInfo ( $vDLL )
_ArrayDisplay ( $userinfo )

Func tsrGetUserInfo ($vDLL = 'TSRemote.dll')
    Local $aUserInfo[18]
    Local $vStruct = DllStructCreate ($tagUserInfo)
    Local $avReturn = DllCall ($vDLL, 'int', 'tsrGetUserInfo', 'ptr', DllStructGetPtr($vStruct))    
    If @error or $avReturn[0] <> 0 Then
        Return SetError (1, @error, 0)
    EndIf   
    For $i = 1 to 18
        $aUserInfo[$i-1] = DllStructGetData($vStruct,$i)
    Next
    Return $aUserInfo
EndFunc
Link to comment
Share on other sites

You need to use align 2; at the beginning of the struct:

#include <Array.au3>
Const $tagPlayerInfo = "int PlayerID; int ChannelID; char Nickname[30]; int PlayerChannelPrivileges; int PlayerPrivileges; int PlayerFlags;"
Const $tagChannelInfo = "int ChannelID; int ChannelParentID; int PlayerCountInChannel; int ChannelFlags; int Codec; char Name[30];"
Const $tagUserInfo = "align 2;" & $tagPlayerInfo  & $tagChannelInfo  & $tagChannelInfo

$userinfo = tsrGetUserInfo ( $TSRemote )
_ArrayDisplay ( $userinfo )

Func tsrGetUserInfo ($vDLL = 'TSRemote.dll')
    Local $aUserInfo[18][2]
    Local $strings = StringSplit("PlayerID;ChannelID;Nickname;PlayerChannelPrivileges;PlayerPrivileges;PlayerFlags;ChannelID;ChannelParentID;PlayerCountInChannel;ChannelFlags;Codec;Name",";")
    Local $vStruct = DllStructCreate ($tagUserInfo)
    Local $avReturn = DllCall ($vDLL, 'int', 'tsrGetUserInfo', 'ptr', DllStructGetPtr($vStruct))    
    If @error or $avReturn[0] <> 0 Then
        Return SetError (1, @error, 0)
    EndIf    
    For $i = 1 to 18
        $aUserInfo[$i-1][1] = DllStructGetData($vStruct,$i)
        If $i>12 Then
            $aUserInfo[$i-1][0] = "Parent"&$strings[$i-6]
        Else
            $aUserInfo[$i-1][0] = $strings[$i]
        EndIf
    Next
    Return $aUserInfo
EndFunc

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Link to comment
Share on other sites

:)

Ich hatte das halt auch schon mal ausprobiert :)

.........................

I had tried to use this DLL, too

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...