Guidance
指路人
g.yi.org
software / rapidq / Examples / Audio & Video / QWinAmp / qwinamp.inc

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
'******************************************************************************
' Winamp Control functions for RapidQ                                         *
'******************************************************************************
'
' by
'
' Dreadsoft® Corporation
' http://dreadsoft.too.it
' dreadsoft@yahoo.it
'
' You are completely free to use, distribute, modify and even
' sell (...why ?!?) this file.


     $TYPECHECK ON
     $APPTYPE GUI

     $IFNDEF BOOL
      $DEFINE BOOL INTEGER
     $ENDIF

     $IFNDEF FALSE
      $DEFINE FALSE 0
     $ENDIF

     $IFNDEF TRUE
      $DEFINE TRUE  1
     $ENDIF



'******************************************************************************
' Winamp API Constants                                                        *
'******************************************************************************
     CONST WA_PREVIOUS_TRACK_BTN = 40044
     CONST WA_NEXT_TRACK_BTN = 40048
     CONST WA_PLAY_BTN = 40045
     CONST WA_PAUSE_BTN = 40046
     CONST WA_STOP_BTN = 40047
     CONST WA_FADEOUT_AND_STOP = 40147
     CONST WA_STOP_AFTER_CURRENT_TRACK = 40157
     CONST WA_FAST_FORWARD = 40148
     CONST WA_FAST_REWIND = 40144
     CONST WA_START_OF_PLAYLIST = 40154
     CONST WA_END_OF_PLAYLIST = 40158
     CONST WA_OPEN_FILE_DIALOG = 40029
     CONST WA_OPEN_URL_DIALOG = 40155
     CONST WA_OPEN_FILE_INFO_BOX = 40188
     CONST WA_SET_TIME_DISPLAY_MODE_TO_ELAPSED = 40037
     CONST WA_SET_TIME_DISPLAY_MODE_TO_REMAINING = 40038
     CONST WA_TOGGLE_PREFERENCES_SCREEN = 40012
     CONST WA_OPEN_VISUALIZATION_OPTIONS = 40190
     CONST WA_OPEN_VISUALIZATION_PLUGIN_OPTIONS = 40191
     CONST WA_EXECUTE_CURRENT_VISUALIZATION_PLUGIN = 40192
     CONST WA_TOGGLE_ABOUT_BOX = 40041
     CONST WA_TOGGLE_TITLE_AUTOSCROLLING = 40189
     CONST WA_TOGGLE_ALWAYS_ON_TOP = 40019
     CONST WA_TOGGLE_WINDOWSHADE = 40064
     CONST WA_TOGGLE_PLAYLIST_WINDOWSHADE = 40266
     CONST WA_TOGGLE_DOUBLESIZE_MODE = 40165
     CONST WA_TOGGLE_EQ = 40036
     CONST WA_TOGGLE_PLAYLIST_EDITOR = 40040
     CONST WA_TOGGLE_MAIN_WINDOW_VISIBLE = 40258
     CONST WA_TOGGLE_MINIBROWSER = 40298
     CONST WA_TOGGLE_EASYMOVE = 40186
     CONST WA_RAISE_VOLUME = 40058
     CONST WA_LOWER_VOLUME = 40059
     CONST WA_TOGGLE_REPEAT = 40022
     CONST WA_TOGGLE_SHUFFLE = 40023
     CONST WA_JUMP_TO_TIME_DIALOG = 40193
     CONST WA_JUMP_TO_FILE_DIALOG = 40194
     CONST WA_OPEN_SKIN_SELECTOR = 40219
     CONST WA_CONFIGURE_CURRENT_VISUALIZATION_PLUGIN = 40221
     CONST WA_RELOAD_CURRENT_SKIN = 40291
     CONST WA_CLOSE_WINAMP = 40001
     CONST WA_MOVE_BACK_10_TRACKS = 40197
     CONST WA_SHOW_EDIT_BOOKMARKS = 40320
     CONST WA_ADD_CURRENT_TRACK_AS_BOOKMARK = 40321
     CONST WA_PLAY_AUDIO_CD = 40323
     CONST WA_LOAD_PRESET_FROM_EQ = 40253
     CONST WA_SAVE_PRESET_TO_EQF = 40254
     CONST WA_OPEN_LOAD_PRESETS_DIALOG = 40172
     CONST WA_OPEN_AUTOLOAD_PRESETS_DIALOG = 40173
     CONST WA_LOAD_DEFAULT_PRESET = 40174
     CONST WA_OPEN_SAVE_PRESET_DIALOG = 40175
     CONST WA_OPEN_AUTOLOAD_SAVE_PRESET = 40176
     CONST WA_OPEN_DELETE_PRESET_DIALOG = 40178
     CONST WA_OPEN_DELETE_AUTOLOAD_PRESET_DIALOG = 40180
     CONST WA_Winamp = "Winamp v1.x"


'******************************************************************************
' Windows constants and declarations                                          *
'******************************************************************************
     CONST WM_COMMAND = &H111
     CONST WM_USER = &H400
     CONST WM_CLOSE = &H10
     CONST WM_COPY  = &H301
     CONST WM_COPYDATA = &H4A

'------------------------------------------------------------------------------
' API Declarations                                                            |
'------------------------------------------------------------------------------
     DECLARE FUNCTION FindWindow LIB "user32" ALIAS "FindWindowA" _
      ( lpClassName AS STRING, lpWindowName AS LONG) AS LONG

     DECLARE FUNCTION SendMsg LIB "user32" ALIAS "SendMessageA" _
      (hwnd AS LONG, wMsg AS LONG, wParam AS LONG, lParam AS LONG) AS LONG

     DECLARE FUNCTION GetWindowText LIB "user32" ALIAS "GetWindowTextA" _
      ( hwnd AS LONG,  lpCaption AS LONG, ReturnLength AS LONG) AS LONG

     DECLARE FUNCTION WinExec LIB "kernel32" ALIAS "WinExec" _
      (lpCmdLine AS STRING, nCmdShow AS LONG) AS LONG

     TYPE COPYDATASTRUCT
      dwData AS LONG
      cbData AS LONG
      lpData AS LONG
     END TYPE


