Winamp öffnen und taste übergeben

  • Hallo

    ich hoffe ich bin als Neuling hier richtig und hoffe mir wird hier geholfen


    Ich suche ein Script dass Winamp öffnet und eine Tastendruck an Winamp übergibt
    Z.B.: die Taste x die in winamp "Play" bedeutet"
    bislang habe ich es so versucht

    Winamp wird geöffnet jedoch wird die Taste nicht übergeben Ich habe gehört das die Taste immer an das aktive Fenster übergeben wird aber wie bekomme ich winamp dann aktiv?

    Ich hoffe hier wird mir geholfen
    vielen Dank
    Gruß
    Tobias

  • Füg einmal vor der Zeile 5 (WinActivate) folgendes ein:

    [autoit]

    WinWait ("Winamp")

    [/autoit]

    Edit: Zeilen 7 & 8 Deines Scripts, wären dann aber an der Stelle auch überflüssig...

    Zur Nutzung dieses Forum's, ist ein Übersetzer für folgende Begriffe unerlässlich:

    "On-Bort, weier, verscheiden, schädliges, Butten steyling, näckstet, Parr, Porblem, scripe, Kompletenz, harken, manuel zu extramieren, geckukt, würglich, excell, acces oder Compilevorgeng"

    Einmal editiert, zuletzt von Micha_he (12. September 2014 um 08:05)

  • Die bessere Möglichkeit wäre es, Winamp über API (Application Programming Interface) fernzusteuern.

    Winamp hat diverse Steuerungsmöglichkeiten von sich aus eingebaut, ohne das man den Umweg gehen muss und Tasten(Kombinationen) bei aktivem Fenster senden muss.

    Natürlich ist die Deklaration der Commands und das Einbinden erstmal etwas komplizierter, aber danach wird alles besser ;)

    Hier gibt es die Commands: http://forums.winamp.com/showthread.php?threadid=180297


    Das ist kein "muss", aber ich wollte zumindest den besseren Weg mal erwähnen.


    So hat es bei mir funktioniert:

    [autoit]

    ;Dekleration der API Commands
    Global Const $cWA_WM_COMMAND = 0x0111
    Global Const $WINAMP_BUTTON2 = 40045
    ShellExecute("Winamp") ;Winamp Ausführen
    Local $hWinamp = WinWait("[CLASS:Winamp v1.x]") ;Auf Winamp warten und das Handle herausbekommen
    DllCall("user32.dll", "int", "SendMessage", "hwnd", $hWinamp, "int", $cWA_WM_COMMAND, "int", $WINAMP_BUTTON2, "int", 0) ;Druecke Winamp Play-Knopf

    [/autoit]

    Einmal editiert, zuletzt von KloMeister (12. September 2014 um 09:39)

  • Ich persönlich steuere WinAmp uber eine UDF, die ich vor einiger Zeit im englischen Forum gefunden habe.
    Ich finde nur gerade den Beitrag nicht mehr, darum hier mal die UDF:

    Spoiler anzeigen
    [autoit]

    #CS Winamp Library Info Header
    ;
    ; Name/Title: Winamp Automation Library (Winamp 2.x +).
    ; Description: 34 Functions to handle Winamp Media Player (http://winamp.com).
    ; This library written base on the SDK that provided at Wanamp's home page:
    ; http://www.winamp.com/development/sdk
    ;
    ; Version: 1.4
    ; Last Update: 22.May.2009
    ; Requirements: AutoIt 3.2.10.0 or higher, Winamp 2.x or higher.
    ; Note: This UDF Library tested on Winamp v5.x.
    ; Author: Copyright © 2008 - 2009 G.Sandler (CreatoR's Lab - http://creator-lab.ucoz.ru).
    ;
    ; History Version:
    ;
    ; v1.0 [31.Marth.2008]
    ; * First Release.
    ;
    ; v1.1 [14.May.2008]
    ; * Added UDF: _Winamp_AddFile()
    ; * Added UDF: _Winamp_SetPLPosition()
    ; * Added UDF: _Winamp_GetPLPosition()
    ; * Added optional parameters for _Winamp_Play() UDF:
    ; $iTrack - Sets playlist position before start playing.
    ; $iWait - Determines if the function should wait for the sound to finish before continuing.
    ;
    ; v1.2 [15.May.2008]
    ; * _Winamp_GetCurrentTrackOutputTime() function now always returns output time in milliseconds.
    ; Now if $iMode = -1 (default) function return current position, if <> -1 it return song lenght.
    ;
    ; * Added UDF: _Winamp_GetVolume()
    ;
    ; v1.3 [19.May.2008]
    ; * The library now compatible with AutoIt v3.2.12.0.
    ;
    ; * Added UDF: _Winamp_ClearPlayList()
    ; * Added UDF: _Winamp_GetCurrentTrackFilePath()
    ;
    ; * Changed _Winamp_GetPlayListToArray() function.
    ; Now it return a 2 dimensional array,
    ; where [0][0] is the element of current track, [n][0] is the track title,
    ; and [n][1] is the track file path.
    ;
    ; * Fixed UDF _Winamp_GetCurrentTrackTitle(),
    ; with $iMode <> -1 it was not returning correct track position.
    ;
    ; v1.4 [22.May.2009]
    ; * The library now compatible with AutoIt v3.3.0.0.
    ; * Added optional $h_Winamp_Wnd parameter to all functions
    ; that sends message to winamp's window - It should allow to manage multiple winamp instances.
    ; (by default the handle is taken from $sWINAMP_CLASS).
    #CE
    ;

    [/autoit] [autoit][/autoit] [autoit]

    #include-once
    #include <GuiConstantsEx.au3>
    ;

    [/autoit] [autoit][/autoit] [autoit]

    #Region Constants
    Global Const $cWA_WM_COMMAND = 0x0111
    Global Const $cWA_WM_COPYDATA = 0x004A
    Global Const $cWA_WM_USER = 0x0400

    [/autoit] [autoit][/autoit] [autoit]

    Global Const $sWINAMP_CLASS = "[CLASS:Winamp v1.x]"
    Global Const $sWINAMP_PL_CLASS = "[CLASS:BaseWindow_RootWnd;TITLE:Playlist Editor]"
    Global Const $WM_WA_IPC = $cWA_WM_USER

    [/autoit] [autoit][/autoit] [autoit]

    Global Const $IPC_GETVERSION = 0 ;Returns Version of Winamp
    Global Const $IPC_SETVOLUME = 122 ;Sets Volume (lparam)
    Global Const $IPC_GETLISTLENGTH = 124 ;Returns the length of the current playlist, in tracks
    Global Const $IPC_GETLISTPOS = 125 ;Returns the playlist position
    Global Const $IPC_GETINFO = 126 ;Returns current song info
    Global Const $IPC_ENQUEUEFILE = 100 ;Adds File to PlayList
    Global Const $IPC_DELETE = 101 ;Clear the PlayList
    Global Const $IPC_ISPLAYING = 104 ;Get song status
    Global Const $IPC_GETOUTPUTTIME = 105 ;Get song time/lenght
    Global Const $IPC_SETPLAYLISTPOS = 121 ;Set Current Position in PlayList
    Global Const $IPC_JUMPTOTIME = 106 ;Seek in song
    Global Const $IPC_RESTARTWINAMP = 135 ;Restart Winamp
    Global Const $IPC_GETPLAYLISTFILE = 210 ;Returns PlayList file path
    Global Const $IPC_GETPLAYLISTFILEW = 211 ;Returns PlayList file path
    Global Const $IPC_GET_PLAYLISTTITLE = 212 ;Returns current song title
    Global Const $IPC_GET_SHUFFLE = 250 ;Returns the status of the Shuffle option (1 if set)
    Global Const $IPC_GET_REPEAT = 251 ;Returns the status of the Repeat option (1 if set)
    Global Const $IPC_SET_SHUFFLE = 252 ;Sets the status of the Shuffle option (1 to turn it on)
    Global Const $IPC_SET_REPEAT = 253 ;Sets the status of the Repeat option (1 to turn it on)
    Global Const $IPC_SPAWNBUTTONPOPUP = 361 ;Pops up menu for specific controls

    [/autoit] [autoit][/autoit] [autoit]

    Global Const $WINAMP_OPTIONS_PREFS = 40012 ;Pops up the preferences
    Global Const $WINAMP_OPTIONS_EQ = 40036 ;Toggles the EQ window
    Global Const $WINAMP_OPTIONS_PLEDIT = 40040 ;Toggles the playlist window
    Global Const $WINAMP_OPTIONS_AOT = 40019 ;Toggles the "always on top" option
    Global Const $WINAMP_FILE_QUIT = 40001 ;Quit the Winamp
    Global Const $WINAMP_FILE_PLAY = 40029 ;Pops up the load file(s) box
    Global Const $WINAMP_FILE_DIR = 40187 ;Pops up the load directory box
    Global Const $WINAMP_JUMPFILE = 40194 ;Pops up the "Jump to" box
    Global Const $WINAMP_HELP_ABOUT = 40041 ;Pops up the about box
    Global Const $WINAMP_BUTTON1 = 40044 ;Previous
    Global Const $WINAMP_BUTTON2 = 40045 ;Play
    Global Const $WINAMP_BUTTON3 = 40046 ;Toggle Pause
    Global Const $WINAMP_BUTTON4 = 40047 ;Stop
    Global Const $WINAMP_BUTTON5 = 40048 ;Next
    Global Const $WINAMP_BUTTON2_CTRL = 40155 ;Open URL Address box
    Global Const $WINAMP_VOLUMEUP = 40058 ;Turns the volume up a little
    Global Const $WINAMP_VOLUMEDOWN = 40059 ;Turns the volume down a little
    Global Const $WINAMP_FFWD5S = 40060 ;Fast forwards 5 seconds
    Global Const $WINAMP_REW5S = 40061 ;Rewinds 5 seconds
    #EndRegion Constants
    ;

    [/autoit] [autoit][/autoit] [autoit]

    ;===============================================================================
    ;
    ; Function Name: _Winamp_OptionsPrefs()
    ;
    ; Function Description: Display Prferences dialog.
    ;
    ; Parameter(s): $h_Winamp_Wnd - [Optional] Winamp window handle to use
    ; (by default the handle is taken from $sWINAMP_CLASS).
    ;
    ; Requirement(s): None.
    ;
    ; Return Value(s): On Success - Show "Prferences" dialog and return 1.
    ; On Failure - Return 0 and set @error to:
    ; 1 - Unable to find Winamp window, probably winamp isn't runing.
    ; 2 - SendMessage fail.
    ;
    ; Author(s): G.Sandler (a.k.a CreatoR) - CreatoR's Lab (http://creator-lab.ucoz.ru)
    ;
    ;=====================================================================
    Func _Winamp_OptionsPrefs($h_Winamp_Wnd = 0)
    Local $hWinamp = WinGetHandle($sWINAMP_CLASS)
    If IsHWnd($h_Winamp_Wnd) Then $hWinamp = $h_Winamp_Wnd

    [/autoit] [autoit][/autoit] [autoit]

    If Not IsHWnd($hWinamp) Then Return SetError(1, 0, 0)

    [/autoit] [autoit][/autoit] [autoit]

    DllCall("user32.dll", "int", "SendMessage", "hwnd", $hWinamp, "int", $cWA_WM_COMMAND, "int", $WINAMP_OPTIONS_PREFS, "int", 0)

    [/autoit] [autoit][/autoit] [autoit]

    If @error Then Return SetError(2, 0, 0)

    [/autoit] [autoit][/autoit] [autoit]

    Return 1
    EndFunc ;==>_Winamp_OptionsPrefs

    [/autoit] [autoit][/autoit] [autoit]

    ;===============================================================================
    ;
    ; Function Name: _Winamp_OptionsHelpAbout()
    ;
    ; Function Description: Display "About Winamp" dialog.
    ;
    ; Parameter(s): $h_Winamp_Wnd - [Optional] Winamp window handle to use
    ; (by default the handle is taken from $sWINAMP_CLASS).
    ;
    ; Requirement(s): None.
    ;
    ; Return Value(s): On Success - Return 1.
    ; On Failure - Return 0 and set @error to:
    ; 1 - Unable to find Winamp window, probably winamp isn't runing.
    ; 1, 2, 3 - According to DllCall() returns error.
    ;
    ; Author(s): G.Sandler (a.k.a CreatoR) - CreatoR's Lab (http://creator-lab.ucoz.ru)
    ;
    ;=====================================================================
    Func _Winamp_OptionsHelpAbout($h_Winamp_Wnd = 0)
    Local $hWinamp = WinGetHandle($sWINAMP_CLASS)
    If IsHWnd($h_Winamp_Wnd) Then $hWinamp = $h_Winamp_Wnd

    [/autoit] [autoit][/autoit] [autoit]

    If Not IsHWnd($hWinamp) Then Return SetError(1, 0, 0)

    [/autoit] [autoit][/autoit] [autoit]

    DllCall("user32.dll", "int", "SendMessage", "hwnd", $hWinamp, "int", $cWA_WM_COMMAND, "int", $WINAMP_HELP_ABOUT, "int", 0)

    [/autoit] [autoit][/autoit] [autoit]

    If @error Then Return SetError(@error, 0, 0)

    [/autoit] [autoit][/autoit] [autoit]

    Return 1
    EndFunc ;==>_Winamp_OptionsHelpAbout

    [/autoit] [autoit][/autoit] [autoit]

    ;===============================================================================
    ;
    ; Function Name: _Winamp_OptionsOpenFiles()
    ;
    ; Function Description: Popups file(s)/dir selection (Open) window.
    ;
    ; Parameter(s): $iMode - Defins what dialog to show:
    ; $iMode = -1 (default) will popup "Add file(s)" window.
    ; $iMode = 1 will popup "Open file(s)" window.
    ; If $iMode <> -1 And $iMode <> 1 then will show "Dir Select" window.
    ; $h_Winamp_Wnd - [Optional] Winamp window handle to use
    ; (by default the handle is taken from $sWINAMP_CLASS).
    ;
    ; Requirement(s): None.
    ;
    ; Return Value(s): On Success - Show file(s)/dir selection window and return 1.
    ; On Failure - Return 0 and set @error to:
    ; 1 - Unable to find Winamp window, probably winamp isn't runing.
    ; 2 - ControlSend() faild, or SendMessage fail if $iMode <> -1.
    ;
    ; Author(s): G.Sandler (a.k.a CreatoR) - CreatoR's Lab (http://creator-lab.ucoz.ru)
    ;
    ;=====================================================================
    Func _Winamp_OptionsOpenFiles($iMode = -1, $h_Winamp_Wnd = 0)
    Local $hWinamp = WinGetHandle($sWINAMP_CLASS)
    If IsHWnd($h_Winamp_Wnd) Then $hWinamp = $h_Winamp_Wnd

    [/autoit] [autoit][/autoit] [autoit]

    If Not IsHWnd($hWinamp) Then Return SetError(1, 0, 0)

    [/autoit] [autoit][/autoit] [autoit]

    Switch $iMode
    Case -1
    ControlSend($sWINAMP_PL_CLASS, "", "", "l")
    Case 1
    DllCall("user32.dll", "int", "SendMessage", _
    "hwnd", $hWinamp, "int", $cWA_WM_COMMAND, "int", $WINAMP_FILE_PLAY, "int", 0)
    Case Else
    DllCall("user32.dll", "int", "SendMessage", "hwnd", $hWinamp, "int", $cWA_WM_COMMAND, "int", $WINAMP_FILE_DIR, "int", 0)
    EndSwitch

    [/autoit] [autoit][/autoit] [autoit]

    If @error Then Return SetError(2, 0, 0)

    [/autoit] [autoit][/autoit] [autoit]

    Return 1
    EndFunc ;==>_Winamp_OptionsOpenFiles

    [/autoit] [autoit][/autoit] [autoit]

    ;===============================================================================
    ;
    ; Function Name: _Winamp_OptionsURLAddress()
    ;
    ; Function Description: Popups "URL Address Box" (to insert URL).
    ;
    ; Parameter(s): $h_Winamp_Wnd - [Optional] Winamp window handle to use
    ; (by default the handle is taken from $sWINAMP_CLASS).
    ;
    ; Requirement(s): None.
    ;
    ; Return Value(s): On Success - Show "URL Address Box" window and Return 1.
    ; On Failure - Return 0 and set @error to:
    ; 1 - Unable to find Winamp window, probably winamp isn't runing.
    ; 2 - SendMessage fail.
    ;
    ; Author(s): G.Sandler (a.k.a CreatoR) - CreatoR's Lab (http://creator-lab.ucoz.ru)
    ;
    ;=====================================================================
    Func _Winamp_OptionsURLAddress($h_Winamp_Wnd = 0)
    Local $hWinamp = WinGetHandle($sWINAMP_CLASS)
    If IsHWnd($h_Winamp_Wnd) Then $hWinamp = $h_Winamp_Wnd

    [/autoit] [autoit][/autoit] [autoit]

    If Not IsHWnd($hWinamp) Then Return SetError(1, 0, 0)

    [/autoit] [autoit][/autoit] [autoit]

    DllCall("user32.dll", "int", "SendMessage", "hwnd", $hWinamp, "int", $cWA_WM_COMMAND, "int", $WINAMP_BUTTON2_CTRL, "int", 0)

    [/autoit] [autoit][/autoit] [autoit]

    If @error Then Return SetError(2, 0, 0)

    [/autoit] [autoit][/autoit] [autoit]

    Return 1
    EndFunc ;==>_Winamp_OptionsURLAddress

    [/autoit] [autoit][/autoit] [autoit]

    ;===============================================================================
    ;
    ; Function Name: _Winamp_OptionsPLToggle()
    ;
    ; Function Description: Toggle PlayList window (show/hide).
    ;
    ; Parameter(s): $h_Winamp_Wnd - [Optional] Winamp window handle to use
    ; (by default the handle is taken from $sWINAMP_CLASS).
    ;
    ; Requirement(s): None.
    ;
    ; Return Value(s): On Success - Show/Hide PlayList window and return 1.
    ; On Failure - Return 0 and set @error to:
    ; 1 - Unable to find Winamp window, probably winamp isn't runing.
    ; 2 - SendMessage fail.
    ;
    ; Author(s): G.Sandler (a.k.a CreatoR) - CreatoR's Lab (http://creator-lab.ucoz.ru)
    ;
    ;=====================================================================
    Func _Winamp_OptionsPLToggle($h_Winamp_Wnd = 0)
    Local $hWinamp = WinGetHandle($sWINAMP_CLASS)
    If IsHWnd($h_Winamp_Wnd) Then $hWinamp = $h_Winamp_Wnd

    [/autoit] [autoit][/autoit] [autoit]

    If Not IsHWnd($hWinamp) Then Return SetError(1, 0, 0)

    [/autoit] [autoit][/autoit] [autoit]

    DllCall("user32.dll", "int", "SendMessage", "hwnd", $hWinamp, "int", $cWA_WM_COMMAND, "int", $WINAMP_OPTIONS_PLEDIT, "int", 0)

    [/autoit] [autoit][/autoit] [autoit]

    If @error Then Return SetError(2, 0, 0)

    [/autoit] [autoit][/autoit] [autoit]

    Return 1
    EndFunc ;==>_Winamp_OptionsPLToggle

    [/autoit] [autoit][/autoit] [autoit]

    ;===============================================================================
    ;
    ; Function Name: _Winamp_OptionsEQToggle()
    ;
    ; Function Description: Toggle Equalizer window (show/hide).
    ;
    ; Parameter(s): $h_Winamp_Wnd - [Optional] Winamp window handle to use
    ; (by default the handle is taken from $sWINAMP_CLASS).
    ;
    ; Requirement(s): None.
    ;
    ; Return Value(s): On Success - Show/Hide Equalizer window and return 1.
    ; On Failure - Return 0 and set @error to:
    ; 1 - Unable to find Winamp window, probably winamp isn't runing.
    ; 2 - SendMessage fail.
    ;
    ; Author(s): G.Sandler (a.k.a CreatoR) - CreatoR's Lab (http://creator-lab.ucoz.ru)
    ;
    ;=====================================================================
    Func _Winamp_OptionsEQToggle($h_Winamp_Wnd = 0)
    Local $hWinamp = WinGetHandle($sWINAMP_CLASS)
    If IsHWnd($h_Winamp_Wnd) Then $hWinamp = $h_Winamp_Wnd

    [/autoit] [autoit][/autoit] [autoit]

    If Not IsHWnd($hWinamp) Then Return SetError(1, 0, 0)

    [/autoit] [autoit][/autoit] [autoit]

    DllCall("user32.dll", "int", "SendMessage", "hwnd", $hWinamp, "int", $cWA_WM_COMMAND, "int", $WINAMP_OPTIONS_EQ, "int", 0)

    [/autoit] [autoit][/autoit] [autoit]

    If @error Then Return SetError(2, 0, 0)

    [/autoit] [autoit][/autoit] [autoit]

    Return 1
    EndFunc ;==>_Winamp_OptionsEQToggle

    [/autoit] [autoit][/autoit] [autoit]

    ;===============================================================================
    ;
    ; Function Name: _Winamp_OptionsJumpTo()
    ;
    ; Function Description: Popups "Jump to" window.
    ;
    ; Parameter(s): $h_Winamp_Wnd - [Optional] Winamp window handle to use
    ; (by default the handle is taken from $sWINAMP_CLASS).
    ;
    ; Requirement(s): None.
    ;
    ; Return Value(s): On Success - Show "Jump to" window and return 1.
    ; On Failure - Return 0 and set @error to:
    ; 1 - Unable to find Winamp window, probably winamp isn't runing.
    ; 2 - SendMessage fail.
    ;
    ; Author(s): G.Sandler (a.k.a CreatoR) - CreatoR's Lab (http://creator-lab.ucoz.ru)
    ;
    ;=====================================================================
    Func _Winamp_OptionsJumpTo($h_Winamp_Wnd = 0)
    Local $hWinamp = WinGetHandle($sWINAMP_CLASS)
    If IsHWnd($h_Winamp_Wnd) Then $hWinamp = $h_Winamp_Wnd

    [/autoit] [autoit][/autoit] [autoit]

    If Not IsHWnd($hWinamp) Then Return SetError(1, 0, 0)

    [/autoit] [autoit][/autoit] [autoit]

    DllCall("user32.dll", "int", "SendMessage", "hwnd", $hWinamp, "int", $cWA_WM_COMMAND, "int", $WINAMP_JUMPFILE, "int", 0)

    [/autoit] [autoit][/autoit] [autoit]

    If @error Then Return SetError(2, 0, 0)

    [/autoit] [autoit][/autoit] [autoit]

    Return 1
    EndFunc ;==>_Winamp_OptionsJumpTo

    [/autoit] [autoit][/autoit] [autoit]

    ;===============================================================================
    ;
    ; Function Name: _Winamp_AddFile()
    ;
    ; Function Description: Add specific file path to Winamp's PlayList.
    ;
    ; Parameter(s): $sFilePath - Full file path to add to the playlist.
    ; $h_Winamp_Wnd - [Optional] Winamp window handle to use
    ; (by default the handle is taken from $sWINAMP_CLASS).
    ;
    ; Requirement(s): None.
    ;
    ; Return Value(s): On Success - Adds file to Winamp's PlayList and return 1.
    ; On Failure - Return 0 and set @error to:
    ; 1 - Unable to find Winamp window, probably winamp isn't runing.
    ; 2 - SendMessage fail.
    ;
    ; Author(s): G.Sandler (a.k.a CreatoR) - CreatoR's Lab (http://creator-lab.ucoz.ru)
    ;
    ;=====================================================================
    Func _Winamp_AddFile($sFilePath, $h_Winamp_Wnd = 0)
    Local $hWinamp = WinGetHandle($sWINAMP_CLASS)
    If IsHWnd($h_Winamp_Wnd) Then $hWinamp = $h_Winamp_Wnd

    [/autoit] [autoit][/autoit] [autoit]

    If Not IsHWnd($hWinamp) Then Return SetError(1, 0, 0)

    [/autoit] [autoit][/autoit] [autoit]

    Local $iFilePathSize = StringLen($sFilePath) + 1
    Local $stMem = DllStructCreate("char[" & $iFilePathSize & "]")

    [/autoit] [autoit][/autoit] [autoit]

    For $i = 0 To $iFilePathSize
    DllStructSetData($stMem, 1, Asc(StringMid($sFilePath, $i, 1)), $i)
    Next

    [/autoit] [autoit][/autoit] [autoit]

    DllStructSetData($stMem, 1, 0, $iFilePathSize)

    [/autoit] [autoit][/autoit] [autoit]

    ;; Create the COPYDATASTRUCT ;;
    Local $stCopyData = DllStructCreate("uint;uint;ptr")
    DllStructSetData($stCopyData, 1, $IPC_ENQUEUEFILE) ;dwData -> $IPC_ENQUEUEFILE = 100
    DllStructSetData($stCopyData, 2, ($iFilePathSize * 2)) ;cbData = Size of the message
    DllStructSetData($stCopyData, 3, DllStructGetPtr($stMem)) ;lpData = Pointer to the message

    [/autoit] [autoit][/autoit] [autoit]

    DllCall("user32.dll", "int", "SendMessage", "hwnd", $hWinamp, _
    "int", $cWA_WM_COPYDATA, "int", 0, "ptr", DllStructGetPtr($stCopyData))

    [/autoit] [autoit][/autoit] [autoit]

    If @error Then Return SetError(2, 0, 0)

    [/autoit] [autoit][/autoit] [autoit]

    Return 1
    EndFunc ;==>_Winamp_AddFile

    [/autoit] [autoit][/autoit] [autoit]

    ;===============================================================================
    ;
    ; Function Name: _Winamp_ClearPlayList()
    ;
    ; Function Description: Clear the entire PlayList.
    ;
    ; Parameter(s): $h_Winamp_Wnd - [Optional] Winamp window handle to use
    ; (by default the handle is taken from $sWINAMP_CLASS).
    ;
    ; Requirement(s): None.
    ;
    ; Return Value(s): On Success - Clear the playlist and return 1.
    ; On Failure - Return 0 and set @error to:
    ; 1 - Unable to find Winamp window, probably winamp isn't runing.
    ; 2 - SendMessage fail.
    ;
    ; Author(s): G.Sandler (a.k.a CreatoR) - CreatoR's Lab (http://creator-lab.ucoz.ru)
    ;
    ;=====================================================================
    Func _Winamp_ClearPlayList($h_Winamp_Wnd = 0)
    Local $hWinamp = WinGetHandle($sWINAMP_CLASS)
    If IsHWnd($h_Winamp_Wnd) Then $hWinamp = $h_Winamp_Wnd

    [/autoit] [autoit][/autoit] [autoit]

    If Not IsHWnd($hWinamp) Then Return SetError(1, 0, 0)

    [/autoit] [autoit][/autoit] [autoit]

    DllCall("user32.dll", "int", "SendMessage", "hwnd", $hWinamp, "int", $WM_WA_IPC, "int", 0, "int", $IPC_DELETE)

    [/autoit] [autoit][/autoit] [autoit]

    If @error Then Return SetError(2, 0, 0)

    [/autoit] [autoit][/autoit] [autoit]

    Return 1
    EndFunc ;==>_Winamp_ClearPlayList

    [/autoit] [autoit][/autoit] [autoit]

    ;===============================================================================
    ;
    ; Function Name: _Winamp_Close()
    ;
    ; Function Description: Close Winamp instance (sends WM_CLOSE to the main window).
    ;
    ; Parameter(s): $h_Winamp_Wnd - [Optional] Winamp window handle to use
    ; (by default the handle is taken from $sWINAMP_CLASS).
    ;
    ; Requirement(s): None.
    ;
    ; Return Value(s): On Success - Return 1.
    ; On Failure - Return 0 and set @error to:
    ; 1 - Unable to find Winamp window, probably winamp isn't runing.
    ; 2 - SendMessage fail.
    ;
    ; Author(s): G.Sandler (a.k.a CreatoR) - CreatoR's Lab (http://creator-lab.ucoz.ru)
    ;
    ;=====================================================================
    Func _Winamp_Close($h_Winamp_Wnd = 0)
    Local $hWinamp = WinGetHandle($sWINAMP_CLASS)
    If IsHWnd($h_Winamp_Wnd) Then $hWinamp = $h_Winamp_Wnd

    [/autoit] [autoit][/autoit] [autoit]

    If Not IsHWnd($hWinamp) Then Return SetError(1, 0, 0)

    [/autoit] [autoit][/autoit] [autoit]

    DllCall("user32.dll", "int", "SendMessage", "hwnd", $hWinamp, "int", $cWA_WM_COMMAND, "int", $WINAMP_FILE_QUIT, "int", 0)

    [/autoit] [autoit][/autoit] [autoit]

    If @error Then Return SetError(2, 0, 0)

    [/autoit] [autoit][/autoit] [autoit]

    Return 1
    EndFunc ;==>_Winamp_Close

    [/autoit] [autoit][/autoit] [autoit]

    ;===============================================================================
    ;
    ; Function Name: _Winamp_Restart()
    ;
    ; Function Description: Restart Winamp.
    ;
    ; Parameter(s): $h_Winamp_Wnd - [Optional] Winamp window handle to use
    ; (by default the handle is taken from $sWINAMP_CLASS).
    ;
    ; Requirement(s): None.
    ;
    ; Return Value(s): On Success - Return 1.
    ; On Failure - Return 0 and set @error to:
    ; 1 - Unable to find Winamp window, probably winamp isn't runing.
    ; 2 - SendMessage fail.
    ;
    ; Author(s): G.Sandler (a.k.a CreatoR) - CreatoR's Lab (http://creator-lab.ucoz.ru)
    ;
    ;=====================================================================
    Func _Winamp_Restart($h_Winamp_Wnd = 0)
    Local $hWinamp = WinGetHandle($sWINAMP_CLASS)
    If IsHWnd($h_Winamp_Wnd) Then $hWinamp = $h_Winamp_Wnd

    [/autoit] [autoit][/autoit] [autoit]

    If Not IsHWnd($hWinamp) Then Return SetError(1, 0, 0)

    [/autoit] [autoit][/autoit] [autoit]

    DllCall("user32.dll", "int", "SendMessage", "hwnd", $hWinamp, "int", $WM_WA_IPC, "int", 0, "int", $IPC_RESTARTWINAMP)

    [/autoit] [autoit][/autoit] [autoit]

    If @error Then Return SetError(2, 0, 0)

    [/autoit] [autoit][/autoit] [autoit]

    Return 1
    EndFunc ;==>_Winamp_Restart

    [/autoit] [autoit][/autoit] [autoit]

    ;===============================================================================
    ;
    ; Function Name: _Winamp_Play()
    ;
    ; Function Description: Hits the "Play" button on the main controls window.
    ;
    ; Parameter(s): $iTrack - [Optional] Sets playlist position before start playing.
    ; $iWait - [Optional] Determines if the function should wait for the sound to finish
    ; (considered only if $iMode = -1).
    ; 0 = Continue script, do not wait untill sound finishes playing (default)
    ; 1 = Function will wait untill the sound is finishes playing (status <> playing)
    ; $iMode - [Optional] If this parameter <> -1, instead of pressing the "Play" button,
    ; will popup a menu with few options (the same as right click on the button).
    ; $h_Winamp_Wnd - [Optional] Winamp window handle to use
    ; (by default the handle is taken from $sWINAMP_CLASS).
    ;
    ; Requirement(s): None.
    ;
    ; Return Value(s): On Success - Play specific (or current) track in PlayList and return 1.
    ; On Failure - Return 0 and set @error to:
    ; 1 - Unable to find Winamp window, probably winamp isn't runing.
    ; 2 - SendMessage fail.
    ;
    ; Author(s): G.Sandler (a.k.a CreatoR) - CreatoR's Lab (http://creator-lab.ucoz.ru)
    ;
    ;=====================================================================
    Func _Winamp_Play($iTrack = -1, $iWait = 0, $iMode = -1, $h_Winamp_Wnd = 0)
    Local $hWinamp = WinGetHandle($sWINAMP_CLASS)
    If IsHWnd($h_Winamp_Wnd) Then $hWinamp = $h_Winamp_Wnd

    [/autoit] [autoit][/autoit] [autoit]

    If Not IsHWnd($hWinamp) Then Return SetError(1, 0, 0)

    [/autoit] [autoit][/autoit] [autoit]

    Local $iCurrent_Track = _Winamp_GetPLPosition()
    Local $iPlayStatus = _Winamp_GetCurrentTrackPlayStatus()

    [/autoit] [autoit][/autoit] [autoit]

    If $iMode = -1 And $iPlayStatus = 1 And ($iTrack = $iCurrent_Track Or $iTrack = -1) Then Return 1

    [/autoit] [autoit][/autoit] [autoit]

    If $iTrack >= 0 Then
    _Winamp_SetPLPosition($iTrack)
    $iCurrent_Track = $iTrack
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    Switch $iMode
    Case -1
    DllCall("user32.dll", "int", "SendMessage", "hwnd", $hWinamp, "int", $cWA_WM_COMMAND, "int", $WINAMP_BUTTON2, "int", 0)
    Case Else
    DllCall("user32.dll", "int", "SendMessage", _
    "hwnd", $hWinamp, "int", $WM_WA_IPC, "int", 4, "int", $IPC_SPAWNBUTTONPOPUP)
    EndSwitch

    [/autoit] [autoit][/autoit] [autoit]

    If @error Then Return SetError(2, 0, 0)

    [/autoit] [autoit][/autoit] [autoit]

    If $iMode = -1 And $iWait > 0 Then
    While 1
    $iPlayStatus = _Winamp_GetCurrentTrackPlayStatus()
    If $iPlayStatus = 0 Or _Winamp_GetPLPosition() <> $iCurrent_Track Then ExitLoop

    [/autoit] [autoit][/autoit] [autoit]

    Sleep(100)
    WEnd
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    Return 1
    EndFunc ;==>_Winamp_Play

    [/autoit] [autoit][/autoit] [autoit]

    ;===============================================================================
    ;
    ; Function Name: _Winamp_PlayPauseToggle()
    ;
    ; Function Description: Hits the "Pause" button on the main controls window.
    ;
    ; Parameter(s): $iMode - If this parameter <> -1, instead of pressing the "Pause" button,
    ; will popup a menu with "Play/Pause" options (the same as right click on the button).
    ; $h_Winamp_Wnd - [Optional] Winamp window handle to use
    ; (by default the handle is taken from $sWINAMP_CLASS).
    ;
    ; Requirement(s): None.
    ;
    ; Return Value(s): On Success - Return 1.
    ; On Failure - Return 0 and set @error to:
    ; 1 - Unable to find Winamp window, probably winamp isn't runing.
    ; 2 - SendMessage fail.
    ;
    ; Author(s): G.Sandler (a.k.a CreatoR) - CreatoR's Lab (http://creator-lab.ucoz.ru)
    ;
    ;=====================================================================
    Func _Winamp_PlayPauseToggle($iMode = -1, $h_Winamp_Wnd = 0)
    Local $hWinamp = WinGetHandle($sWINAMP_CLASS)
    If IsHWnd($h_Winamp_Wnd) Then $hWinamp = $h_Winamp_Wnd

    [/autoit] [autoit][/autoit] [autoit]

    If Not IsHWnd($hWinamp) Then Return SetError(1, 0, 0)

    [/autoit] [autoit][/autoit] [autoit]

    Switch $iMode
    Case -1
    DllCall("user32.dll", "int", "SendMessage", "hwnd", $hWinamp, "int", $cWA_WM_COMMAND, "int", $WINAMP_BUTTON3, "int", 0)
    Case Else
    DllCall("user32.dll", "int", "SendMessage", _
    "hwnd", $hWinamp, "int", $WM_WA_IPC, "int", 3, "int", $IPC_SPAWNBUTTONPOPUP)
    EndSwitch

    [/autoit] [autoit][/autoit] [autoit]

    If @error Then Return SetError(2, 0, 0)

    [/autoit] [autoit][/autoit] [autoit]

    Return 1
    EndFunc ;==>_Winamp_PlayauseToggle

    [/autoit] [autoit][/autoit] [autoit]

    ;===============================================================================
    ;
    ; Function Name: _Winamp_Previous()
    ;
    ; Function Description: Hits the "Previous" button on the main controls window.
    ;
    ; Parameter(s): $iMode - If this parameter <> -1, instead of pressing the "Previous" button,
    ; will popup a menu with few options (the same as right click on the button).
    ; $h_Winamp_Wnd - [Optional] Winamp window handle to use
    ; (by default the handle is taken from $sWINAMP_CLASS).
    ;
    ; Requirement(s): None.
    ;
    ; Return Value(s): On Success - Return 1.
    ; On Failure - Return 0 and set @error to:
    ; 1 - Unable to find Winamp window, probably winamp isn't runing.
    ; 2 - SendMessage fail.
    ;
    ; Author(s): G.Sandler (a.k.a CreatoR) - CreatoR's Lab (http://creator-lab.ucoz.ru)
    ;
    ;=====================================================================
    Func _Winamp_Previous($iMode = -1, $h_Winamp_Wnd = 0)
    Local $hWinamp = WinGetHandle($sWINAMP_CLASS)
    If IsHWnd($h_Winamp_Wnd) Then $hWinamp = $h_Winamp_Wnd

    [/autoit] [autoit][/autoit] [autoit]

    If Not IsHWnd($hWinamp) Then Return SetError(1, 0, 0)

    [/autoit] [autoit][/autoit] [autoit]

    Switch $iMode
    Case -1
    DllCall("user32.dll", "int", "SendMessage", "hwnd", $hWinamp, "int", $cWA_WM_COMMAND, "int", $WINAMP_BUTTON1, "int", 0)
    Case Else
    DllCall("user32.dll", "int", "SendMessage", _
    "hwnd", $hWinamp, "int", $WM_WA_IPC, "int", 1, "int", $IPC_SPAWNBUTTONPOPUP)
    EndSwitch

    [/autoit] [autoit][/autoit] [autoit]

    If @error Then Return SetError(2, 0, 0)

    [/autoit] [autoit][/autoit] [autoit]

    Return 1
    EndFunc ;==>_Winamp_Previous

    [/autoit] [autoit][/autoit] [autoit]

    ;===============================================================================
    ;
    ; Function Name: _Winamp_Next()
    ;
    ; Function Description: Hits the "Next" button on the main controls window.
    ;
    ; Parameter(s): $iMode - If this parameter <> -1, instead of pressing the "Next" button,
    ; will popup a menu with few options (the same as right click on the button).
    ; $h_Winamp_Wnd - [Optional] Winamp window handle to use
    ; (by default the handle is taken from $sWINAMP_CLASS).
    ;
    ; Requirement(s): None.
    ;
    ; Return Value(s): On Success - Return 1.
    ; On Failure - Return 0 and set @error to:
    ; 1 - Unable to find Winamp window, probably winamp isn't runing.
    ; 2 - SendMessage fail.
    ;
    ; Author(s): G.Sandler (a.k.a CreatoR) - CreatoR's Lab (http://creator-lab.ucoz.ru)
    ;
    ;=====================================================================
    Func _Winamp_Next($iMode = -1, $h_Winamp_Wnd = 0)
    Local $hWinamp = WinGetHandle($sWINAMP_CLASS)
    If IsHWnd($h_Winamp_Wnd) Then $hWinamp = $h_Winamp_Wnd

    [/autoit] [autoit][/autoit] [autoit]

    If Not IsHWnd($hWinamp) Then Return SetError(1, 0, 0)

    [/autoit] [autoit][/autoit] [autoit]

    Switch $iMode
    Case -1
    DllCall("user32.dll", "int", "SendMessage", "hwnd", $hWinamp, "int", $cWA_WM_COMMAND, "int", $WINAMP_BUTTON5, "int", 0)
    Case Else
    DllCall("user32.dll", "int", "SendMessage", _
    "hwnd", $hWinamp, "int", $WM_WA_IPC, "int", 2, "int", $IPC_SPAWNBUTTONPOPUP)
    EndSwitch

    [/autoit] [autoit][/autoit] [autoit]

    If @error Then Return SetError(2, 0, 0)

    [/autoit] [autoit][/autoit] [autoit]

    Return 1
    EndFunc ;==>_Winamp_Next

    [/autoit] [autoit][/autoit] [autoit]

    ;===============================================================================
    ;
    ; Function Name: _Winamp_Stop()
    ;
    ; Function Description: Hits the "Stop" button on the main controls window.
    ;
    ; Parameter(s): $iMode - If this parameter <> -1, instead of pressing the "Stop" button,
    ; will popup a menu with few options (the same as right click on the button).
    ; $h_Winamp_Wnd - [Optional] Winamp window handle to use
    ; (by default the handle is taken from $sWINAMP_CLASS).
    ;
    ; Requirement(s): None.
    ;
    ; Return Value(s): On Success - Return 1.
    ; On Failure - Return 0 and set @error to:
    ; 1 - Unable to find Winamp window, probably winamp isn't runing.
    ; 2 - SendMessage fail.
    ;
    ; Author(s): G.Sandler (a.k.a CreatoR) - CreatoR's Lab (http://creator-lab.ucoz.ru)
    ;
    ;=====================================================================
    Func _Winamp_Stop($iMode = -1, $h_Winamp_Wnd = 0)
    Local $hWinamp = WinGetHandle($sWINAMP_CLASS)
    If IsHWnd($h_Winamp_Wnd) Then $hWinamp = $h_Winamp_Wnd

    [/autoit] [autoit][/autoit] [autoit]

    If Not IsHWnd($hWinamp) Then Return SetError(1, 0, 0)

    [/autoit] [autoit][/autoit] [autoit]

    Switch $iMode
    Case -1
    DllCall("user32.dll", "int", "SendMessage", "hwnd", $hWinamp, "int", $cWA_WM_COMMAND, "int", $WINAMP_BUTTON4, "int", 0)
    Case Else
    DllCall("user32.dll", "int", "SendMessage", _
    "hwnd", $hWinamp, "int", $WM_WA_IPC, "int", 5, "int", $IPC_SPAWNBUTTONPOPUP)
    EndSwitch

    [/autoit] [autoit][/autoit] [autoit]

    If @error Then Return SetError(2, 0, 0)

    [/autoit] [autoit][/autoit] [autoit]

    Return 1
    EndFunc ;==>_Winamp_Stop

    [/autoit] [autoit][/autoit] [autoit]

    ;===============================================================================
    ;
    ; Function Name: _Winamp_Seek()
    ;
    ; Function Description: Seek in the current track.
    ;
    ; Parameter(s): $iSeek - Defines seek mode, or the position in the song:
    ; -1 -> Rewinds 5 seconds
    ; -2 -> Fast forwards 5 seconds (Default)
    ; >= 0 -> Sets position in the song (in milliseconds).
    ; $h_Winamp_Wnd - [Optional] Winamp window handle to use
    ; (by default the handle is taken from $sWINAMP_CLASS).
    ;
    ; Requirement(s): None.
    ;
    ; Return Value(s): On Success - Return 1.
    ; On Failure - Return 0 and set @error to:
    ; 1 - Unable to find Winamp window, probably winamp isn't runing.
    ; 2 - SendMessage fail.
    ;
    ; Author(s): G.Sandler (a.k.a CreatoR) - CreatoR's Lab (http://creator-lab.ucoz.ru)
    ;
    ;=====================================================================
    Func _Winamp_Seek($iSeek = -2, $h_Winamp_Wnd = 0)
    Local $hWinamp = WinGetHandle($sWINAMP_CLASS)
    If IsHWnd($h_Winamp_Wnd) Then $hWinamp = $h_Winamp_Wnd

    [/autoit] [autoit][/autoit] [autoit]

    If Not IsHWnd($hWinamp) Then Return SetError(1, 0, 0)

    [/autoit] [autoit][/autoit] [autoit]

    Switch $iSeek
    Case -1 ;rewinds 5 seconds
    DllCall("user32.dll", "int", "SendMessage", "hwnd", $hWinamp, "int", $cWA_WM_COMMAND, "int", $WINAMP_REW5S, "int", 0)
    Case -2 ;fast forwards 5 seconds
    DllCall("user32.dll", "int", "SendMessage", "hwnd", $hWinamp, "int", $cWA_WM_COMMAND, "int", $WINAMP_FFWD5S, "int", 0)
    Case Else ;seek current track
    DllCall("user32.dll", "int", "SendMessage", "hwnd", $hWinamp, "int", $WM_WA_IPC, "int", $iSeek, "int", $IPC_JUMPTOTIME)
    EndSwitch

    [/autoit] [autoit][/autoit] [autoit]

    If @error Then Return SetError(2, 0, 0)

    [/autoit] [autoit][/autoit] [autoit]

    Return 1
    EndFunc ;==>_Winamp_Seek

    [/autoit] [autoit][/autoit] [autoit]

    ;===============================================================================
    ;
    ; Function Name: _Winamp_Start()
    ;
    ; Function Description: Execute Winamp.
    ;
    ; Parameter(s): $iMode - If this parameter <> -1 (default is -1),
    ; the winamp instance will not be executed if an instance of Winamp.exe already runing.
    ; $iWait - If this parameter is <> 0,
    ; the function will wait to the process that much seconds before returning.
    ;
    ; Requirement(s): Properly installed Winamp Player.
    ;
    ; Return Value(s): On Success - Return 1.
    ; On Failure - Return 0 and set @error to 1 if unable to find Winamp (reads from the registry).
    ;
    ; Author(s): G.Sandler (a.k.a CreatoR) - CreatoR's Lab (http://creator-lab.ucoz.ru)
    ;
    ;=====================================================================
    Func _Winamp_Start($iMode = -1, $iWait = 5)
    If $iMode = -1 And ProcessExists("Winamp.exe") Then Return 1

    [/autoit] [autoit][/autoit] [autoit]

    Local $iAutoItVersion_Compare = _VersionCompareEx(@AutoItVersion, "3.2.10.0")

    [/autoit] [autoit][/autoit] [autoit]

    Local $iOld_Opt_REF = 0, $sOpt_REF_Str = "RunErrorsFatal"
    If $iAutoItVersion_Compare <= 0 Then $iOld_Opt_REF = Opt($sOpt_REF_Str, 0)

    [/autoit] [autoit][/autoit] [autoit]

    Local $iError = 0, $iPID
    Local $sWinamp_RegPath = RegRead("HKEY_CURRENT_USER\Software\Winamp", "")

    [/autoit] [autoit][/autoit] [autoit]

    If FileExists($sWinamp_RegPath) Then
    $iPID = Run($sWinamp_RegPath & "\Winamp.exe")
    $iError = @error
    Else
    $iError = 1
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    If $iAutoItVersion_Compare <= 0 Then Opt($sOpt_REF_Str, $iOld_Opt_REF)

    [/autoit] [autoit][/autoit] [autoit]

    If $iWait And Not $iError Then
    ProcessWait($iPID, $iWait)
    WinWait($sWINAMP_CLASS, "", $iWait)
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    If $iError Then Return SetError(1, 0, 0)
    Return 1
    EndFunc ;==>_Winamp_Start

    [/autoit] [autoit][/autoit] [autoit]

    ;===============================================================================
    ;
    ; Function Name: _Winamp_SetState()
    ;
    ; Function Description: Set State for Winamp main window. Usefull when we need to hide/show the main window.
    ;
    ; Parameter(s): $iState - State to set (i.e: @SW_MINIMIZE),
    ; if this parameter is -1 (default), then it toggles "always on top" options.
    ; $h_Winamp_Wnd - [Optional] Winamp window handle to use
    ; (by default the handle is taken from $sWINAMP_CLASS).
    ;
    ; Requirement(s): None.
    ;
    ; Return Value(s): On Success - Sets main winamp window state and return 1.
    ; On Failure - Return 0 and set @error to:
    ; 1 - Unable to find Winamp window, probably winamp isn't runing.
    ; 2 - WinSetState() fail to find Winamp window,
    ; or if $iState = -1, then SendMessage faild.
    ;
    ; Author(s): G.Sandler (a.k.a CreatoR) - CreatoR's Lab (http://creator-lab.ucoz.ru)
    ;
    ;=====================================================================
    Func _Winamp_SetState($iState=-1, $h_Winamp_Wnd = 0)
    Local $hWinamp = WinGetHandle($sWINAMP_CLASS)
    If IsHWnd($h_Winamp_Wnd) Then $hWinamp = $h_Winamp_Wnd

    [/autoit] [autoit][/autoit] [autoit]

    If Not IsHWnd($hWinamp) Then Return SetError(1, 0, 0)

    [/autoit] [autoit][/autoit] [autoit]

    Switch $iState
    Case -1
    DllCall("user32.dll", "int", "SendMessage", _
    "hwnd", $hWinamp, "int", $cWA_WM_COMMAND, "int", $WINAMP_OPTIONS_AOT, "int", 0)

    [/autoit] [autoit][/autoit] [autoit]

    If @error Then Return SetError(2, 0, 0)
    Case Else
    If Not WinSetState($hWinamp, "", $iState) Then Return SetError(2, 0, 0)
    EndSwitch

    [/autoit] [autoit][/autoit] [autoit]

    Return 1
    EndFunc ;==>_Winamp_SetState

    [/autoit] [autoit][/autoit] [autoit]

    ;===============================================================================
    ;
    ; Function Name: _Winamp_SetVolume()
    ;
    ; Function Description: Sets the volume of Winamp.
    ;
    ; Parameter(s): $iVolume - Volume to set, from 0 to 255 (depends on next parameter).
    ; $iMode - Defines volume set mode:
    ; -1 -> $iVolume used to set the volume (default).
    ; 0 -> Turns the volume down a little.
    ; 1 -> Turns the volume up a little.
    ; $h_Winamp_Wnd - [Optional] Winamp window handle to use
    ; (by default the handle is taken from $sWINAMP_CLASS).
    ;
    ; Requirement(s): None.
    ;
    ; Return Value(s): On Success - Return 1.
    ; On Failure - Return 0 and set @error to:
    ; 1 - Unable to find Winamp window, probably winamp isn't runing.
    ; 2 - SendMessage fail.
    ;
    ; Author(s): G.Sandler (a.k.a CreatoR) - CreatoR's Lab (http://creator-lab.ucoz.ru)
    ;
    ;=====================================================================
    Func _Winamp_SetVolume($iVolume, $iMode = -1, $h_Winamp_Wnd = 0)
    Local $hWinamp = WinGetHandle($sWINAMP_CLASS)
    If IsHWnd($h_Winamp_Wnd) Then $hWinamp = $h_Winamp_Wnd

    [/autoit] [autoit][/autoit] [autoit]

    If Not IsHWnd($hWinamp) Then Return SetError(1, 0, 0)

    [/autoit] [autoit][/autoit] [autoit]

    Switch $iMode
    Case -1
    DllCall("user32.dll", "int", "SendMessage", "hwnd", $hWinamp, "int", $WM_WA_IPC, "int", $iVolume, "int", $IPC_SETVOLUME)
    Case 0
    DllCall("user32.dll", "int", "SendMessage", _
    "hwnd", $hWinamp, "int", $cWA_WM_COMMAND, "int", $WINAMP_VOLUMEDOWN, "int", 0)
    Case 1
    DllCall("user32.dll", "int", "SendMessage", "hwnd", $hWinamp, "int", $cWA_WM_COMMAND, "int", $WINAMP_VOLUMEUP, "int", 0)
    EndSwitch

    [/autoit] [autoit][/autoit] [autoit]

    If @error Then Return SetError(2, 0, 0)

    [/autoit] [autoit][/autoit] [autoit]

    Return 1
    EndFunc ;==>_Winamp_SetVolume

    [/autoit] [autoit][/autoit] [autoit]

    ;===============================================================================
    ;
    ; Function Name: _Winamp_SetShuffleOption()
    ;
    ; Function Description: Sets the status of the "Shuffle" option.
    ;
    ; Parameter(s): $iMode - 1 to turn it on, 0 to turn it off.
    ; $h_Winamp_Wnd - [Optional] Winamp window handle to use
    ; (by default the handle is taken from $sWINAMP_CLASS).
    ;
    ; Requirement(s): None.
    ;
    ; Return Value(s): On Success - Sets status for "Shuffle" option and return 1.
    ;
    ; On Failure - Return 0 and set @error to:
    ; 1 - Unable to find Winamp window, probably winamp isn't runing.
    ; 2 - Wrong $iMode parameter value.
    ; 3 - SendMessage fail.
    ;
    ; Author(s): G.Sandler (a.k.a CreatoR) - CreatoR's Lab (http://creator-lab.ucoz.ru)
    ;
    ;=====================================================================
    Func _Winamp_SetShuffleOption($iMode = 1, $h_Winamp_Wnd = 0)
    Local $hWinamp = WinGetHandle($sWINAMP_CLASS)
    If IsHWnd($h_Winamp_Wnd) Then $hWinamp = $h_Winamp_Wnd

    [/autoit] [autoit][/autoit] [autoit]

    If Not IsHWnd($hWinamp) Then Return SetError(1, 0, 0)

    [/autoit] [autoit][/autoit] [autoit]

    If $iMode < 0 Or $iMode > 1 Then Return SetError(2, 0, 0)

    [/autoit] [autoit][/autoit] [autoit]

    DllCall("user32.dll", "int", "SendMessage", "hwnd", $hWinamp, "int", $WM_WA_IPC, "int", $iMode, "int", $IPC_SET_SHUFFLE)

    [/autoit] [autoit][/autoit] [autoit]

    If @error Then Return SetError(3, 0, 0)

    [/autoit] [autoit][/autoit] [autoit]

    Return 1
    EndFunc ;==>_Winamp_SetShuffleOption

    [/autoit] [autoit][/autoit] [autoit]

    ;===============================================================================
    ;
    ; Function Name: _Winamp_SetRepeatOption()
    ;
    ; Function Description: Sets the status of the "Repeat" option.
    ;
    ; Parameter(s): $iMode - 1 to turn it on, 0 to turn it off.
    ; $h_Winamp_Wnd - [Optional] Winamp window handle to use
    ; (by default the handle is taken from $sWINAMP_CLASS).
    ;
    ; Requirement(s): None.
    ;
    ; Return Value(s): On Success - Sets status for "Repeat" option and return 1.
    ;
    ; On Failure - Return 0 and set @error to:
    ; 1 - Unable to find Winamp window, probably winamp isn't runing.
    ; 2 - Wrong $iMode parameter value.
    ; 3 - SendMessage fail.
    ;
    ; Author(s): G.Sandler (a.k.a CreatoR) - CreatoR's Lab (http://creator-lab.ucoz.ru)
    ;
    ;=====================================================================
    Func _Winamp_SetRepeatOption($iMode = 1, $h_Winamp_Wnd = 0)
    Local $hWinamp = WinGetHandle($sWINAMP_CLASS)
    If IsHWnd($h_Winamp_Wnd) Then $hWinamp = $h_Winamp_Wnd

    [/autoit] [autoit][/autoit] [autoit]

    If Not IsHWnd($hWinamp) Then Return SetError(1, 0, 0)

    [/autoit] [autoit][/autoit] [autoit]

    If $iMode < 0 Or $iMode > 1 Then Return SetError(2, 0, 0)

    [/autoit] [autoit][/autoit] [autoit]

    DllCall("user32.dll", "int", "SendMessage", "hwnd", $hWinamp, "int", $WM_WA_IPC, "int", $iMode, "int", $IPC_SET_REPEAT)

    [/autoit] [autoit][/autoit] [autoit]

    If @error Then Return SetError(3, 0, 0)

    [/autoit] [autoit][/autoit] [autoit]

    Return 1
    EndFunc ;==>_Winamp_SetRepeatOption

    [/autoit] [autoit][/autoit] [autoit]

    ;===============================================================================
    ;
    ; Function Name: _Winamp_SetPLPosition()
    ;
    ; Function Description: Sets the song position in PlayList.
    ;
    ; Parameter(s): $iPosition - Song position (zero-based).
    ; $h_Winamp_Wnd - [Optional] Winamp window handle to use
    ; (by default the handle is taken from $sWINAMP_CLASS).
    ;
    ; Requirement(s): None.
    ;
    ; Return Value(s): On Success - Set PlayList position and return 1.
    ; On Failure - Return 0 and set @error to:
    ; 1 - Unable to find Winamp window, probably winamp isn't runing.
    ; 2 - SendMessage fail.
    ;
    ; Author(s): G.Sandler (a.k.a CreatoR) - CreatoR's Lab (http://creator-lab.ucoz.ru)
    ;
    ;=====================================================================
    Func _Winamp_SetPLPosition($iPosition, $h_Winamp_Wnd = 0)
    Local $hWinamp = WinGetHandle($sWINAMP_CLASS)
    If IsHWnd($h_Winamp_Wnd) Then $hWinamp = $h_Winamp_Wnd

    [/autoit] [autoit][/autoit] [autoit]

    If Not IsHWnd($hWinamp) Then Return SetError(1, 0, 0)

    [/autoit] [autoit][/autoit] [autoit]

    DllCall("user32.dll", "int", "SendMessage", "hwnd", $hWinamp, "int", $WM_WA_IPC, "int", $iPosition, "int", $IPC_SETPLAYLISTPOS)

    [/autoit] [autoit][/autoit] [autoit]

    If @error Then Return SetError(2, 0, 0)

    [/autoit] [autoit][/autoit] [autoit]

    Return 1
    EndFunc ;==>_Winamp_SetPLPosition

    [/autoit] [autoit][/autoit] [autoit]

    ;===============================================================================
    ;
    ; Function Name: _Winamp_GetPLPosition()
    ;
    ; Function Description: Get current zero-based song position in PlayList.
    ;
    ; Parameter(s): $h_Winamp_Wnd - [Optional] Winamp window handle to use
    ; (by default the handle is taken from $sWINAMP_CLASS).
    ;
    ; Requirement(s): None.
    ;
    ; Return Value(s): On Success - Returns PlayList position.
    ; On Failure - Return 0 and set @error to:
    ; 1 - Unable to find Winamp window, probably winamp isn't runing.
    ; 2 - SendMessage fail.
    ;
    ; Author(s): G.Sandler (a.k.a CreatoR) - CreatoR's Lab (http://creator-lab.ucoz.ru)
    ;
    ;=====================================================================
    Func _Winamp_GetPLPosition($h_Winamp_Wnd = 0)
    Local $hWinamp = WinGetHandle($sWINAMP_CLASS)
    If IsHWnd($h_Winamp_Wnd) Then $hWinamp = $h_Winamp_Wnd

    [/autoit] [autoit][/autoit] [autoit]

    If Not IsHWnd($hWinamp) Then Return SetError(1, 0, 0)

    [/autoit] [autoit][/autoit] [autoit]

    Local $aRet = DllCall("user32.dll", "int", "SendMessage", "hwnd", $hWinamp, "int", $WM_WA_IPC, "int", 0, "int", $IPC_GETLISTPOS)

    [/autoit] [autoit][/autoit] [autoit]

    If @error Then Return SetError(2, 0, 0)

    [/autoit] [autoit][/autoit] [autoit]

    Return $aRet[0]
    EndFunc ;==>_Winamp_GetPLPosition

    [/autoit] [autoit][/autoit] [autoit]

    ;===============================================================================
    ;
    ; Function Name: _Winamp_GetPlayListToArray()
    ;
    ; Function Description: Get Current Playlist to array.
    ;
    ; Parameter(s): $h_Winamp_Wnd - [Optional] Winamp window handle to use
    ; (by default the handle is taken from $sWINAMP_CLASS).
    ;
    ; Requirement(s): None.
    ;
    ; Return Value(s): On Success - Returns 2 dimensional array $aRet_Array with the PlayList entries, where:
    ; [0][0] = Array element of current song (in $aRet_Array).
    ; [n][0] = Song Title.
    ; [n][1] = Song File Path.
    ;
    ; On Failure - Return 0 and set @error to:
    ; 1 - Unable to find Winamp window, probably winamp isn't runing.
    ; 2 - SendMessage fail.
    ; 3 - Can not access to winamp playlist memory.
    ; 4 - Error to Open user32.dll.
    ;
    ; Author(s): weaponx (mod. by G.Sandler)
    ;
    ;=====================================================================
    Func _Winamp_GetPlayListToArray($h_Winamp_Wnd = 0)
    Local $aRet_Array[1][1]
    Local $hWinamp, $iWinamp_PID, $iNull, $pAddress_Title, $pAddress_FPath, $hUser32Dll, $iNumTracks, $aCurrent_Track

    [/autoit] [autoit][/autoit] [autoit]

    $hWinamp = WinGetHandle($sWINAMP_CLASS)
    If IsHWnd($h_Winamp_Wnd) Then $hWinamp = $h_Winamp_Wnd

    [/autoit] [autoit][/autoit] [autoit]

    If Not IsHWnd($hWinamp) Then Return SetError(1, 0, 0)

    [/autoit] [autoit][/autoit] [autoit]

    $iWinamp_PID = WinGetProcess($hWinamp)

    [/autoit] [autoit][/autoit] [autoit]

    ;Return number of tracks in playlist
    $iNumTracks = DllCall("user32.dll", "int", "SendMessage", "hwnd", $hWinamp, "int", _
    $WM_WA_IPC, "int", 0, "int", $IPC_GETLISTLENGTH)
    If @error Then Return SetError(2, 0, 0)

    [/autoit] [autoit][/autoit] [autoit]

    $iNumTracks = $iNumTracks[0]

    [/autoit] [autoit][/autoit] [autoit]

    $aRet_Array[0][0] = $iNumTracks
    ReDim $aRet_Array[$iNumTracks + 1][2]

    [/autoit] [autoit][/autoit] [autoit]

    ;Return current playlist position (zero based)
    $aCurrent_Track = DllCall("user32.dll", "int", "SendMessage", _
    "hwnd", $hWinamp, "int", $WM_WA_IPC, "int", 0, "int", $IPC_GETLISTPOS)

    [/autoit] [autoit][/autoit] [autoit]

    If Not @error Then $aRet_Array[0][0] = $aCurrent_Track[0] + 1

    [/autoit] [autoit][/autoit] [autoit]

    ;IMPORTANT - First song will be skipped without this
    $iNull = __API_GetInfoByAddress(0, 0)
    If @error Then Return SetError(3, 0, 0)

    [/autoit] [autoit][/autoit] [autoit]

    $hUser32Dll = DllOpen("user32.dll")
    If $hUser32Dll = -1 Then Return SetError(4, 0, 0)

    [/autoit] [autoit][/autoit] [autoit]

    For $i = 0 To $iNumTracks - 1
    $pAddress_Title = 0
    $pAddress_FPath = 0

    [/autoit] [autoit][/autoit] [autoit]

    ;Return memory address (pointer) of track title
    $pAddress_Title = DllCall($hUser32Dll, "int", "SendMessage", _
    "hwnd", $hWinamp, "int", $WM_WA_IPC, "int", $i, "int", $IPC_GET_PLAYLISTTITLE)
    If @error Then ContinueLoop

    [/autoit] [autoit][/autoit] [autoit]

    $aRet_Array[$i + 1][0] = __API_GetInfoByAddress($pAddress_Title[0], $iWinamp_PID)
    If @error Then Return SetError(3, 0, 0)

    [/autoit] [autoit][/autoit] [autoit]

    ;Return memory address (pointer) of track file path
    $pAddress_FPath = DllCall($hUser32Dll, "int", "SendMessage", _
    "hwnd", $hWinamp, "int", $WM_WA_IPC, "int", $i, "int", $IPC_GETPLAYLISTFILEW)
    If @error Then ContinueLoop

    [/autoit] [autoit][/autoit] [autoit]

    $aRet_Array[$i + 1][1] = __API_GetInfoByAddress($pAddress_FPath[0], $iWinamp_PID)
    If @error Then Return SetError(3, 0, 0)
    Next

    [/autoit] [autoit][/autoit] [autoit]

    DllClose($hUser32Dll)

    [/autoit] [autoit][/autoit] [autoit]

    Return $aRet_Array
    EndFunc ;==>_Winamp_GetPlayListToArray

    [/autoit] [autoit][/autoit] [autoit]

    ;===============================================================================
    ;
    ; Function Name: _Winamp_GetCurrentTrackTitle()
    ;
    ; Function Description: Gets current song title.
    ;
    ; Parameter(s): $iMode - Defins what to return:
    ; $iMode = -1 (default) will return song title.
    ; $iMode <> -1 returns song position (zero-based).
    ; $h_Winamp_Wnd - [Optional] Winamp window handle to use
    ; (by default the handle is taken from $sWINAMP_CLASS).
    ;
    ; Requirement(s): None.
    ;
    ; Return Value(s): On Success - Return current title/track position (depends on the $iMode).
    ; On Failure - Return "" and set @error to:
    ; 1 - Unable to find Winamp window, probably winamp isn't runing.
    ; 2 - SendMessage fail (unable to get list current position).
    ; 2 - SendMessage fail (unable to get title).
    ; 4 - Can not access to winamp playlist memory.
    ;
    ; Author(s): G.Sandler (a.k.a CreatoR) - CreatoR's Lab (http://creator-lab.ucoz.ru)
    ;
    ;=====================================================================
    Func _Winamp_GetCurrentTrackTitle($iMode = -1, $h_Winamp_Wnd = 0)
    Local $hWinamp = WinGetHandle($sWINAMP_CLASS)
    If IsHWnd($h_Winamp_Wnd) Then $hWinamp = $h_Winamp_Wnd

    [/autoit] [autoit][/autoit] [autoit]

    If Not IsHWnd($hWinamp) Then Return SetError(1, 0, "")

    [/autoit] [autoit][/autoit] [autoit]

    ;Return current playlist position (zero based)
    Local $iCurrent_Track = DllCall("user32.dll", "int", "SendMessage", _
    "hwnd", $hWinamp, "int", $WM_WA_IPC, "int", 0, "int", $IPC_GETLISTPOS)

    [/autoit] [autoit][/autoit] [autoit]

    If @error Then Return SetError(2, 0, "")

    [/autoit] [autoit][/autoit] [autoit]

    If $iMode <> -1 Then Return $iCurrent_Track[0]

    [/autoit] [autoit][/autoit] [autoit]

    Local $pAddress = DllCall("user32.dll", "int", "SendMessage", _
    "hwnd", $hWinamp, "int", $WM_WA_IPC, "int", $iCurrent_Track[0], "int", $IPC_GET_PLAYLISTTITLE)

    [/autoit] [autoit][/autoit] [autoit]

    If @error Then Return SetError(3, 0, "")

    [/autoit] [autoit][/autoit] [autoit]

    Local $sRet_Song = __API_GetInfoByAddress($pAddress[0], WinGetProcess($hWinamp))
    If @error Then Return SetError(4, 0, "")

    [/autoit] [autoit][/autoit] [autoit]

    Return $sRet_Song
    EndFunc ;==>_Winamp_GetCurrentTrackTitle

    [/autoit] [autoit][/autoit] [autoit]

    ;===============================================================================
    ;
    ; Function Name: _Winamp_GetCurrentTrackFilePath()
    ;
    ; Function Description: Gets current song file path.
    ;
    ; Parameter(s): $h_Winamp_Wnd - [Optional] Winamp window handle to use
    ; (by default the handle is taken from $sWINAMP_CLASS).
    ;
    ; Requirement(s): None.
    ;
    ; Return Value(s): On Success - Return current file path.
    ; On Failure - Return "" and set @error to:
    ; 1 - Unable to find Winamp window, probably winamp isn't runing.
    ; 2 - SendMessage fail (unable to get list current position).
    ; 2 - SendMessage fail (unable to get title).
    ; 4 - Can not access to winamp playlist memory.
    ;
    ; Author(s): G.Sandler (a.k.a CreatoR) - CreatoR's Lab (http://creator-lab.ucoz.ru)
    ;
    ;=====================================================================
    Func _Winamp_GetCurrentTrackFilePath($h_Winamp_Wnd = 0)
    Local $hWinamp = WinGetHandle($sWINAMP_CLASS)
    If IsHWnd($h_Winamp_Wnd) Then $hWinamp = $h_Winamp_Wnd

    [/autoit] [autoit][/autoit] [autoit]

    If Not IsHWnd($hWinamp) Then Return SetError(1, 0, "")

    [/autoit] [autoit][/autoit] [autoit]

    ;Return current playlist position (zero based)
    Local $iCurrent_Track = DllCall("user32.dll", "int", "SendMessage", _
    "hwnd", $hWinamp, "int", $WM_WA_IPC, "int", 0, "int", $IPC_GETLISTPOS)

    [/autoit] [autoit][/autoit] [autoit]

    If @error Then Return SetError(2, 0, "")

    [/autoit] [autoit][/autoit] [autoit]

    Local $pAddress = DllCall("user32.dll", "int", "SendMessage", _
    "hwnd", $hWinamp, "int", $WM_WA_IPC, "int", $iCurrent_Track[0], "int", $IPC_GETPLAYLISTFILEW)

    [/autoit] [autoit][/autoit] [autoit]

    If @error Then Return SetError(3, 0, "")

    [/autoit] [autoit][/autoit] [autoit]

    Local $sRet_Song = __API_GetInfoByAddress($pAddress[0], WinGetProcess($hWinamp))
    If @error Then Return SetError(4, 0, "")

    [/autoit] [autoit][/autoit] [autoit]

    Return $sRet_Song
    EndFunc ;==>_Winamp_GetCurrentTrackFilePath

    [/autoit] [autoit][/autoit] [autoit]

    ;===============================================================================
    ;
    ; Function Name: _Winamp_GetCurrentTrackOutputTime()
    ;
    ; Function Description: Gets current track time.
    ;
    ; Parameter(s): $iMode - Defines what to return:
    ; $iMode = -1 (default) returns current position (in milliseconds).
    ; $iMode <> -1 returns the track length (in milliseconds).
    ; $h_Winamp_Wnd - [Optional] Winamp window handle to use
    ; (by default the handle is taken from $sWINAMP_CLASS).
    ;
    ; Requirement(s): None.
    ;
    ; Return Value(s): On Success - Return output time for current track.
    ; On Failure - Return -1 and set @error to:
    ; 1 - Unable to find Winamp window, probably winamp isn't runing.
    ; 2 - SendMessage fail.
    ;
    ; Author(s): G.Sandler (a.k.a CreatoR) - CreatoR's Lab (http://creator-lab.ucoz.ru)
    ;
    ;=====================================================================
    Func _Winamp_GetCurrentTrackOutputTime($iMode = -1, $h_Winamp_Wnd = 0)
    Local $hWinamp = WinGetHandle($sWINAMP_CLASS)
    If IsHWnd($h_Winamp_Wnd) Then $hWinamp = $h_Winamp_Wnd

    [/autoit] [autoit][/autoit] [autoit]

    If Not IsHWnd($hWinamp) Then Return SetError(1, 0, -1)

    [/autoit] [autoit][/autoit] [autoit]

    Local $aRet

    [/autoit] [autoit][/autoit] [autoit]

    Switch $iMode
    Case -1
    $aRet = DllCall("user32.dll", "int", "SendMessage", _
    "hwnd", $hWinamp, "int", $WM_WA_IPC, "int", 0, "int", $IPC_GETOUTPUTTIME)
    Case Else
    $aRet = DllCall("user32.dll", "int", "SendMessage", _
    "hwnd", $hWinamp, "int", $WM_WA_IPC, "int", 1, "int", $IPC_GETOUTPUTTIME)
    EndSwitch

    [/autoit] [autoit][/autoit] [autoit]

    If @error Then Return SetError(2, 0, -1)

    [/autoit] [autoit][/autoit] [autoit]

    If $iMode <> -1 Then $aRet[0] *= 1000 ;Make it ms.

    [/autoit] [autoit][/autoit] [autoit]

    Return $aRet[0]
    EndFunc ;==>_Winamp_GetCurrentTrackOutputTime

    [/autoit] [autoit][/autoit] [autoit]

    ;===============================================================================
    ;
    ; Function Name: _Winamp_GetCurrentTrackInfo()
    ;
    ; Function Description: Gets current track info.
    ;
    ; Parameter(s): $iMode - Defines what to return:
    ; $iMode = -1 (default) returns array with the following values:
    ; $aRet_Array[0] = Samplerate (i.e. 44100)
    ; $aRet_Array[1] = Bitrate (i.e. 128)
    ; $aRet_Array[2] = Channels (i.e. 2)
    ; $aRet_Array[3] = Video LOWORD=w HIWORD=h
    ; $aRet_Array[4] = > 65536, string (video description)
    ;
    ; $iMode = 0 Samplerate (i.e. 44100).
    ; $iMode = 1 Bitrate (i.e. 128).
    ; $iMode = 2 Channels (i.e. 2).
    ; $iMode = 3 Video LOWORD=w HIWORD=h.
    ; $iMode = 4 > 65536, string (video description).
    ; $h_Winamp_Wnd - [Optional] Winamp window handle to use
    ; (by default the handle is taken from $sWINAMP_CLASS).
    ;
    ; Requirement(s): For the video info Winamp v5.x +.
    ;
    ; Return Value(s): On Success - Return track info accourding to the $iMode parameters.
    ; On Failure - Return 0 and set @error to:
    ; 1 - Unable to find Winamp window, probably winamp isn't runing.
    ; 2 - Wrong $iMode parameter value.
    ; 3 - SendMessage fail.
    ;
    ; Author(s): G.Sandler (a.k.a CreatoR) - CreatoR's Lab (http://creator-lab.ucoz.ru)
    ;
    ;=====================================================================
    Func _Winamp_GetCurrentTrackInfo($iMode = -1, $h_Winamp_Wnd = 0)
    Local $hWinamp = WinGetHandle($sWINAMP_CLASS)
    If IsHWnd($h_Winamp_Wnd) Then $hWinamp = $h_Winamp_Wnd

    [/autoit] [autoit][/autoit] [autoit]

    If Not IsHWnd($hWinamp) Then Return SetError(1, 0, 0)

    [/autoit] [autoit][/autoit] [autoit]

    If $iMode < -1 Or $iMode > 4 Then Return SetError(2, 0, 0)

    [/autoit] [autoit][/autoit] [autoit]

    Local $aRet, $aRet_Array[5]

    [/autoit] [autoit][/autoit] [autoit]

    For $i = 0 To 4
    $aRet = DllCall("user32.dll", "int", "SendMessage", "hwnd", $hWinamp, "int", $WM_WA_IPC, "int", $i, "int", $IPC_GETINFO)

    [/autoit] [autoit][/autoit] [autoit]

    If @error Then Return SetError(3, 0, 0)

    [/autoit] [autoit][/autoit] [autoit]

    $aRet_Array[$i] = $aRet[0]

    [/autoit] [autoit][/autoit] [autoit]

    If $iMode = $i Then Return $aRet[0]
    Next

    [/autoit] [autoit][/autoit] [autoit]

    Return $aRet_Array
    EndFunc ;==>_Winamp_GetCurrentTrackInfo

    [/autoit] [autoit][/autoit] [autoit]

    ;===============================================================================
    ;
    ; Function Name: _Winamp_GetCurrentTrackPlayStatus()
    ;
    ; Function Description: Gets play status.
    ;
    ; Parameter(s): $h_Winamp_Wnd - [Optional] Winamp window handle to use
    ; (by default the handle is taken from $sWINAMP_CLASS).
    ;
    ; Requirement(s): None.
    ;
    ; Return Value(s): On Success - Return 1 if song is currently playing, returns 3 if it's paused, and 0 if it's stopped.
    ; On Failure - Return -1 and set @error to:
    ; 1 - Unable to find Winamp window, probably winamp isn't runing.
    ; 2 - SendMessage fail.
    ;
    ; Author(s): G.Sandler (a.k.a CreatoR) - CreatoR's Lab (http://creator-lab.ucoz.ru)
    ;
    ;=====================================================================
    Func _Winamp_GetCurrentTrackPlayStatus($h_Winamp_Wnd = 0)
    Local $hWinamp = WinGetHandle($sWINAMP_CLASS)
    If IsHWnd($h_Winamp_Wnd) Then $hWinamp = $h_Winamp_Wnd

    [/autoit] [autoit][/autoit] [autoit]

    If Not IsHWnd($hWinamp) Then Return SetError(1, 0, -1)

    [/autoit] [autoit][/autoit] [autoit]

    Local $aRet = DllCall("user32.dll", "int", "SendMessage", _
    "hwnd", $hWinamp, "int", $WM_WA_IPC, "int", 0, "int", $IPC_ISPLAYING)

    [/autoit] [autoit][/autoit] [autoit]

    If @error Then Return SetError(2, 0, -1)

    [/autoit] [autoit][/autoit] [autoit]

    Return $aRet[0]
    EndFunc ;==>_Winamp_GetCurrentTrackPlayStatus

    [/autoit] [autoit][/autoit] [autoit]

    ;===============================================================================
    ;
    ; Function Name: _Winamp_GetVolume()
    ;
    ; Function Description: Gets the current volume for Winamp Player.
    ;
    ; Parameter(s): $h_Winamp_Wnd - [Optional] Winamp window handle to use
    ; (by default the handle is taken from $sWINAMP_CLASS).
    ;
    ; Requirement(s): None.
    ;
    ; Return Value(s): On Success - Return current volume value from 0-255, @extended includes volume percentage value.
    ; On Failure - Return 0 and set @error to:
    ; 1 - Unable to find Winamp window, probably winamp isn't runing.
    ; 2 - SendMessage fail.
    ;
    ; Author(s): G.Sandler (a.k.a CreatoR) - CreatoR's Lab (http://creator-lab.ucoz.ru)
    ;
    ;=====================================================================
    Func _Winamp_GetVolume($h_Winamp_Wnd = 0)
    Local $hWinamp = WinGetHandle($sWINAMP_CLASS)
    If IsHWnd($h_Winamp_Wnd) Then $hWinamp = $h_Winamp_Wnd

    [/autoit] [autoit][/autoit] [autoit]

    If Not IsHWnd($hWinamp) Then Return SetError(1, 0, 0)

    [/autoit] [autoit][/autoit] [autoit]

    Local $aRet = DllCall("user32.dll", "int", "SendMessage", "hwnd", $hWinamp, _
    "int", $WM_WA_IPC, "int", -666, "int", $IPC_SETVOLUME)

    [/autoit] [autoit][/autoit] [autoit]

    If @error Then Return SetError(2, 0, 0)

    [/autoit] [autoit][/autoit] [autoit]

    Return SetExtended(Int($aRet[0] / 255 * 100), $aRet[0])
    EndFunc ;==>_Winamp_GetVolume

    [/autoit] [autoit][/autoit] [autoit]

    ;===============================================================================
    ;
    ; Function Name: _Winamp_GetVersion()
    ;
    ; Function Description: Gets Winamp version.
    ;
    ; Parameter(s): $h_Winamp_Wnd - [Optional] Winamp window handle to use
    ; (by default the handle is taken from $sWINAMP_CLASS).
    ;
    ; Requirement(s): None.
    ;
    ; Return Value(s): On Success - Return Winamp version.
    ; Version will be 0x20yx for winamp 2.yx. versions previous to Winamp 2.0,
    ; typically (but not always) use 0x1zyx for 1.zx versions. Weird, I know.
    ;
    ; On Failure - Return 0 and set @error to:
    ; 1 - Unable to find Winamp window, probably winamp isn't runing.
    ; 2 - SendMessage fail.
    ;
    ; Author(s): G.Sandler (a.k.a CreatoR) - CreatoR's Lab (http://creator-lab.ucoz.ru)
    ;
    ;=====================================================================
    Func _Winamp_GetVersion($h_Winamp_Wnd = 0)
    Local $hWinamp = WinGetHandle($sWINAMP_CLASS)
    If IsHWnd($h_Winamp_Wnd) Then $hWinamp = $h_Winamp_Wnd

    [/autoit] [autoit][/autoit] [autoit]

    If Not IsHWnd($hWinamp) Then Return SetError(1, 0, 0)

    [/autoit] [autoit][/autoit] [autoit]

    Local $aRet = DllCall("user32.dll", "int", "SendMessage", _
    "hwnd", $hWinamp, "int", $WM_WA_IPC, "int", 0, "int", $IPC_GETVERSION)

    [/autoit] [autoit][/autoit] [autoit]

    If @error Then Return SetError(2, 0, 0)

    [/autoit] [autoit][/autoit] [autoit]

    Return $aRet[0]
    EndFunc ;==>_Winamp_GetVersion

    [/autoit] [autoit][/autoit] [autoit]

    ;===============================================================================
    ;
    ; Function Name: _Winamp_GetShuffleOption()
    ;
    ; Function Description: Gets the status of the "Shuffle" option.
    ;
    ; Parameter(s): $h_Winamp_Wnd - [Optional] Winamp window handle to use
    ; (by default the handle is taken from $sWINAMP_CLASS).
    ;
    ; Requirement(s): None.
    ;
    ; Return Value(s): On Success - Return 1 if the option is turned on.
    ; On Failure - Return -1 and set @error to:
    ; 1 - Unable to find Winamp window, probably winamp isn't runing.
    ; 2 - Wrong $iMode parameter value.
    ; 3 - SendMessage fail.
    ;
    ; Author(s): G.Sandler (a.k.a CreatoR) - CreatoR's Lab (http://creator-lab.ucoz.ru)
    ;
    ;=====================================================================
    Func _Winamp_GetShuffleOption($h_Winamp_Wnd = 0)
    Local $hWinamp = WinGetHandle($sWINAMP_CLASS)
    If IsHWnd($h_Winamp_Wnd) Then $hWinamp = $h_Winamp_Wnd

    [/autoit] [autoit][/autoit] [autoit]

    If Not IsHWnd($hWinamp) Then Return SetError(1, 0, -1)

    [/autoit] [autoit][/autoit] [autoit]

    Local $aRet = DllCall("user32.dll", "int", "SendMessage", _
    "hwnd", $hWinamp, "int", $WM_WA_IPC, "int", 0, "int", $IPC_GET_SHUFFLE)

    [/autoit] [autoit][/autoit] [autoit]

    If @error Then Return SetError(2, 0, -1)

    [/autoit] [autoit][/autoit] [autoit]

    Return $aRet[0]
    EndFunc ;==>_Winamp_GetShuffleOption

    [/autoit] [autoit][/autoit] [autoit]

    ;===============================================================================
    ;
    ; Function Name: _Winamp_GetRepeatOption()
    ;
    ; Function Description: Gets the status of the "Repeat" option.
    ;
    ; Parameter(s): $h_Winamp_Wnd - [Optional] Winamp window handle to use
    ; (by default the handle is taken from $sWINAMP_CLASS).
    ;
    ; Requirement(s): None.
    ;
    ; Return Value(s): On Success - Return 1 if the option is turned on.
    ; On Failure - Return -1 and set @error to:
    ; 1 - Unable to find Winamp window, probably winamp isn't runing.
    ; 2 - Wrong $iMode parameter value.
    ; 3 - SendMessage fail.
    ;
    ; Author(s): G.Sandler (a.k.a CreatoR) - CreatoR's Lab (http://creator-lab.ucoz.ru)
    ;
    ;=====================================================================
    Func _Winamp_GetRepeatOption($h_Winamp_Wnd = 0)
    Local $hWinamp = WinGetHandle($sWINAMP_CLASS)
    If IsHWnd($h_Winamp_Wnd) Then $hWinamp = $h_Winamp_Wnd

    [/autoit] [autoit][/autoit] [autoit]

    If Not IsHWnd($hWinamp) Then Return SetError(1, 0, -1)

    [/autoit] [autoit][/autoit] [autoit]

    Local $aRet = DllCall("user32.dll", "int", "SendMessage", _
    "hwnd", $hWinamp, "int", $WM_WA_IPC, "int", 0, "int", $IPC_GET_REPEAT)

    [/autoit] [autoit][/autoit] [autoit]

    If @error Then Return SetError(2, 0, -1)

    [/autoit] [autoit][/autoit] [autoit]

    Return $aRet[0]
    EndFunc ;==>_Winamp_GetRepeatOption

    [/autoit] [autoit][/autoit] [autoit]

    ;==============================================================================
    ;Author: weaponx (mod. by G.Sandler)
    Func __API_GetInfoByAddress($lpszTitle, $iPID)
    ; Open the process so we can read from it. The call will return a process handle.
    Local $aRet = DllCall("kernel32.dll", "uint", "OpenProcess", "byte", 0x10, "int", 0, "int", $iPID)
    Local $hProcess = $aRet[0], $sSongTitle = "", $hKernel32Dll, $v_Struct, $stData

    [/autoit] [autoit][/autoit] [autoit]

    $hKernel32Dll = DllOpen('kernel32.dll')
    If $hKernel32Dll = -1 Then Return SetError(1, 0, "")

    [/autoit] [autoit][/autoit] [autoit]

    ; We have to read byte after byte until we encounter a "00" byte (string ends).

    [/autoit] [autoit][/autoit] [autoit]

    While 1
    ; Read from WinAMP's memory. Value will be copied into the string buffer,
    ;which must contain exactly one character because ReadProcessMemory won't terminate the string,
    ;only overwrite its contents.
    ;$Output = "x" ; Put exactly one character in as a placeholder.
    $v_Struct = DllStructCreate('byte[1]')

    [/autoit] [autoit][/autoit] [autoit]

    DllCall($hKernel32Dll, 'int', 'ReadProcessMemory', 'int', $hProcess, 'int', $lpszTitle, _
    'int', DllStructGetPtr($v_Struct, 1), 'int', 1, 'int', 0)

    [/autoit] [autoit][/autoit] [autoit]

    ; Error checking - i.e. no permission for reading from the process's memory
    If @error Then
    DllCall($hKernel32Dll, "int", "CloseHandle", "int", $hProcess)
    DllClose($hKernel32Dll)
    Return SetError(2, 0, "")
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    $stData = DllStructGetData($v_Struct, 1)

    [/autoit] [autoit][/autoit] [autoit]

    ; If the value of the byte read is zero we are at the end of the string.
    If $stData = 0 Then ExitLoop

    [/autoit] [autoit][/autoit] [autoit]

    ; Append the character to our teststr variable that will hold the whole title string
    $sSongTitle &= Chr($stData)

    [/autoit] [autoit][/autoit] [autoit]

    ; Increment address by one to obtain next byte
    $lpszTitle += 1
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    DllCall($hKernel32Dll, "int", "CloseHandle", "int", $hProcess) ; ErrorLevel and return value are not checked.
    DllClose($hKernel32Dll)

    [/autoit] [autoit][/autoit] [autoit]

    Return $sSongTitle
    EndFunc ;==>__API_GetInfoByAddress

    [/autoit] [autoit][/autoit] [autoit]

    ;==============================================================================
    ; Author: WeaponX (mod. by MrCreatoR)
    ;
    ;Return Values
    ; 0 string1 and string2 are equal
    ; 1 string1 is greater than string2
    ; -1 string1 is less than string2
    ;==============================================================================
    Func _VersionCompareEx($sVersion_a, $sVersion_b)
    ;Set default return value to same
    Local $iRet = 0
    Local $aVersion_a = StringSplit($sVersion_a, "."), $aVersion_b = StringSplit($sVersion_b, ".")

    [/autoit] [autoit][/autoit] [autoit]

    ;Determine number of positions to compare against
    Local $iNumPositions = $aVersion_a[0]
    If $aVersion_b[0] > $aVersion_a[0] Then $iNumPositions = $aVersion_b[0]

    [/autoit] [autoit][/autoit] [autoit]

    ;Declare temp arrays
    Dim $aVersion_a_Compare[$iNumPositions], $aVersion_b_Compare[$iNumPositions]

    [/autoit] [autoit][/autoit] [autoit]

    ;Fill temp arrays with zeros
    For $i = 0 To $iNumPositions - 1
    $aVersion_a_Compare[$i] = 0
    $aVersion_b_Compare[$i] = 0
    Next

    [/autoit] [autoit][/autoit] [autoit]

    ;Copy anything available from first input version
    For $i = 1 To $aVersion_a[0]
    If $i > $iNumPositions Then ExitLoop

    [/autoit] [autoit][/autoit] [autoit]

    ;Strip leading zeroes
    $sStripped = StringRegExpReplace($aVersion_a[$i], "^0+", "")

    [/autoit] [autoit][/autoit] [autoit]

    If $sStripped <> "" Then $aVersion_a_Compare[$i - 1] = $sStripped
    Next

    [/autoit] [autoit][/autoit] [autoit]

    ;Copy anything available from second input version
    For $i = 1 To $aVersion_b[0]
    If $i > $iNumPositions Then ExitLoop

    [/autoit] [autoit][/autoit] [autoit]

    ;Strip leading zeroes
    $sStripped = StringRegExpReplace($aVersion_b[$i], "^0+", "")

    [/autoit] [autoit][/autoit] [autoit]

    If $sStripped <> "" Then $aVersion_b_Compare[$i - 1] = $sStripped
    Next

    [/autoit] [autoit][/autoit] [autoit]

    ;Compare each individual element instead of whole string
    For $i = 0 To $iNumPositions - 1
    $iRet = StringCompare($aVersion_a_Compare[$i], $aVersion_b_Compare[$i])
    If $iRet <> 0 Then ExitLoop
    Next

    [/autoit] [autoit][/autoit] [autoit]

    Return $iRet
    EndFunc ;==>_VersionCompareEx

    [/autoit]
    UNPLEASANT SPOILER

    You just lost the game!