BrettF Posted February 27, 2009 Posted February 27, 2009 (edited) Okay well a while ago with BASS.au3 there was a function that returned Char*. And heres another, and I still have no idea how it is meant to work, as it still manages to confuse the hell out of me... Here is what I have so far: expandcollapse popup; #FUNCTION# ==================================================================================================== ================ ; Name...........: _BASS_CD_GetID ; Description ...: Retrieves identification info from the CD in a drive. ; Syntax.........: _BASS_CD_GetID($bass_cd_dll, $bass_dll, $drive, $id) ; Parameters ....: - $bass_cd_dll - Handle to opened BassCD.dll ; - $bass_dll - Handle to opened Bass.dll ; - $drive - The drive to get info on... 0 = the first drive ; - $id - The identification to retrieve, one of the following. ; - $BASS_CDID_UPC ; - Returns the catalog number of the CD. The number uses UPC/EAN-code (BAR coding). This ; might not be available for all CDs. ; - $BASS_CDID_CDDB ; - Produces a CDDB identifier. This can be used to get details on the CD's contents from a ; CDDB server. ; - $BASS_CDID_CDDB2 ; - Produces a CDDB2 identifier. This can be used to get details on the CD's contents from a ; CDDB2 server. ; - $BASS_CDID_TEXT ; - Retrieves the CD-TEXT information from the CD (see below for details). CD-TEXT is not available ; on the majority of CDs. ; - $BASS_CDID_CDPLAYER ; - Produces an identifier that can be used to lookup CD details in the CDPLAYER.INI file, located ; in the Windows directory. ; - $BASS_CDID_MUSICBRAINZ ; - Produces an identifier that can be used to get details on the CD's contents from MusicBrainz. ; - $BASS_CDID_ISRC + track ; - Returns the International Standard Recording Code of the track... 0 = first track. This might ; not be available for all CDs. ; Return values .: Success - Returns the identification info ; Failure - Returns 0 and sets @ERROR to error returned by _BASS_ErrorGetCode() ; @error will be set to- ; - $BASS_ERROR_DEVICE ; - Drive is invalid. ; - $BASS_ERROR_NOCD ; - There's no CD in the drive. ; - $BASS_ERROR_ILLPARAM ; - ID is invalid. ; - $BASS_ERROR_NOTAVAIL ; - The CD does not have a UPC, ISRC or CD-TEXT info. ; - $BASS_ERROR_UNKNOWN ; - Some other mystery problem! ; Author ........: Brett Francis (BrettF) ; Modified.......: ; Remarks .......: - When requesting CD-TEXT, a series of null-terminated strings is returned (the final string ending in ; a double null), in the form of "tag=text". The following is a list of all the possible tags. Where <t> ; is shown, that represents the track number, with "0" being the whole disc/album. For example, "TITLE0" ; is the album title, while "TITLE1" is the title of the first track. ; TITLE<t> - The track (or album) title. ; PERFORMER<t> - The performer(s). ; SONGWRITER<t> - The song writer(s). ; COMPOSER<t> - The composer(s). ; ARRANGER<t> - The arranger(s). ; MESSAGE<t> - Message. ; GENRE<t> - Genre. ; ISRC<t> - International Standard Recording Code (ISRC) of the track... <t> is never 0. ; UPC - UPC/EAN code of the album. ; DISCID - Disc identification information. ; - When requesting CDDB identification, the string returned is what should be used in a CDDB query. The ; command sent to the CDDB server would be "cddb query <the returned string>". If successful, that ; results in a list of matching CDs, which the contents of can be requested using the "cddb read" command. ; See http://www.cddb.com/ and http://www.freedb.org/ for more information on using a CDDB server. ; Related .......: ; Link ..........; ; Example .......; ; ==================================================================================================== =========================== Func _BASS_CD_GetID($bass_cd_dll, $bass_dll, $drive, $id) $basscdret = DllCall($bass_cd_dll, 'ptr', 'BASS_CD_GetID', 'dword', $drive, 'dword', $id) $BS_ERR = _BASS_ErrorGetCode($bass_dll) If $BS_ERR <> 0 Then Return SetError($BS_ERR, "", 0) Else Return SetError(0, "", $basscdret[0]) EndIf EndFunc ;==>_BASS_CD_GetID Documentation is availible in Bass.au3 (check the download in my sig) or from the un4seen website. Basic syntax: char *BASS_CD_GetID( DWORD drive, DWORD id ); Thanks! Brett Edited February 27, 2009 by BrettF Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version!
ProgAndy Posted February 27, 2009 Posted February 27, 2009 You have to you use the _PtrStringLen and _PtrStringRead functions, to read the strings When you use BASS_CDID_TEXT, the return value is an "array": String1,Chr(0),String2,Chr(0),String... it ends with Chr(0)Chr(0) -> So read string1, add length+1 to Pointer, read string 2... until you reach a string with length 0. $Info_ptr = _BASS_CD_GetID($BASS_CD_DLL, $BASS_DLL, 0,$BASS_CDID_TEXT) Local $arr[1]=[-1], $CNT = 0, $Len While 1 $Len = _BASS_PtrStringLen($Info_ptr,False) If $Len <= 0 Then ExitLoop ReDim $arr[$CNT+1] $arr[$CNT] = _BASS_PtrStringRead($Info_ptr,False,$Len) $CNT += 1 $Info_ptr += $Len+1 WEnd _ArrayDisplay($arr) *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes
BrettF Posted February 27, 2009 Author Posted February 27, 2009 Hehehhe you're way too good Thanks for the explanation too! Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version!
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now