'_____________________________________________________________________________'
'                                                                             '
' This is a translation of the original Frontend.h file from Winamp           '
' API Documentation, to add Winamp control to a RapidQ application.           '
'                                                                             '
'                                                                             '
'                   |--------------------------------|                        '
'                   |     Dreadsoft® Corporation     |                        '
'                   |  (manco un diritto riservato)  |                        '
'                   |    http://dreadsoft.too.it     |                        '
'                   |       dreadsoft@yahoo.it       |                        '
'                   |--------------------------------|                        '
'                                                                             '
'                                                                             '
'_____________________________________________________________________________'



'  Winamp frontend/plug-in control API documentation v1.1.
'  By Justin Frankel. Updates by Christophe Thibault.
'  Copyright (C) 1997-2000, Nullsoft Inc.
'  Last updated: JUL.12.2000.
'
'  Introduction
'  -----------------------
'  This file describes a means to easily communicate to Winamp
'  via the classic Win32 Message API.
'
'  These definitions/code assume C/C++. Porting to VB/Delphi shouldn't
'  be too hard.
'
'  First, you find the HWND of the Winamp main window. From a plug-in
'  you can easily extract this from the plug-in structure (hMainWindow,
'  hwndParent, whatever). For external apps, use:
'
'  HWND hwnd_winamp = FindWindow("Winamp v1.x",NULL);
'
'  (note: I know, we're in Winamp 2.x, but it's 1.x for compatibility)
'
'  Once you have the hwnd_winamp, it's a good idea to check the version
'  number. To do this, you send a WM_WA_IPC message to hwnd_winamp.
'  Note that WM_WA_IPC is defined as Win32's WM_USER.
'
'  Note that sometimes you might want to use PostMessage instead of
'  SendMessage.
'

     CONST WM_WA_IPC = &H400


'------------------------------------------------------------------------------
     CONST IPC_GETVERSION = 0

'  int version = SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETVERSION);
'
'  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.
'
'  The basic format for sending messages to Winamp is:
'  int result=SendMessage(hwnd_winamp,WM_WA_IPC,command_data,command);
'  (for the version check, command_data is 0).
'------------------------------------------------------------------------------
     CONST IPC_DELETE = 101

'  SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_DELETE);
'  You can use IPC_DELETE to clear Winamp's internal playlist.
'------------------------------------------------------------------------------
     CONST IPC_STARTPLAY = 102

'  SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_STARTPLAY);
'  Using IPC_STARTPLAY is like hitting 'Play' in Winamp, mostly.
'------------------------------------------------------------------------------
     CONST IPC_ISPLAYING = 104

'  int res = SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_ISPLAYING);
'  IPC_ISPLAYING returns the status of playback.
'  If it returns 1, it is playing. if it returns 3, it is paused,
'  if it returns 0, it is not playing.
'------------------------------------------------------------------------------
     CONST IPC_GETOUTPUTTIME = 105

'  int res = SendMessage(hwnd_winamp,WM_WA_IPC,mode,IPC_GETOUTPUTTIME);
'  IPC_GETOUTPUTTIME returns the position in milliseconds of the
'  current song (mode = 0), or the song length, in seconds (mode = 1).
'  Returns -1 if not playing or error.
'------------------------------------------------------------------------------
     CONST IPC_JUMPTOTIME = 106

' (requires Winamp 1.60+)
'  SendMessage(hwnd_winamp,WM_WA_IPC,ms,IPC_JUMPTOTIME);
'  IPC_JUMPTOTIME sets the position in milliseconds of the
'  current song (approximately).
'  Returns -1 if not playing, 1 on eof, or 0 if successful
'------------------------------------------------------------------------------
     CONST IPC_WRITEPLAYLIST = 120

' (requires Winamp 1.666+)
'  SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_WRITEPLAYLIST);
'  IPC_WRITEPLAYLIST writes the current playlist to <winampdir>\\Winamp.m3u,
'  and returns the current playlist position.
'  Kinda obsoleted by some of the 2.x new stuff, but still good for when
'  using a front-end (instead of a plug-in)
'------------------------------------------------------------------------------
     CONST IPC_SETPLAYLISTPOS = 121
'
' (requires Winamp 2.0+)
' SendMessage(hwnd_winamp,WM_WA_IPC,position,IPC_SETPLAYLISTPOS)
' IPC_SETPLAYLISTPOS sets the playlsit position to 'position'.
'------------------------------------------------------------------------------
     CONST IPC_SETVOLUME = 122
'
'  (requires Winamp 2.0+)
'  SendMessage(hwnd_winamp,WM_WA_IPC,volume,IPC_SETVOLUME);
'  IPC_SETVOLUME sets the volume of Winamp (from 0-255).
'------------------------------------------------------------------------------
     CONST IPC_SETPANNING = 123
'
' (requires Winamp 2.0+)
' SendMessage(hwnd_winamp,WM_WA_IPC,panning,IPC_SETPANNING);
' IPC_SETPANNING sets the panning of Winamp (from -127 (left) to 127 (right)).
'------------------------------------------------------------------------------
     CONST IPC_GETLISTLENGTH = 124
'
'  (requires Winamp 2.0+)
'  int length = SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETLISTLENGTH);
'  IPC_GETLISTLENGTH returns the length of the current playlist, in
'  tracks.
'------------------------------------------------------------------------------
' CONST IPC_SETSKIN = 200
'
'  (requires Winamp 2.04+, only usable from plug-ins (not external apps))
'  SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)"skinname",IPC_SETSKIN);
'  IPC_SETSKIN sets the current skin to "skinname". Note that skinname
'  can be the name of a skin, a skin .zip file, with or without path.
'  If path isn't specified, the default search path is the winamp skins
'  directory.
'------------------------------------------------------------------------------
' CONST IPC_GETSKIN = 201
'
' (requires Winamp 2.04+, only usable from plug-ins (not external apps))
'  SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)skinname_buffer,IPC_GETSKIN);
'
'  IPC_GETSKIN puts the directory where skin bitmaps can be found
'  into  skinname_buffer.
'  skinname_buffer must be MAX_PATH characters in length.
'  When using a .zip'd skin file, it'll return a temporary directory
'  where the ZIP was decompressed.
'------------------------------------------------------------------------------
' CONST IPC_EXECPLUG 202
'
'  (requires Winamp 2.04+, only usable from plug-ins (not external apps))
'  SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)"vis_file.dll",IPC_EXECPLUG);
'
'  IPC_EXECPLUG executes a visualization plug-in pointed to by WPARAM.
'  the format of this string can be:
'  "vis_whatever.dll"
'  "vis_whatever.dll,0" // (first mod, file in winamp plug-in dir)
'  "C:\\dir\\vis_whatever.dll,1"
'------------------------------------------------------------------------------
' CONST IPC_GETPLAYLISTFILE 211
'
'  (requires Winamp 2.04+, only usable from plug-ins (not external apps))
'  char name=SendMessage(hwnd_winamp,WM_WA_IPC,index,IPC_GETPLAYLISTFILE);
'
'  IPC_GETPLAYLISTFILE gets the filename of the playlist entry [index].
'  returns a pointer to it. returns NULL on error.
'
'------------------------------------------------------------------------------
' CONST IPC_GETPLAYLISTTITLE 212
'
'  (requires Winamp 2.04+, only usable from plug-ins (not external apps))
'  char name=SendMessage(hwnd_winamp,WM_WA_IPC,index,IPC_GETPLAYLISTTITLE);
'
'  IPC_GETPLAYLISTTITLE gets the title of the playlist entry [index].
'  returns a pointer to it. returns NULL on error.
'------------------------------------------------------------------------------
     CONST IPC_GETLISTPOS = 125
'
'  (requires Winamp 2.05+)
'  int pos=SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETLISTPOS);
'  IPC_GETLISTPOS returns the playlist position. A lot like IPC_WRITEPLAYLIST
'  only faster since it doesn't have to write out the list. Heh, silly me.
'------------------------------------------------------------------------------
     CONST IPC_GETINFO = 126

     CONST IPC_GI_SAMPLERATE = 0
     CONST IPC_GI_BITRATE = 1
     CONST IPC_GI_CHANNELS = 2
'
'  (requires Winamp 2.05+)
'  int inf=SendMessage(hwnd_winamp,WM_WA_IPC,mode,IPC_GETINFO);
'
'  IPC_GETINFO returns info about the current playing song. The value
'  it returns depends on the value of 'mode'.
'  Mode      Meaning
'  ------------------
'  0         Samplerate (i.e. 44100)
'  1         Bitrate  (i.e. 128)
'  2         Channels (i.e. 2)
'------------------------------------------------------------------------------
     CONST IPC_GETEQDATA = 127
'
'  (requires Winamp 2.05+)
'  int data=SendMessage(hwnd_winamp,WM_WA_IPC,pos,IPC_GETEQDATA);
'
'  IPC_GETEQDATA queries the status of the EQ.
'  The value returned depends on what 'pos' is set to:
'  Value      Meaning
'  ------------------
'  0-9        The 10 bands of EQ data. 0-63 (+20db - -20db)
'  10         The preamp value. 0-63 (+20db - -20db)
'  11         Enabled. zero if disabled, nonzero if enabled.
'  12         Autoload. zero if disabled, nonzero if enabled.
'------------------------------------------------------------------------------
     CONST IPC_SETEQDATA = 128
'  (requires Winamp 2.05+)
'  SendMessage(hwnd_winamp,WM_WA_IPC,pos,IPC_GETEQDATA);
'  SendMessage(hwnd_winamp,WM_WA_IPC,value,IPC_SETEQDATA);
'
'  IPC_SETEQDATA sets the value of the last position retrieved
'  by IPC_GETEQDATA.
'------------------------------------------------------------------------------
     CONST IPC_ADDBOOKMARK = 129
'  (requires Winamp 2.4+)
'  SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)file,IPC_ADDBOOKMARK);
'
'  IPC_ADDBOOKMARK will add the specified file to the Winamp bookmark list.
'------------------------------------------------------------------------------
     CONST IPC_RESTARTWINAMP = 135
'  (requires Winamp 2.2+)
'  SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_RESTARTWINAMP);
'
'  IPC_RESTARTWINAMP will restart Winamp (isn't that obvious ? :)
'------------------------------------------------------------------------------
     CONST IPC_MBOPEN = 241
'  (requires Winamp 2.05+)
'  SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_MBOPEN);
'  SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)url,IPC_MBOPEN);
'
'  IPC_MBOPEN will open a new URL in the minibrowser.
'  if url is NULL, it will open the Minibrowser window.
'------------------------------------------------------------------------------
     CONST IPC_INETAVAILABLE = 242
'  (requires Winamp 2.05+)
'  val=SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_INETAVAILABLE);
'  IPC_INETAVAILABLE will return 1 if the Internet connection is available
'  for Winamp.
'------------------------------------------------------------------------------
     CONST IPC_UPDTITLE = 243
'  (requires Winamp 2.2+)
'  SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_UPDTITLE);
'
'  IPC_UPDTITLE will ask Winamp to update the informations about
'  the current title.
'------------------------------------------------------------------------------
     CONST IPC_CHANGECURRENTFILE = 245
'  (requires Winamp 2.05+)
'  SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)file,IPC_CHANGECURRENTFILE);
'
'  IPC_CHANGECURRENTFILE will set the current playlist item.
'------------------------------------------------------------------------------
     CONST IPC_GETMBURL = 246
'  (requires Winamp 2.2+)
'  char buffer[4096]; // Urls can be VERY long
'  SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)buffer,IPC_GETMBURL);
'
'  IPC_GETMBURL will retrieve the current Minibrowser URL into buffer.
'------------------------------------------------------------------------------
     CONST IPC_REFRESHPLCACHE = 247
'  (requires Winamp 2.2+)
'  SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_REFRESHPLCACHE);
'
'  IPC_REFRESHPLCACHE will flush the playlist cache buffer.
'------------------------------------------------------------------------------
     CONST IPC_MBBLOCK = 248
'  (requires Winamp 2.4+)
'  SendMessage(hwnd_winamp,WM_WA_IPC,value,IPC_MBBLOCK);
'
'  IPC_MBBLOCK will block the Minibrowser from updates if value is set to 1
'------------------------------------------------------------------------------
     CONST IPC_MBOPENREAL = 249
'  (requires Winamp 2.4+)
'  SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)url,IPC_MBOPENREAL);
'
'  IPC_MBOPENREAL works the same as IPC_MBOPEN except that it will works even if
'  IPC_MBBLOCK has been set to 1
'------------------------------------------------------------------------------
     CONST IPC_GET_SHUFFLE = 250
'  (requires Winamp 2.4+)
'  val=SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GET_SHUFFLE);
'
'  IPC_GET_SHUFFLE returns the status of the Shuffle option (1 if set)
'------------------------------------------------------------------------------
     CONST IPC_GET_REPEAT = 251
'  (requires Winamp 2.4+)
'  val=SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GET_REPEAT);
'
'  IPC_GET_REPEAT returns the status of the Repeat option (1 if set)
'------------------------------------------------------------------------------
     CONST IPC_SET_SHUFFLE = 252
'  (requires Winamp 2.4+)
'  SendMessage(hwnd_winamp,WM_WA_IPC,value,IPC_SET_SHUFFLE);
'
'  IPC_SET_SHUFFLE sets the status of the Shuffle option (1 to turn it on)
'------------------------------------------------------------------------------
     CONST IPC_SET_REPEAT = 253
'  (requires Winamp 2.4+)
'  SendMessage(hwnd_winamp,WM_WA_IPC,value,IPC_SET_REPEAT);
'
'  IPC_SET_REPEAT sets the status of the Repeat option (1 to turn it on)


'******************************************************************************
'******************************************************************************


'  Some API calls tend to require that you send data via WM_COPYDATA
'  instead of WM_USER. Such as IPC_PLAYFILE:
'
'------------------------------------------------------------------------------
     CONST IPC_PLAYFILE = 100
'
'
'  COPYDATASTRUCT cds;
'  cds.dwData = IPC_PLAYFILE;
'  cds.lpData = (void ) "file.mp3";
'  cds.cbData = strlen((char ) cds.lpData)+1; // include space for null char
'  SendMessage(hwnd_winamp,WM_COPYDATA,(WPARAM)NULL,(LPARAM)&cds);
'
'  This will play the file "file.mp3".
'------------------------------------------------------------------------------
     CONST IPC_CHDIR = 103
'
'
'  COPYDATASTRUCT cds;
'  cds.dwData = IPC_CHDIR;
'  cds.lpData = (void ) "c:\\download";
'  cds.cbData = strlen((char ) cds.lpData)+1; // include space for null char
'  SendMessage(hwnd_winamp,WM_COPYDATA,(WPARAM)NULL,(LPARAM)&cds);
'
'  This will make Winamp change to the directory C:\\download




'°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
' Translator Note: the WM_COMMAND messages were already included.
'
'°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
'
'  Finally there are some WM_COMMAND messages that you can use to send
'  Winamp misc commands.
'
'  To send these, use:
'
'  SendMessage(hwnd_winamp, WM_COMMAND,command_name,0);
'
'
' CONST WINAMP_OPTIONS_EQ               40036 // toggles the EQ window
' CONST WINAMP_OPTIONS_PLEDIT           40040 // toggles the playlist window
' CONST WINAMP_VOLUMEUP                 40058 // turns the volume up a little
' CONST WINAMP_VOLUMEDOWN               40059 // turns the volume down a little
' CONST WINAMP_FFWD5S                   40060 // fast forwards 5 seconds
' CONST WINAMP_REW5S                    40061 // rewinds 5 seconds
'
'  / the following are the five main control buttons, with optionally shift
'  / or control pressed
'  / (for the exact functions of each, just try it out)
' CONST WINAMP_BUTTON1                  40044
' CONST WINAMP_BUTTON2                  40045
' CONST WINAMP_BUTTON3                  40046
' CONST WINAMP_BUTTON4                  40047
' CONST WINAMP_BUTTON5                  40048
' CONST WINAMP_BUTTON1_SHIFT            40144
' CONST WINAMP_BUTTON2_SHIFT            40145
' CONST WINAMP_BUTTON3_SHIFT            40146
' CONST WINAMP_BUTTON4_SHIFT            40147
' CONST WINAMP_BUTTON5_SHIFT            40148
' CONST WINAMP_BUTTON1_CTRL             40154
' CONST WINAMP_BUTTON2_CTRL             40155
' CONST WINAMP_BUTTON3_CTRL             40156
' CONST WINAMP_BUTTON4_CTRL             40157
' CONST WINAMP_BUTTON5_CTRL             40158
'
' CONST WINAMP_FILE_PLAY                40029 // pops up the load file(s) box
' CONST WINAMP_OPTIONS_PREFS            40012 // pops up the preferences
' CONST WINAMP_OPTIONS_AOT              40019 // toggles always on top
' CONST WINAMP_HELP_ABOUT               40041 // pops up the about box :)
'
'
'
'  EOF.. Enjoy.
'
'
' #endif

'______________________________________________________________________________
     FUNCTION WA_GetWindowHandle AS LONG
      Result = FindWindow(WA_Winamp, 0)
     END FUNCTION

'______________________________________________________________________________
     FUNCTION WA_GetWindowByClass (classname AS STRING) AS LONG
      Result = FindWindow(classname, 0)
     END FUNCTION

'______________________________________________________________________________
     SUB WA_Play (hWinamp AS LONG)
      Sendmsg(hWinamp, WM_COMMAND, WA_PLAY_BTN, 0)
     END SUB

'______________________________________________________________________________
     SUB WA_Stop (hWinamp AS LONG)
      Sendmsg(hWinamp, WM_COMMAND, WA_STOP_BTN, 0)
     END SUB

'______________________________________________________________________________
     SUB WA_Pause (hWinamp AS LONG)
      Sendmsg(hWinamp, WM_COMMAND, WA_PAUSE_BTN, 0)
     END SUB


'______________________________________________________________________________
     SUB WA_Next_Track (hWinamp AS LONG)
      Sendmsg(hWinamp, WM_COMMAND, WA_NEXT_TRACK_BTN, 0)
     END SUB

'______________________________________________________________________________
     SUB WA_Previous_Track (hWinamp AS LONG)
      Sendmsg(hWinamp, WM_COMMAND, WA_PREVIOUS_TRACK_BTN, 0)
     END SUB

'______________________________________________________________________________
     SUB WA_CloseWinamp (hWinamp AS LONG)
      Sendmsg(hWinamp, WM_COMMAND, WA_CLOSE_WINAMP, 0)
     END SUB

'______________________________________________________________________________
     SUB WA_FadeoutAndStop (hWinamp AS LONG)
      Sendmsg(hWinamp, WM_COMMAND, WA_FADEOUT_AND_STOP, 0)
     END SUB

'______________________________________________________________________________
     SUB WA_FastForward (hWinamp AS LONG)
      Sendmsg(hWinamp, WM_COMMAND, WA_FAST_FORWARD, 0)
     END SUB

'______________________________________________________________________________
     SUB WA_FastRewind (hWinamp AS LONG)
      Sendmsg(hWinamp, WM_COMMAND, WA_FAST_REWIND, 0)
     END SUB

'______________________________________________________________________________
     SUB WA_RaiseVolume (hWinamp AS LONG)
      Sendmsg(hWinamp, WM_COMMAND, WA_RAISE_VOLUME, 0)
     END SUB

'______________________________________________________________________________
     SUB WA_LowerVolume (hWinamp AS LONG)
      Sendmsg(hWinamp, WM_COMMAND, WA_LOWER_VOLUME, 0)
     END SUB

'______________________________________________________________________________
     SUB WA_StopAfterCurrentTrack (hWinamp AS LONG)
      Sendmsg(hWinamp, WM_COMMAND, WA_STOP_AFTER_CURRENT_TRACK, 0)
     END SUB

'______________________________________________________________________________
' Mode can be:
' 1 -> Elapsed
' 2 -> Remaining
     SUB WA_SetTimeDisplayMode (hWinamp AS LONG, mode AS INTEGER)
      IF mode = 1 THEN
       Sendmsg(hWinamp, WM_COMMAND, WA_SET_TIME_DISPLAY_MODE_TO_ELAPSED, 0)
      ELSEIF mode = 2 THEN
       Sendmsg(hWinamp, WM_COMMAND, WA_SET_TIME_DISPLAY_MODE_TO_REMAINING, 0)
      END IF
     END SUB

'______________________________________________________________________________
     SUB WA_ToggleRepeat (hWinamp AS LONG)
      Sendmsg(hWinamp, WM_COMMAND, WA_TOGGLE_REPEAT, 0)
     END SUB

'______________________________________________________________________________
     SUB WA_ToggleShuffle (hWinamp AS LONG)
      Sendmsg(hWinamp, WM_COMMAND, WA_TOGGLE_SHUFFLE, 0)
     END SUB

'______________________________________________________________________________
     SUB WA_OpenFileDialog (hWinamp AS LONG)
      Sendmsg(hWinamp, WM_COMMAND, WA_OPEN_FILE_DIALOG, 0)
     END SUB

'______________________________________________________________________________
     SUB WA_OpenUrlDialog (hWinamp AS LONG)
      Sendmsg(hWinamp, WM_COMMAND, WA_OPEN_URL_DIALOG, 0)
     END SUB

'______________________________________________________________________________
     SUB WA_StartOfPlaylist (hWinamp AS LONG)
      Sendmsg(hWinamp, WM_COMMAND, WA_START_OF_PLAYLIST, 0)
     END SUB

'______________________________________________________________________________
     SUB WA_EndOfPlaylist (hWinamp AS LONG)
      Sendmsg(hWinamp, WM_COMMAND, WA_END_OF_PLAYLIST, 0)
     END SUB

'______________________________________________________________________________
     SUB WA_OpenFileInfoBox (hWinamp AS LONG)
      Sendmsg(hWinamp, WM_COMMAND, WA_OPEN_FILE_INFO_BOX, 0)
     END SUB

'______________________________________________________________________________
     SUB WA_TogglePreferencesScreen (hWinamp AS LONG)
      Sendmsg(hWinamp, WM_COMMAND, WA_TOGGLE_PREFERENCES_SCREEN, 0)
     END SUB

'______________________________________________________________________________
     SUB WA_OpenVisualizationOptions (hWinamp AS LONG)
      Sendmsg(hWinamp, WM_COMMAND, WA_OPEN_VISUALIZATION_OPTIONS, 0)
     END SUB

'______________________________________________________________________________
     SUB WA_OpenVisualizationPluginOptions (hWinamp AS LONG)
      Sendmsg(hWinamp, WM_COMMAND, WA_OPEN_VISUALIZATION_PLUGIN_OPTIONS, 0)
     END SUB

'______________________________________________________________________________
     SUB WA_ExecuteCurrentVisualizationPlugin (hWinamp AS LONG)
      Sendmsg(hWinamp, WM_COMMAND, WA_EXECUTE_CURRENT_VISUALIZATION_PLUGIN, 0)
     END SUB

'______________________________________________________________________________
     SUB WA_ToggleAboutBox (hWinamp AS LONG)
      Sendmsg(hWinamp, WM_COMMAND, WA_TOGGLE_ABOUT_BOX, 0)
     END SUB

'______________________________________________________________________________
     SUB WA_ToggleTitleAutoscrolling (hWinamp AS LONG)
      Sendmsg(hWinamp, WM_COMMAND, WA_TOGGLE_TITLE_AUTOSCROLLING, 0)
     END SUB
'______________________________________________________________________________
     SUB WA_ToggleAlwaysOnTop (hWinamp AS LONG)
      Sendmsg(hWinamp, WM_COMMAND, WA_TOGGLE_ALWAYS_ON_TOP, 0)
     END SUB

'______________________________________________________________________________
     SUB WA_ToggleWindowShade (hWinamp AS LONG)
      Sendmsg(hWinamp, WM_COMMAND, WA_TOGGLE_WINDOWSHADE, 0)
     END SUB

'______________________________________________________________________________
     SUB WA_TogglePlaylistWindowShade (hWinamp AS LONG)
      Sendmsg(hWinamp, WM_COMMAND, WA_TOGGLE_PLAYLIST_WINDOWSHADE, 0)
     END SUB

'______________________________________________________________________________
     SUB WA_ToggleDoubleSizeMode (hWinamp AS LONG)
      Sendmsg(hWinamp, WM_COMMAND, WA_TOGGLE_DOUBLESIZE_MODE, 0)
     END SUB

'______________________________________________________________________________
     SUB WA_ToggleEq (hWinamp AS LONG)
      Sendmsg(hWinamp, WM_COMMAND, WA_TOGGLE_EQ, 0)
     END SUB

'______________________________________________________________________________
     SUB WA_TogglePlayListEditor (hWinamp AS LONG)
      Sendmsg(hWinamp, WM_COMMAND, WA_TOGGLE_PLAYLIST_EDITOR, 0)
     END SUB

'______________________________________________________________________________
     SUB WA_ToggleMainWindowVisible (hWinamp AS LONG)
      Sendmsg(hWinamp, WM_COMMAND, WA_TOGGLE_MAIN_WINDOW_VISIBLE, 0)
     END SUB

'______________________________________________________________________________
     SUB WA_ToggleMinibrowser (hWinamp AS LONG)
      Sendmsg(hWinamp, WM_COMMAND, WA_TOGGLE_MINIBROWSER, 0)
     END SUB

'______________________________________________________________________________
     SUB WA_JumpToTimeDialog (hWinamp AS LONG)
      Sendmsg(hWinamp, WM_COMMAND, WA_JUMP_TO_TIME_DIALOG, 0)
     END SUB

'______________________________________________________________________________
     SUB WA_JumpToFileDialog (hWinamp AS LONG)
      Sendmsg(hWinamp, WM_COMMAND, WA_JUMP_TO_FILE_DIALOG, 0)
     END SUB

'______________________________________________________________________________
     SUB WA_OpenSkinSelector (hWinamp AS LONG)
      Sendmsg(hWinamp, WM_COMMAND, WA_OPEN_SKIN_SELECTOR, 0)
     END SUB

'______________________________________________________________________________
     SUB WA_ReloadCurrentSkin (hWinamp AS LONG)
      Sendmsg(hWinamp, WM_COMMAND, WA_RELOAD_CURRENT_SKIN, 0)
     END SUB

'______________________________________________________________________________
     SUB WA_ToggleEasymove (hWinamp AS LONG)
      Sendmsg(hWinamp, WM_COMMAND, WA_TOGGLE_EASYMOVE, 0)
     END SUB

'______________________________________________________________________________
     SUB WA_ConfigureCurrentVisualizationPlugin (hWinamp AS LONG)
      Sendmsg(hWinamp, WM_COMMAND, WA_CONFIGURE_CURRENT_VISUALIZATION_PLUGIN, 0)
     END SUB


'______________________________________________________________________________
     SUB WA_MoveBack10Tracks (hWinamp AS LONG)
      Sendmsg(hWinamp, WM_COMMAND, WA_MOVE_BACK_10_TRACKS, 0)
     END SUB

'______________________________________________________________________________
     SUB WA_ShowEditBookmarks (hWinamp AS LONG)
      Sendmsg(hWinamp, WM_COMMAND, WA_SHOW_EDIT_BOOKMARKS, 0)
     END SUB

'______________________________________________________________________________
     SUB WA_AddCurrentTrackAsBookmark (hWinamp AS LONG)
      Sendmsg(hWinamp, WM_COMMAND, WA_ADD_CURRENT_TRACK_AS_BOOKMARK, 0)
     END SUB

'______________________________________________________________________________
     SUB WA_PlayAudioCD (hWinamp AS LONG)
      Sendmsg(hWinamp, WM_COMMAND, WA_PLAY_AUDIO_CD, 0)
     END SUB

'______________________________________________________________________________
     SUB WA_LoadPresetFromEq (hWinamp AS LONG)
      Sendmsg(hWinamp, WM_COMMAND, WA_LOAD_PRESET_FROM_EQ, 0)
     END SUB

'______________________________________________________________________________
     SUB WA_OpenLoadPresetsDialog (hWinamp AS LONG)
      Sendmsg(hWinamp, WM_COMMAND, WA_OPEN_LOAD_PRESETS_DIALOG, 0)
     END SUB

'______________________________________________________________________________
     SUB WA_OpenAutoLoadPresetsDialog (hWinamp AS LONG)
      Sendmsg(hWinamp, WM_COMMAND, WA_OPEN_AUTOLOAD_PRESETS_DIALOG, 0)
     END SUB

'______________________________________________________________________________
     SUB WA_SavePresetToEQF (hWinamp AS LONG)
      Sendmsg(hWinamp, WM_COMMAND, WA_SAVE_PRESET_TO_EQF, 0)
     END SUB

'______________________________________________________________________________
     SUB WA_LoadDefaultPreset (hWinamp AS LONG)
      Sendmsg(hWinamp, WM_COMMAND, WA_LOAD_DEFAULT_PRESET, 0)
     END SUB

'______________________________________________________________________________
     SUB WA_OpenSavePresetDialog (hWinamp AS LONG)
      Sendmsg(hWinamp, WM_COMMAND, WA_OPEN_SAVE_PRESET_DIALOG, 0)
     END SUB


'______________________________________________________________________________
     SUB WA_OpenAutoloadSavePreset (hWinamp AS LONG)
      Sendmsg(hWinamp, WM_COMMAND, WA_OPEN_AUTOLOAD_SAVE_PRESET, 0)
     END SUB

'______________________________________________________________________________
     SUB WA_OpenDeletePresetDialog (hWinamp AS LONG)
      Sendmsg(hWinamp, WM_COMMAND, WA_OPEN_DELETE_PRESET_DIALOG, 0)
     END SUB

'______________________________________________________________________________
     SUB WA_OpenDeleteAutoloadPresetDialog (hWinamp AS LONG)
      Sendmsg(hWinamp, WM_COMMAND, WA_OPEN_DELETE_AUTOLOAD_PRESET_DIALOG, 0)
     END SUB


'******************************************************************************
' Functions made from Frontend.inc                                            *
'******************************************************************************

     FUNCTION WA_GetVersion (hWinamp AS LONG) AS STRING
      Result = HEX$(Sendmsg(hWinamp, WM_USER, 0, IPC_GETVERSION))
     END FUNCTION
'______________________________________________________________________________
     SUB WA_ClearPlaylist (hWinamp AS LONG)
      Sendmsg(hWinamp, WM_USER, 0, IPC_DELETE)
     END SUB

'______________________________________________________________________________
     SUB WA_StartPlay (hWinamp AS LONG)
      Sendmsg(hWinamp, WM_USER, 0, IPC_STARTPLAY)
     END SUB

'______________________________________________________________________________
     FUNCTION WA_IsPlaying (hWinamp AS LONG) AS BOOL
      Result = Sendmsg(hWinamp, WM_USER, 0, IPC_ISPLAYING)
     END FUNCTION

'______________________________________________________________________________
     FUNCTION WA_GetOutputTime (hWinamp AS LONG, mode AS INTEGER) AS LONG
      Result = Sendmsg(hWinamp, WM_USER, mode, IPC_GETOUTPUTTIME)
     END FUNCTION

'______________________________________________________________________________
     FUNCTION WA_JumpToTime (hWinamp AS LONG, position AS INTEGER) AS LONG
      Result = Sendmsg(hWinamp, WM_USER, position, IPC_JUMPTOTIME)
     END FUNCTION

'______________________________________________________________________________
     FUNCTION WA_WritePlaylist (hWinamp AS LONG) AS LONG
      Result = Sendmsg(hWinamp, WM_USER, 0, IPC_WRITEPLAYLIST)
     END FUNCTION

'______________________________________________________________________________
     FUNCTION WA_SetPlaylistPos (hWinamp AS LONG, position AS INTEGER) AS LONG
      Result = Sendmsg(hWinamp, WM_USER, position, IPC_SETPLAYLISTPOS)
     END FUNCTION

'______________________________________________________________________________
     FUNCTION WA_SetVolume (hWinamp AS LONG, Volume AS BYTE) AS LONG
      Result = Sendmsg(hWinamp, WM_USER, Volume, IPC_SETVOLUME)
     END FUNCTION

'______________________________________________________________________________
     FUNCTION WA_SetPanning (hWinamp AS LONG, pan AS BYTE) AS LONG
      Result = Sendmsg(hWinamp, WM_USER, pan, IPC_SETPANNING)
     END FUNCTION

'______________________________________________________________________________
     FUNCTION WA_GetListLength (hWinamp AS LONG) AS LONG
      Result = Sendmsg(hWinamp, WM_USER, 0, IPC_GETLISTLENGTH)
     END FUNCTION


'______________________________________________________________________________
     FUNCTION WA_GetListPos (hWinamp AS LONG) AS LONG
      Result = Sendmsg(hWinamp, WM_USER, 0, IPC_GETLISTPOS)
     END FUNCTION

'______________________________________________________________________________
     FUNCTION WA_GetInfo (hWinamp AS LONG, mode AS INTEGER) AS LONG
      Result = Sendmsg(hWinamp, WM_USER, mode, IPC_GETINFO)
     END FUNCTION

'______________________________________________________________________________
     FUNCTION WA_GetEqData (hWinamp AS LONG, position AS INTEGER) AS LONG
      Result = Sendmsg(hWinamp, WM_USER, position, IPC_GETEQDATA)
     END FUNCTION
'______________________________________________________________________________
' This function works, but the equalizer is not updated. You'll hear
' the effects, but you won't see any change in the equalizer window

     FUNCTION WA_SetEqData (hWinamp AS LONG, position AS INTEGER, _
       value AS INTEGER) AS LONG
      Sendmsg(hWinamp, WM_USER, position, IPC_GETEQDATA)
      Result = Sendmsg(hWinamp, WM_USER, 0, IPC_SETEQDATA)
     END FUNCTION

'______________________________________________________________________________
' NOT WORKING !!
     FUNCTION WA_AddBookmark (hWinamp AS LONG, filename AS STRING) AS LONG
      DIM file AS STRING
      file = filename
      Result = Sendmsg(hWinamp, WM_USER, file, IPC_ADDBOOKMARK)
     END FUNCTION


'______________________________________________________________________________
     FUNCTION WA_Restart (hWinamp AS LONG) AS LONG
      Result = Sendmsg(hWinamp, WM_USER, 0, IPC_RESTARTWINAMP)
     END FUNCTION

'______________________________________________________________________________
' NOT WORKING !!
     FUNCTION WA_MBOpen (hWinamp AS LONG, url AS STRING) AS LONG
      DIM b AS STRING
      b = url
      PRINT b
      Result = Sendmsg(hWinamp, WM_USER, &b, IPC_MBOPENREAL)
     END FUNCTION

'______________________________________________________________________________
     FUNCTION WA_MBBlock (hWinamp AS LONG, value AS bool) AS LONG
      Result = Sendmsg(hWinamp, WM_USER, value, IPC_MBBLOCK)
     END FUNCTION

'______________________________________________________________________________
     FUNCTION WA_InetAvailable (hWinamp AS LONG) AS LONG
      Result = Sendmsg(hWinamp, WM_USER, 0, IPC_InetAvailable)
     END FUNCTION

'______________________________________________________________________________
     FUNCTION WA_UpdTitle (hWinamp AS LONG) AS LONG
      Result = Sendmsg(hWinamp, WM_USER, 0, IPC_UPDTITLE)
     END FUNCTION

'______________________________________________________________________________
' NOT WORKING !!
     FUNCTION WA_ChangeCurrentFile (hWinamp AS LONG, file AS LONG) AS LONG
      Result = Sendmsg(hWinamp, WM_USER, file, IPC_CHANGECURRENTFILE)
     END FUNCTION

'______________________________________________________________________________
' NOT WORKING !!
     FUNCTION WA_GetMBUrl (hWinamp AS LONG) AS STRING
      DIM buffer AS QMEMORYSTREAM
      buffer.writestr(SPACE$(4096), 4096)
      Sendmsg(hWinamp, WM_USER, buffer.pointer, IPC_GETMBURL)
      buffer.position = 0
      result = buffer.readstr(buffer.size)
     END FUNCTION

'______________________________________________________________________________
     FUNCTION WA_RefreshPLCache (hWinamp AS LONG) AS LONG
      Result = Sendmsg(hWinamp, WM_USER, 0, IPC_REFRESHPLCACHE)
     END FUNCTION

'______________________________________________________________________________
     FUNCTION WA_GetShuffle (hWinamp AS LONG) AS LONG
      Result = Sendmsg(hWinamp, WM_USER, 0, IPC_GET_SHUFFLE)
     END FUNCTION

'______________________________________________________________________________
     FUNCTION WA_GetRepeat (hWinamp AS LONG) AS LONG
      Result = Sendmsg(hWinamp, WM_USER, 0, IPC_GET_REPEAT)
     END FUNCTION


'______________________________________________________________________________
     FUNCTION WA_SetShuffle (hWinamp AS LONG, value AS bool) AS LONG
      Result = Sendmsg(hWinamp, WM_USER, value, IPC_SET_SHUFFLE)
     END FUNCTION

'______________________________________________________________________________
     FUNCTION WA_SetRepeat (hWinamp AS LONG, value AS bool) AS LONG
      Result = Sendmsg(hWinamp, WM_USER, value, IPC_SET_REPEAT)
     END FUNCTION

'______________________________________________________________________________
     FUNCTION WA_PlayFile (hWinamp AS LONG, file AS STRING) AS LONG
      DIM cds AS QMEMORYSTREAM
      DIM fstr AS STRING
      fstr = file
      cds.writenum(IPC_PLAYFILE, 4)
      cds.writenum(LEN(fstr) + 1, 4)
      cds.writenum(VARPTR(fstr), 4)
      Result = Sendmsg(hWinamp, WM_COPYDATA, 0, cds.pointer)
     END FUNCTION

'______________________________________________________________________________
     FUNCTION WA_Changedir (hWinamp AS LONG, directory AS STRING) AS LONG
      DIM cds AS QMEMORYSTREAM
      DIM fstr AS STRING
      fstr = directory
      cds.writenum(IPC_CHDIR, 4)
      cds.writenum(LEN(fstr) + 1, 4)
      cds.writenum(VARPTR(fstr), 4)
      Result = Sendmsg(hWinamp, WM_COPYDATA, 0, cds.pointer)
     END FUNCTION


'------------------------------------------------------------------------------
' Command-line functions                                                      |
'------------------------------------------------------------------------------

     FUNCTION WA_BrowseForWinamp AS STRING
      DIM wod AS QOPENDIALOG
      WITH wod
       .CAPTION = "Please select Winamp.exe"
       .filter = "Winamp.exe|winamp.exe"
       IF .EXECUTE THEN
        result = .filename
       END IF
      END WITH
     END FUNCTION

'______________________________________________________________________________

     DIM WA_ExePath AS STRING
' WA_ExePath stores winamp.exe path. It is used for command-line functions.

'______________________________________________________________________________
     SUB WA_CL_Add (filename AS STRING)
      Winexec (   CHR$(34) & WA_ExePath & CHR$(34) & " /ADD " & _
       CHR$(34) & filename & CHR$(34), 0)
     END SUB

' Adds <filename> to the playlist of a running Winamp, if Winamp is running,
' otherwise it opens Winamp and plays it outright

'______________________________________________________________________________
     SUB WA_CL_New
      Winexec (CHR$(34) & WA_ExePath & CHR$(34) & " /NEW", 0)
     END SUB

' Creates a new instance of Winamp, even if Winamp is already running

'______________________________________________________________________________
     SUB WA_CL_PlayFile (filename AS STRING)
      Winexec (   CHR$(34) & WA_ExePath & CHR$(34) & " " & _
       CHR$(34) & filename & CHR$(34), 0)
     END SUB

' Plays the file C:\mp3\file.mp3, regardless of whether or not Winamp is open

'______________________________________________________________________________
     SUB WA_CL_LaunchClass (classname AS STRING)
      Winexec (   CHR$(34) & WA_ExePath & CHR$(34) & " /CLASS=" & _
       CHR$(34) & classname & CHR$(34), 0)
     END SUB

' Opens Winamp with a different Window Class name "myclassname", it is useful
' when you need to use the WA_GetWindowByClass function


'------------------------------------------------------------------------------
' Extra Functions - Not included in original API                              |
'------------------------------------------------------------------------------

'______________________________________________________________________________
' WA_RaiseVolumeEx will raise the volume by the specified amount

     SUB WA_RaiseVolumeEx (hWinamp AS LONG, percent AS INTEGER)
      DIM x AS INTEGER
      x = 0
      DO
       Sendmsg(hWinamp, WM_COMMAND, WA_RAISE_VOLUME, 0)
       INC(x)
      LOOP UNTIL x = percent
     END SUB

'______________________________________________________________________________
     SUB WA_LowerVolumeEx (hWinamp AS LONG, percent AS INTEGER)
      DIM x AS INTEGER
      x = 0
      DO
       Sendmsg(hWinamp, WM_COMMAND, WA_LOWER_VOLUME, 0)
       INC(x)
      LOOP UNTIL x = percent
     END SUB


掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Sat 2023-2-4  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0 Last modified:2004-01-24 16:21:21