Jump to content

confused about how to use dllcalls


Recommended Posts

Hi there,

I'm trying to use bass.dll (an audio libary) from http://www.un4seen.com/.

Now, this is what the help file says to start a mp3 file:

BASS_SampleLoad

Loads a WAV, AIFF, MP3, MP2, MP1, OGG or plugin supported sample.

HSAMPLE BASS_SampleLoad(

BOOL mem,

void *file,

QWORD offset,

DWORD length,

DWORD max,

DWORD flags

);

Parameters

mem TRUE = load the sample from memory.

file Filename (mem = FALSE) or a memory location (mem = TRUE).

offset File offset to load the sample from (only used if mem = FALSE).

length Data length... 0 = use all data up to the end of file (if mem = FALSE). If length over-runs the end of the file, it'll automatically be lowered to the end of the file.

max Maximum number of simultaneous playbacks... 1 (min) - 65535 (max). Use one of the BASS_SAMPLE_OVER flags to choose the override decider, in the case of there being no free channel available for playback (ie. the sample is already playing max times).

flags A combination of these flags.

BASS_SAMPLE_FLOAT Use 32-bit floating-point sample data (not really recommended for samples).

BASS_SAMPLE_LOOP Looped? Note that only complete sample loops are allowed, you can't loop just a part of the sample. More fancy looping can be achieved by streaming the file.

BASS_SAMPLE_MONO Convert the sample (MP3/MP2/MP1 only) to mono, if it's not already. This flag is automatically applied if BASS_DEVICE_MONO was specified when calling BASS_Init.

BASS_SAMPLE_SOFTWARE Force the sample to not use hardware mixing.

BASS_SAMPLE_VAM

requires DirectX 7 or above Enables the DX7 voice allocation and management features on the sample, which allows the sample to be played in software or hardware. This flag is ignored if the BASS_SAMPLE_SOFTWARE flag is also specified.

BASS_SAMPLE_3D Enable 3D functionality. This requires that the BASS_DEVICE_3D flag was specified when calling BASS_Init, and the sample must be mono.

BASS_SAMPLE_MUTEMAX Mute the sample when it is at (or beyond) its max distance (3D samples only).

BASS_SAMPLE_OVER_VOL Override: the channel with the lowest volume is overridden.

BASS_SAMPLE_OVER_POS Override: the longest playing channel is overridden.

BASS_SAMPLE_OVER_DIST Override: the channel furthest away (from the listener) is overridden (3D samples only).

BASS_UNICODE file is a Unicode (UTF-16) filename.

Return value

If successful, the loaded sample's handle is returned, else 0 is returned. Use BASS_ErrorGetCode to get the error code.

Now I really couldn't figure out how to use this, but I tried the following without success:

$test = DllCall("bass.dll", "dword", "BASS_SampleLoad", "BOOL", "FALSE", "void", "c:\record\part1two.wav", "QWORD", "0", "DWORD", "0", "DWORD", "1", "DWORD", "BASS_SAMPLE_LOOP")

I basically have no idea how to give those paramters... and well help file didn't really help me either. Anyone could clear this up?

Edit: I know that it is possible to play sounds directly from AutoIT, but this example is meant for learning purposes.

Edited by tom13
Link to comment
Share on other sites

search example scripts for Brain Pain game, and in the source you'll see how to use Bassmod.dll file (for playing XM and similar sound files)

hi thanks a lot for your reply

bassmod.dll is a bit different then bass.dll but it sure helps, I tried to convert his play sound function to one for bass.dll ==>

his:

Func _PlaySong()
    If FileExists($MuzPath & "\BASSMOD.dll") Then
        Global $Music[2] = ["Track9.xm", "Track5.mod"]
        $R_Music = Random(0, UBound($Music)-1, 1)
        $bassdll = DllOpen($MuzPath & "\BASSMOD.dll")
        $Init = DllCall($bassdll, "int", "BASSMOD_Init", "int", -1, "int", 44100, "int", 0)
        $Name_H = DllStructCreate("char[255]")
        DllStructSetData($Name_H, 1, $MuzPath & $Music[$R_Music])
        $Lod = DllCall($bassdll, "int", "BASSMOD_MusicLoad", "int", 0, _
                "ptr", DllStructGetPtr($Name_H), _
                "int", 0, _
                "int", 0, _
                "int", 1028)
        DllCall($bassdll, "int:cdecl", "BASSMOD_MusicPlay", "int", $Init[0])
    EndIf
EndFuncoÝ÷ Úh§y«­¢+ÙÕ¹}A±ä ÀÌØí¥±°ÀÌØíÙ¥ô´Ä°ÀÌØíÉÄôÐÐÄÀÀ¤($ÀÌØíÍͱ°ô±±=Á¸ ÅÕ½ÐíÍ̹±°ÅÕ½Ðì¤($ÀÌØí¥¹¥Ðô±±
±° ÀÌØíÍͱ°°ÅÕ½Ðí¥¹ÐÅÕ½Ðì°ÅÕ½Ðí   MM}%¹¥ÐÅÕ½Ðì°ÅÕ½Ðí¥¹ÐÅÕ½Ðì°ÀÌØíÙ¥°ÅÕ½Ðí¥¹ÐÅÕ½Ðì°ÀÌØíÉÄ°ÅÕ½Ðí¥¹ÐÅÕ½Ðì°ÅÕ½ÐìÅÕ½Ðì°ÅÕ½Ðí¥¹ÐÅÕ½Ðì°À°ÅÕ½Ðí¥¹ÐÅÕ½Ðì°ÅÕ½Ðí9U10ÅÕ½Ðì¤($ÀÌØí¹µ} ô±±MÑÉÕÑ
ÉÑ ÅÕ½Ðí¡ÉlÈÔÕtÅÕ½Ðì¤(%±±MÑÉÕÑMÑÑ ÀÌØí¹µ} °Ä°ÀÌØí¥±¤($ÀÌØí±½ô±±
±° ÀÌØíÍͱ°°ÅÕ½Ðí¥¹ÐÅÕ½Ðì°ÅÕ½Ðí   MM}5ÕÍ¥1½ÅÕ½Ðì°ÅÕ½Ðí¥¹ÐÅÕ½Ðì°À°ÅÕ½ÐíÁÑÈÅÕ½Ðì°±±MÑÉÕÑÑAÑÈ ÀÌØí¹µ} ¤°ÅÕ½Ðí¥¹ÐÅÕ½Ðì°À°ÅÕ½Ðí¥¹ÐÅÕ½Ðì°À°ÅÕ½Ðí¥¹ÐÅÕ½Ðì°ÅÕ½ÐìÅÕ½Ðì°ÅÕ½Ðí¥¹ÐÅÕ½Ðì°ÄÀÈà¤(%±±
±° ÀÌØíÍÍ°°ÅÕ½Ðí¥¹Ðé°ÅÕ½Ðì°ÅÕ½Ðí MM}5ÕÍ¥A±äÅÕ½Ðì°ÅÕ½Ðí¥¹ÐÅÕ½Ðì°ÀÌØí¥¹¥ÑlÁt¤)¹Õ¹

However, autoit.exe crashes when I try it.. it crashes on the DllCall $lod, this is some documentation about it:

Loads a MOD music file; MO3 / IT / XM / S3M / MTM / MOD / UMX formats.

HMUSIC BASS_MusicLoad(

BOOL mem,

void *file,

QWORD offset,

DWORD length,

DWORD flags,

DWORD freq

);

Parameters

mem TRUE = load the MOD music from memory.

file Filename (mem = FALSE) or a memory location (mem = TRUE).

offset File offset to load the MOD music from (only used if mem = FALSE).

length Data length... 0 = use all data up to the end of file (if mem = FALSE).

flags A combination of these flags.

BASS_SAMPLE_8BITS Use 8-bit resolution. If neither this or the BASS_SAMPLE_FLOAT flags are specified, then the sample data will be 16-bit.

BASS_SAMPLE_FLOAT Use 32-bit floating-point sample data. See Floating-point channels for info.

BASS_SAMPLE_MONO Decode/play the MOD music in mono (uses less CPU than stereo). This flag is automatically applied if BASS_DEVICE_MONO was specified when calling BASS_Init.

BASS_SAMPLE_SOFTWARE Force the MOD music to not use hardware mixing.

BASS_SAMPLE_3D Enable 3D functionality. This requires that the BASS_DEVICE_3D flag was specified when calling BASS_Init. 3D channels must also be mono, so BASS_SAMPLE_MONO is automatically applied. The SPEAKER flags can not be used together with this flag.

BASS_SAMPLE_FX

requires DirectX 8 or above Enable the old implementation of DirectX 8 effects. See the DX8 effect implementations section for details. Use BASS_ChannelSetFX to add effects to the music.

BASS_SAMPLE_LOOP Loop the music.

BASS_MUSIC_NONINTER Use non-interpolated sample mixing. This generally reduces the sound quality, but can be good for chip-tunes.

BASS_MUSIC_SINCINTER Use sinc interpolated sample mixing. This increases the sound quality, but also requires more processing. If neither this or the BASS_MUSIC_NONINTER flag is specified, linear interpolation is used.

BASS_MUSIC_RAMP Use "normal" ramping (as used in FastTracker 2).

BASS_MUSIC_RAMPS Use "sensitive" ramping.

BASS_MUSIC_SURROUND Apply XMPlay's surround sound to the music (ignored in mono).

BASS_MUSIC_SURROUND2 Apply XMPlay's surround sound mode 2 to the music (ignored in mono).

BASS_MUSIC_FT2MOD Play .MOD file as FastTracker 2 would.

BASS_MUSIC_PT1MOD Play .MOD file as ProTracker 1 would.

BASS_MUSIC_POSRESET Stop all notes when seeking (BASS_ChannelSetPosition).

BASS_MUSIC_POSRESETEX Stop all notes and reset bpm/etc when seeking.

BASS_MUSIC_STOPBACK Stop the music when a backward jump effect is played. This stops musics that never reach the end from going into endless loops. Some MOD musics are designed to jump all over the place, so this flag would cause those to be stopped prematurely. If this flag is used together with the BASS_SAMPLE_LOOP flag, then the music would not be stopped but any BASS_SYNC_END sync would be triggered.

BASS_MUSIC_PRESCAN Calculate the playback length of the music, and enable seeking in bytes. This slightly increases the time taken to load the music, depending on how long it is. In the case of musics that loop, the length until the loop occurs is calculated. Use BASS_ChannelGetLength to retrieve the length.

BASS_MUSIC_NOSAMPLE Don't load the samples. This reduces the time (and memory) taken to load the music, notably with MO3 files, which is useful if you just want to get the text and/or length of the music without playing it.

BASS_MUSIC_AUTOFREE Automatically free the music when playback ends. Note that some musics have infinite loops, so never actually end on their own.

BASS_MUSIC_DECODE Decode/render the sample data, without playing it. Use BASS_ChannelGetData to retrieve decoded sample data. The BASS_SAMPLE_3D, BASS_STREAM_AUTOFREE and SPEAKER flags can not be used together with this flag. The BASS_SAMPLE_SOFTWARE and BASS_SAMPLE_FX flags are also ignored.

BASS_SPEAKER_xxx Speaker assignment flags. The BASS_SAMPLE_MONO flag is automatically applied when using a mono speaker assignment flag.

BASS_UNICODE file is a Unicode (UTF-16) filename.

freq Sample rate to render/play the MOD music at... 0 = the rate specified in the BASS_Init call.

Return value

If successful, the loaded MOD music's handle is returned, else 0 is returned. Use BASS_ErrorGetCode to get the error code.

Link to comment
Share on other sites

Take a look at this.

It's a bit confused, and there is a lot of work remaining but it may help

#include <Array.au3>

Global $DllBass
Global $DllBassTags
Global $DllBassFx
Global $BASS_FXPARAMEQ

$BASS_FXPARAMEQ=DllStructCreate("float fCenter;float fBandwidth;float fGain")



;===============================================================================
;
; Function Name:   _BassInit
; Description::    Initialise la dll
; Parameter(s):    $dll1 - Chemin de la dll "bass.dll"
;                   $dll2 - Chemin de la dll "tags.dll"
;                   $dll3 - Chemin de la dll "bass_fx.dll"
;                  $Hwnd - Handle de la GUI à laquelle on "raccroche" la dll
; Requirement(s):  AutoIt 3.2 ++
; Return Value(s): 1 - Success
;                  0 - Failure
; Author(s):       Homy
;
;===============================================================================
Func _BassInit($dll1, $dll2, $dll3, $Hwnd)
    Local $error
    If Not FileExists($dll1) Then Return 0
    If Not FileExists($dll2) Then Return 0
    If Not FileExists($dll3) Then Return 0
    
    $DllBass = DllOpen($dll1)
    $DllBassTags = DllOpen($dll2)
    $DllBassFx = DllOpen($dll3)
    
    dllCall($DllBass, "short", "BASS_Init", "int", -1, "long", 44100, "long", 0, "long", $Hwnd, "long", "NULL"); initialisation de la dll
    $error = dllcall($DllBass, "int", "BASS_ErrorGetCode"); gestion code erreur
    If $error[0] = 0 Then Return 1
    Return 0
EndFunc   ;==>_BassInit



;===============================================================================
;
; Function Name:   _BassEnd
; Description::    Fin
; Parameter(s):    none
; Requirement(s):  AutoIt 3.2 ++
; Return Value(s): none
; Author(s):       Homy
;
;===============================================================================
Func _BassEnd()
    DllClose($DllBass)
    DllClose($DllBassTags)
    DllClose($DllBassFx)
EndFunc   ;==>_BassEnd

;===============================================================================
;
; Function Name:   _BassPluginLoad
; Description::    Charge un plugin pour la dll
; Parameter(s):    $plugin - Chemin du plugin
; Requirement(s):  AutoIt 3.2 ++
; Return Value(s): 1 - Success
;                  0 - Failure
; Author(s):       Homy
;
;===============================================================================
Func _BassPluginLoad($plugin)
    Local $error, $hplugin
    If Not FileExists($plugin) Then Return 0
    
    $hplugin=dllcall($DllBass, "hwnd", "BASS_PluginLoad", "str", $plugin, "long", 0)
    $error = dllcall($DllBass, "int", "BASS_ErrorGetCode"); gestion code erreur
    If $error[0] = 0 Then Return $hplugin[0]
    Return 0
EndFunc   ;==>_BassPluginLoad



;===============================================================================
;
; Function Name:   _BassStreamCreateFile
; Description::    Créé un channel a partir d'un fichier
; Parameter(s):    $dll - Chemin de la dll "bass.dll"
;                  $plugin - Chemin du plugin
; Requirement(s):  AutoIt 3.2 ++
; Return Value(s): handle du channel - Success
;                  0 - Failure
; Author(s):       Homy
;
;===============================================================================
Func _BassStreamCreateFile($sFile)
    Local $error, $stream
    If Not FileExists($sFile) Then Return 0
    $stream = DllCall($DllBass, "hwnd", "BASS_StreamCreateFile", "long", 0, "str", $sFile, "long", 0, "long", 0, "long", 0x200000+128)
    $stream = DllCall($DllBassFx, "dword", "BASS_FX_TempoCreate", "dword", $stream[0], "dword", 0x10000)
    $error = dllcall($DllBass, "int", "BASS_ErrorGetCode"); gestion code erreur
    If $error[0] = 0 Then Return $stream[0]
    Return 0
EndFunc   ;==>_BassStreamCreateFile



;===============================================================================
;
; Function Name:   _BassPlay
; Description::    Play
; Parameter(s):    $Hwnd - handle du channel
; Requirement(s):  AutoIt 3.2 ++
; Return Value(s): None
; Author(s):       Homy
;
;===============================================================================
Func _BassPlay($Hwnd)
    DllCall($DllBass, "short", "BASS_ChannelPlay", "hwnd", $Hwnd, "long", 0)
EndFunc   ;==>_BassPlay


;===============================================================================
;
; Function Name:   _BassPause
; Description::    Pause
; Parameter(s):    $Hwnd - handle du channel
; Requirement(s):  AutoIt 3.2 ++
; Return Value(s): None
; Author(s):       Homy
;
;===============================================================================
Func _BassPause($Hwnd)
    DllCall($DllBass, "short", "BASS_ChannelPause", "hwnd", $Hwnd)
EndFunc   ;==>_BassPause


;===============================================================================
;
; Function Name:   _BassStop
; Description::    Stop et libère la mémoire
; Parameter(s):    $Hwnd - handle du channel
; Requirement(s):  AutoIt 3.2 ++
; Return Value(s): None
; Author(s):       Homy
;
;===============================================================================
Func _BassStop($Hwnd)
    DllCall($DllBass, "short", "BASS_ChannelStop", "hwnd", $Hwnd) ; stop
    DllCall($DllBass, "short", "BASS_StreamFree", "hwnd", $Hwnd) ; libère la mémoire du stream
EndFunc   ;==>_BassStop



;===============================================================================
;
; Function Name:   _BassSetVolume
; Description::    regle le volume de 0 à 100
; Parameter(s):    $sVol - volume
; Requirement(s):  AutoIt 3.2 ++
; Return Value(s): None
; Author(s):       Homy
;
;===============================================================================
Func _BassSetVolume($sVol)
    If $sVol >= 0 And $sVol <= 100 Then
        DllCall($DllBass, "long", "BASS_SetVolume", "dword", $sVol)
        return $sVol
    EndIf
    return 0
EndFunc   ;==>_BassSetVolume

;===============================================================================
;
; Function Name:   _BassSetPosition
; Description::    gere la position dans le channel
; Parameter(s):    $Hwnd - handle du channel
;                   $sPos - position en secondes
; Requirement(s):  AutoIt 3.2 ++
; Return Value(s): None
; Author(s):       Homy
;
;===============================================================================
Func _BassSetPosition($Hwnd, $sPos)
    Local $temp, $error
    $temp = DllCall($DllBass, "dword", "BASS_ChannelSeconds2Bytes", "hwnd", $Hwnd, "float", $sPos)
    $error = dllcall($DllBass, "int", "BASS_ErrorGetCode"); gestion code erreur
    If Not $error[0] = 0 Then return 0
    DllCall($DllBass, "int", "BASS_ChannelSetPosition", "hwnd", $Hwnd, "int64", $temp[0])
    $error = dllcall($DllBass, "int", "BASS_ErrorGetCode"); gestion code erreur
    If $error[0] = 0 Then return 1
    Return 0
EndFunc   ;==>_BassSetPosition



;===============================================================================
;
; Function Name:   _BassGetPositionByte
; Description::    récupere la position dans le channel en bytes
; Parameter(s):    $Hwnd - handle du channel
; Requirement(s):  AutoIt 3.2 ++
; Return Value(s): position en bytes dans le channel
; Author(s):       Homy
;
;===============================================================================
Func _BassGetPosition($Hwnd)
    Local $Ret
    $Ret = dllcall($DllBass, "dword", "BASS_ChannelGetPosition", "hwnd", $Hwnd)
Return $Ret[0]
EndFunc   ;==>_BassGetPosition


;===============================================================================
;
; Function Name:   _BassByte2Sec
; Description::    transforme  une longueur/position en byte en secondes
; Parameter(s):    $Hwnd - handle du channel
;                   $Length - durée en bytes
; Requirement(s):  AutoIt 3.2 ++
; Return Value(s): 
; Author(s):       Homy
;
;===============================================================================
Func _BassByte2Sec($Hwnd,$Length)
    Local $Ret
    $Ret = DllCall($DllBass, "float", "BASS_ChannelBytes2Seconds", "hwnd", $Hwnd, "int64", $Length)
Return int($Ret[0])
EndFunc   ;==>_BassGetPosition



;===============================================================================
;
; Function Name:   _BassChannelGetLength
; Description::    Donne la durée du fichier en bytes
; Parameter(s):    $Hwnd - Handle du channel ouvert
; Requirement(s):  AutoIt 3.2 ++
; Return Value(s): 
; Author(s):       Homy
;
;===============================================================================
Func _BassChannelGetLength($Hwnd)
    local $Ret
    $Ret = dllcall($DllBass, "dword", "BASS_ChannelGetLength", "hwnd", $Hwnd)
    Return $Ret[0]
EndFunc   ;==>_BassChannelGetLength



;===============================================================================
;
; Function Name:   _BassChannelFormatDuree
; Description::    Formate la durée en mm:ss
; Parameter(s):    $iDuree - Duree a convertir
; Requirement(s):  AutoIt 3.2 ++
; Return Value(s): 
; Author(s):       Homy
;
;===============================================================================
Func _BassChannelFormatDuree($iDuree)
Return StringFormat("%02d:%02d", int($iDuree / 60), Int($iDuree) - (Int(Int($iDuree) / 60) * 60))
EndFunc


;===============================================================================
;
; Function Name:   _BassSetTempo
; Description::    Gere le tempo du channel
; Parameter(s):    $Hwnd - Handle du channel ouvert
;                  $sTempo - tempo -95% à +5000%
; Requirement(s):  AutoIt 3.2 ++
; Return Value(s): none
; Author(s):       Homy
;
;===============================================================================
Func _BassSetTempo($Hwnd, $sTempo)
    If $sTempo >= -95 and $sTempo <= 5000 Then
        DllCall($DllBassFx, "long", "BASS_FX_TempoSet", "hwnd", $Hwnd, "float", $sTempo, "float", 0, "float", -100)
        Return 1
    EndIf
    return 0
EndFunc   ;==>_BassSetTempo

;===============================================================================
;
; Function Name:   _BassSetPitch
; Description::    Gere le pitch du channel
; Parameter(s):    $Hwnd - Handle du channel ouvert
;                  $sPitch - pitch -60 à +60 demin tons
; Requirement(s):  AutoIt 3.2 ++
; Return Value(s): none
; Author(s):       Homy
;
;===============================================================================
Func _BassSetPitch($Hwnd, $sPitch)
    If $sPitch >= -60 and $sPitch <= 60 Then
        DllCall($DllBassFx, "long", "BASS_FX_TempoSet", "hwnd", $Hwnd, "float", -100, "float", 0, "float", $sPitch)
        Return 1
    EndIf
    return 0
EndFunc   ;==>_BassSetPitch

;===============================================================================
;
; Function Name:   _BassGetTag
; Description::    récupère le tag d'un fichier
; Parameter(s):    $sFile - path du fichier a analyser
; Requirement(s):  AutoIt 3.2 ++
; Return Value(s): Array [title,album,artist,année,durée,compositeur,track,genre]
; Author(s):       Homy
;
;===============================================================================
Func _BassGetTag($sFile)
    Local $stream, $length, $tag, $aRet
    $stream = DllCall($DllBass, "hwnd", "BASS_StreamCreateFile", "long", 0, "str", $sFile, "long", 0, "long", 0, "long", 0x40000); ouverture du fichier
    $sLength=_BassChannelGetLength($stream[0])
    $sLength=_BassByte2Sec($stream[0],$sLength)
    $sLength=_BassChannelFormatDuree($sLength)
    

    $tag = DllCall($DllBassTags, "str", "TAGS_Read", "hwnd", $stream[0], "str", "%IFV2(%TITL,%ICAP(%TITL),No Title)" _
                    &chr(1)&"%IFV2(%ALBM,%ICAP(%ALBM),No Album)"&chr(1)&"%IFV2(%ARTI,%ICAP(%ARTI),No Artist)"&chr(1)&"%IFV2(%YEAR,%YEAR,--)" _
                    &chr(1)&"%IFV1(%COMP,%COMP)"&chr(1)&"%IFV1(%TRCK,%TRCK)"&chr(1)&"%IFV1(%GNRE,%GNRE)")
    
    If $tag[0]="" Then $tag[0]="No Title"&chr(1)&"No Album"&chr(1)&"No Artist"&Chr(1)&"--"&chr(1)&chr(1)&chr(1)
    $tag[0] = StringReplace($tag[0],"|"," ")
    $tag[0] = StringReplace($tag[0],"'"," ")
    $tag[0] = StringReplace($tag[0],'"'," ")
    $tag[0] = StringReplace($tag[0], "No Title", StringTrimRight(StringRight($sfile, StringLen($sfile) - StringInStr($sfile, "\", 0, -1)), 4))
    $tag[0] = StringReplace($tag[0], "No Artist","/")
    $tag[0] = StringReplace($tag[0], "No Album","/")
    $aRet=stringsplit($tag[0],Chr(1))
    _ArrayDelete($aRet,0)
    _ArrayInsert($aRet,4,$slength)
    DllCall($DllBass, "short", "BASS_StreamFree", "hwnd", $stream)
    Return $aRet
EndFunc


;===============================================================================
;
; Function Name:   _BassEqualizerInit
; Description::    Créé une bande d'equalizer lié au channel
; Parameter(s):    $hwnd - handle du channel
;                  $fCenter - fréquence centrale
;                  $fBandwidth - largeur de bande
;                  $fGain - gain
; Requirement(s):  AutoIt 3.2 ++
; Return Value(s): handle de l'equalizer
; Author(s):       Homy
;
;===============================================================================
Func _BassEqualizerInit($hwnd,$fCenter,$fBandwidth,$fGain)
    local $hfxtemp
    DllStructSetData($BASS_FXPARAMEQ,"fCenter",$fCenter)
    DllStructSetData($BASS_FXPARAMEQ,"fBandwidth",$fBandwidth)
    DllStructSetData($BASS_FXPARAMEQ,"fGain",$fGain)
    $hfxtemp=DllCall($DllBass,"hwnd","BASS_ChannelSetFX","hwnd",$hwnd,"dword",7,"int",0)
    DllCall($DllBass,"int","BASS_FXSetParameters","hwnd",$hfxtemp[0],"ptr",DllStructGetPtr($BASS_FXPARAMEQ))
    Return $hfxtemp[0]
EndFunc


;===============================================================================
;
; Function Name:   _BassEqualizer
; Description::    ùat à jour une bande d'équalizer
; Parameter(s):    $hwnd - handle du channel de la bande
;                  $fCenter - fréquence centrale
;                  $fGain - gain
; Requirement(s):  AutoIt 3.2 ++
; Author(s):       Homy
;
;===============================================================================
Func _BassEqualizer($hwnd,$fGain,$fCenter)
    DllStructSetData($BASS_FXPARAMEQ,"fGain",$fGain)
    DllStructSetData($BASS_FXPARAMEQ,"fCenter",$fCenter)
    DllCall($DllBass,"int","BASS_FXSetParameters","hwnd",$hwnd,"ptr",DllStructGetPtr($BASS_FXPARAMEQ))
EndFunc


;===============================================================================
;
; Function Name:   _BassStreamCreateUrl
; Description::    Créé un channel a partir d'une Url
; Parameter(s):    $sUrl -url du stream
; Requirement(s):  AutoIt 3.2 ++
; Return Value(s): handle du channel - Success
;                  0 - Failure
; Author(s):       Homy
;
;===============================================================================
Func _BassStreamCreateUrl($sUrl)
    Local $error, $stream
    $stream=DllCall($Dllbass,"hwnd","BASS_StreamCreateURL","str",$sUrl,"dword",0,"dword",0,"ptr","NULL","dword",0)
    $error = dllcall($DllBass, "int", "BASS_ErrorGetCode"); gestion code erreur
    If $error[0] = 0 Then Return $stream[0]
    Return 0
EndFunc   ;==>_BassStreamCreateFile
Link to comment
Share on other sites

Take a look at this.

It's a bit confused, and there is a lot of work remaining but it may help

#include <Array.au3>

Global $DllBass
Global $DllBassTags
Global $DllBassFx
Global $BASS_FXPARAMEQ

$BASS_FXPARAMEQ=DllStructCreate("float fCenter;float fBandwidth;float fGain")



;===============================================================================
;
; Function Name:   _BassInit
; Description::    Initialise la dll
; Parameter(s):    $dll1 - Chemin de la dll "bass.dll"
;                   $dll2 - Chemin de la dll "tags.dll"
;                   $dll3 - Chemin de la dll "bass_fx.dll"
;                  $Hwnd - Handle de la GUI à laquelle on "raccroche" la dll
; Requirement(s):  AutoIt 3.2 ++
; Return Value(s): 1 - Success
;                  0 - Failure
; Author(s):       Homy
;
;===============================================================================
Func _BassInit($dll1, $dll2, $dll3, $Hwnd)
    Local $error
    If Not FileExists($dll1) Then Return 0
    If Not FileExists($dll2) Then Return 0
    If Not FileExists($dll3) Then Return 0
    
    $DllBass = DllOpen($dll1)
    $DllBassTags = DllOpen($dll2)
    $DllBassFx = DllOpen($dll3)
    
    dllCall($DllBass, "short", "BASS_Init", "int", -1, "long", 44100, "long", 0, "long", $Hwnd, "long", "NULL"); initialisation de la dll
    $error = dllcall($DllBass, "int", "BASS_ErrorGetCode"); gestion code erreur
    If $error[0] = 0 Then Return 1
    Return 0
EndFunc   ;==>_BassInit



;===============================================================================
;
; Function Name:   _BassEnd
; Description::    Fin
; Parameter(s):    none
; Requirement(s):  AutoIt 3.2 ++
; Return Value(s): none
; Author(s):       Homy
;
;===============================================================================
Func _BassEnd()
    DllClose($DllBass)
    DllClose($DllBassTags)
    DllClose($DllBassFx)
EndFunc   ;==>_BassEnd

;===============================================================================
;
; Function Name:   _BassPluginLoad
; Description::    Charge un plugin pour la dll
; Parameter(s):    $plugin - Chemin du plugin
; Requirement(s):  AutoIt 3.2 ++
; Return Value(s): 1 - Success
;                  0 - Failure
; Author(s):       Homy
;
;===============================================================================
Func _BassPluginLoad($plugin)
    Local $error, $hplugin
    If Not FileExists($plugin) Then Return 0
    
    $hplugin=dllcall($DllBass, "hwnd", "BASS_PluginLoad", "str", $plugin, "long", 0)
    $error = dllcall($DllBass, "int", "BASS_ErrorGetCode"); gestion code erreur
    If $error[0] = 0 Then Return $hplugin[0]
    Return 0
EndFunc   ;==>_BassPluginLoad



;===============================================================================
;
; Function Name:   _BassStreamCreateFile
; Description::    Créé un channel a partir d'un fichier
; Parameter(s):    $dll - Chemin de la dll "bass.dll"
;                  $plugin - Chemin du plugin
; Requirement(s):  AutoIt 3.2 ++
; Return Value(s): handle du channel - Success
;                  0 - Failure
; Author(s):       Homy
;
;===============================================================================
Func _BassStreamCreateFile($sFile)
    Local $error, $stream
    If Not FileExists($sFile) Then Return 0
    $stream = DllCall($DllBass, "hwnd", "BASS_StreamCreateFile", "long", 0, "str", $sFile, "long", 0, "long", 0, "long", 0x200000+128)
    $stream = DllCall($DllBassFx, "dword", "BASS_FX_TempoCreate", "dword", $stream[0], "dword", 0x10000)
    $error = dllcall($DllBass, "int", "BASS_ErrorGetCode"); gestion code erreur
    If $error[0] = 0 Then Return $stream[0]
    Return 0
EndFunc   ;==>_BassStreamCreateFile



;===============================================================================
;
; Function Name:   _BassPlay
; Description::    Play
; Parameter(s):    $Hwnd - handle du channel
; Requirement(s):  AutoIt 3.2 ++
; Return Value(s): None
; Author(s):       Homy
;
;===============================================================================
Func _BassPlay($Hwnd)
    DllCall($DllBass, "short", "BASS_ChannelPlay", "hwnd", $Hwnd, "long", 0)
EndFunc   ;==>_BassPlay


;===============================================================================
;
; Function Name:   _BassPause
; Description::    Pause
; Parameter(s):    $Hwnd - handle du channel
; Requirement(s):  AutoIt 3.2 ++
; Return Value(s): None
; Author(s):       Homy
;
;===============================================================================
Func _BassPause($Hwnd)
    DllCall($DllBass, "short", "BASS_ChannelPause", "hwnd", $Hwnd)
EndFunc   ;==>_BassPause


;===============================================================================
;
; Function Name:   _BassStop
; Description::    Stop et libère la mémoire
; Parameter(s):    $Hwnd - handle du channel
; Requirement(s):  AutoIt 3.2 ++
; Return Value(s): None
; Author(s):       Homy
;
;===============================================================================
Func _BassStop($Hwnd)
    DllCall($DllBass, "short", "BASS_ChannelStop", "hwnd", $Hwnd) ; stop
    DllCall($DllBass, "short", "BASS_StreamFree", "hwnd", $Hwnd) ; libère la mémoire du stream
EndFunc   ;==>_BassStop



;===============================================================================
;
; Function Name:   _BassSetVolume
; Description::    regle le volume de 0 à 100
; Parameter(s):    $sVol - volume
; Requirement(s):  AutoIt 3.2 ++
; Return Value(s): None
; Author(s):       Homy
;
;===============================================================================
Func _BassSetVolume($sVol)
    If $sVol >= 0 And $sVol <= 100 Then
        DllCall($DllBass, "long", "BASS_SetVolume", "dword", $sVol)
        return $sVol
    EndIf
    return 0
EndFunc   ;==>_BassSetVolume

;===============================================================================
;
; Function Name:   _BassSetPosition
; Description::    gere la position dans le channel
; Parameter(s):    $Hwnd - handle du channel
;                   $sPos - position en secondes
; Requirement(s):  AutoIt 3.2 ++
; Return Value(s): None
; Author(s):       Homy
;
;===============================================================================
Func _BassSetPosition($Hwnd, $sPos)
    Local $temp, $error
    $temp = DllCall($DllBass, "dword", "BASS_ChannelSeconds2Bytes", "hwnd", $Hwnd, "float", $sPos)
    $error = dllcall($DllBass, "int", "BASS_ErrorGetCode"); gestion code erreur
    If Not $error[0] = 0 Then return 0
    DllCall($DllBass, "int", "BASS_ChannelSetPosition", "hwnd", $Hwnd, "int64", $temp[0])
    $error = dllcall($DllBass, "int", "BASS_ErrorGetCode"); gestion code erreur
    If $error[0] = 0 Then return 1
    Return 0
EndFunc   ;==>_BassSetPosition



;===============================================================================
;
; Function Name:   _BassGetPositionByte
; Description::    récupere la position dans le channel en bytes
; Parameter(s):    $Hwnd - handle du channel
; Requirement(s):  AutoIt 3.2 ++
; Return Value(s): position en bytes dans le channel
; Author(s):       Homy
;
;===============================================================================
Func _BassGetPosition($Hwnd)
    Local $Ret
    $Ret = dllcall($DllBass, "dword", "BASS_ChannelGetPosition", "hwnd", $Hwnd)
Return $Ret[0]
EndFunc   ;==>_BassGetPosition


;===============================================================================
;
; Function Name:   _BassByte2Sec
; Description::    transforme  une longueur/position en byte en secondes
; Parameter(s):    $Hwnd - handle du channel
;                   $Length - durée en bytes
; Requirement(s):  AutoIt 3.2 ++
; Return Value(s): 
; Author(s):       Homy
;
;===============================================================================
Func _BassByte2Sec($Hwnd,$Length)
    Local $Ret
    $Ret = DllCall($DllBass, "float", "BASS_ChannelBytes2Seconds", "hwnd", $Hwnd, "int64", $Length)
Return int($Ret[0])
EndFunc   ;==>_BassGetPosition



;===============================================================================
;
; Function Name:   _BassChannelGetLength
; Description::    Donne la durée du fichier en bytes
; Parameter(s):    $Hwnd - Handle du channel ouvert
; Requirement(s):  AutoIt 3.2 ++
; Return Value(s): 
; Author(s):       Homy
;
;===============================================================================
Func _BassChannelGetLength($Hwnd)
    local $Ret
    $Ret = dllcall($DllBass, "dword", "BASS_ChannelGetLength", "hwnd", $Hwnd)
    Return $Ret[0]
EndFunc   ;==>_BassChannelGetLength



;===============================================================================
;
; Function Name:   _BassChannelFormatDuree
; Description::    Formate la durée en mm:ss
; Parameter(s):    $iDuree - Duree a convertir
; Requirement(s):  AutoIt 3.2 ++
; Return Value(s): 
; Author(s):       Homy
;
;===============================================================================
Func _BassChannelFormatDuree($iDuree)
Return StringFormat("%02d:%02d", int($iDuree / 60), Int($iDuree) - (Int(Int($iDuree) / 60) * 60))
EndFunc


;===============================================================================
;
; Function Name:   _BassSetTempo
; Description::    Gere le tempo du channel
; Parameter(s):    $Hwnd - Handle du channel ouvert
;                  $sTempo - tempo -95% à +5000%
; Requirement(s):  AutoIt 3.2 ++
; Return Value(s): none
; Author(s):       Homy
;
;===============================================================================
Func _BassSetTempo($Hwnd, $sTempo)
    If $sTempo >= -95 and $sTempo <= 5000 Then
        DllCall($DllBassFx, "long", "BASS_FX_TempoSet", "hwnd", $Hwnd, "float", $sTempo, "float", 0, "float", -100)
        Return 1
    EndIf
    return 0
EndFunc   ;==>_BassSetTempo

;===============================================================================
;
; Function Name:   _BassSetPitch
; Description::    Gere le pitch du channel
; Parameter(s):    $Hwnd - Handle du channel ouvert
;                  $sPitch - pitch -60 à +60 demin tons
; Requirement(s):  AutoIt 3.2 ++
; Return Value(s): none
; Author(s):       Homy
;
;===============================================================================
Func _BassSetPitch($Hwnd, $sPitch)
    If $sPitch >= -60 and $sPitch <= 60 Then
        DllCall($DllBassFx, "long", "BASS_FX_TempoSet", "hwnd", $Hwnd, "float", -100, "float", 0, "float", $sPitch)
        Return 1
    EndIf
    return 0
EndFunc   ;==>_BassSetPitch

;===============================================================================
;
; Function Name:   _BassGetTag
; Description::    récupère le tag d'un fichier
; Parameter(s):    $sFile - path du fichier a analyser
; Requirement(s):  AutoIt 3.2 ++
; Return Value(s): Array [title,album,artist,année,durée,compositeur,track,genre]
; Author(s):       Homy
;
;===============================================================================
Func _BassGetTag($sFile)
    Local $stream, $length, $tag, $aRet
    $stream = DllCall($DllBass, "hwnd", "BASS_StreamCreateFile", "long", 0, "str", $sFile, "long", 0, "long", 0, "long", 0x40000); ouverture du fichier
    $sLength=_BassChannelGetLength($stream[0])
    $sLength=_BassByte2Sec($stream[0],$sLength)
    $sLength=_BassChannelFormatDuree($sLength)
    

    $tag = DllCall($DllBassTags, "str", "TAGS_Read", "hwnd", $stream[0], "str", "%IFV2(%TITL,%ICAP(%TITL),No Title)" _
                    &chr(1)&"%IFV2(%ALBM,%ICAP(%ALBM),No Album)"&chr(1)&"%IFV2(%ARTI,%ICAP(%ARTI),No Artist)"&chr(1)&"%IFV2(%YEAR,%YEAR,--)" _
                    &chr(1)&"%IFV1(%COMP,%COMP)"&chr(1)&"%IFV1(%TRCK,%TRCK)"&chr(1)&"%IFV1(%GNRE,%GNRE)")
    
    If $tag[0]="" Then $tag[0]="No Title"&chr(1)&"No Album"&chr(1)&"No Artist"&Chr(1)&"--"&chr(1)&chr(1)&chr(1)
    $tag[0] = StringReplace($tag[0],"|"," ")
    $tag[0] = StringReplace($tag[0],"'"," ")
    $tag[0] = StringReplace($tag[0],'"'," ")
    $tag[0] = StringReplace($tag[0], "No Title", StringTrimRight(StringRight($sfile, StringLen($sfile) - StringInStr($sfile, "\", 0, -1)), 4))
    $tag[0] = StringReplace($tag[0], "No Artist","/")
    $tag[0] = StringReplace($tag[0], "No Album","/")
    $aRet=stringsplit($tag[0],Chr(1))
    _ArrayDelete($aRet,0)
    _ArrayInsert($aRet,4,$slength)
    DllCall($DllBass, "short", "BASS_StreamFree", "hwnd", $stream)
    Return $aRet
EndFunc


;===============================================================================
;
; Function Name:   _BassEqualizerInit
; Description::    Créé une bande d'equalizer lié au channel
; Parameter(s):    $hwnd - handle du channel
;                  $fCenter - fréquence centrale
;                  $fBandwidth - largeur de bande
;                  $fGain - gain
; Requirement(s):  AutoIt 3.2 ++
; Return Value(s): handle de l'equalizer
; Author(s):       Homy
;
;===============================================================================
Func _BassEqualizerInit($hwnd,$fCenter,$fBandwidth,$fGain)
    local $hfxtemp
    DllStructSetData($BASS_FXPARAMEQ,"fCenter",$fCenter)
    DllStructSetData($BASS_FXPARAMEQ,"fBandwidth",$fBandwidth)
    DllStructSetData($BASS_FXPARAMEQ,"fGain",$fGain)
    $hfxtemp=DllCall($DllBass,"hwnd","BASS_ChannelSetFX","hwnd",$hwnd,"dword",7,"int",0)
    DllCall($DllBass,"int","BASS_FXSetParameters","hwnd",$hfxtemp[0],"ptr",DllStructGetPtr($BASS_FXPARAMEQ))
    Return $hfxtemp[0]
EndFunc


;===============================================================================
;
; Function Name:   _BassEqualizer
; Description::    ùat à jour une bande d'équalizer
; Parameter(s):    $hwnd - handle du channel de la bande
;                  $fCenter - fréquence centrale
;                  $fGain - gain
; Requirement(s):  AutoIt 3.2 ++
; Author(s):       Homy
;
;===============================================================================
Func _BassEqualizer($hwnd,$fGain,$fCenter)
    DllStructSetData($BASS_FXPARAMEQ,"fGain",$fGain)
    DllStructSetData($BASS_FXPARAMEQ,"fCenter",$fCenter)
    DllCall($DllBass,"int","BASS_FXSetParameters","hwnd",$hwnd,"ptr",DllStructGetPtr($BASS_FXPARAMEQ))
EndFunc


;===============================================================================
;
; Function Name:   _BassStreamCreateUrl
; Description::    Créé un channel a partir d'une Url
; Parameter(s):    $sUrl -url du stream
; Requirement(s):  AutoIt 3.2 ++
; Return Value(s): handle du channel - Success
;                  0 - Failure
; Author(s):       Homy
;
;===============================================================================
Func _BassStreamCreateUrl($sUrl)
    Local $error, $stream
    $stream=DllCall($Dllbass,"hwnd","BASS_StreamCreateURL","str",$sUrl,"dword",0,"dword",0,"ptr","NULL","dword",0)
    $error = dllcall($DllBass, "int", "BASS_ErrorGetCode"); gestion code erreur
    If $error[0] = 0 Then Return $stream[0]
    Return 0
EndFunc   ;==>_BassStreamCreateFile

Any idea why?

edit: didnt see the scrolling in the code, lol, going to test em now, thanks

Edited by tom13
Link to comment
Share on other sites

I did not use "BASS_MusicLoad" that is use for mod music like mo3 or mode format, but "BASS_StreamCreateFile" used for multimedia files such as mp3 or ogg.

edit: didnt see the scrolling in the code, lol, going to test em now, thanks

:) Edited by homy
Link to comment
Share on other sites

I use also "tags.dll" to retrieve informations and "Bass_FX.dll" to modify pitch or tempo of the channel you are playing, add FX like chorus, reverb or flanger...

I see, well autoit.exe crashes for me when using this code:

$test = _BassInit("bass.dll", "tags.dll", "bass_fx.dll", 0)
_BassStreamCreateFile("c:\record\part1two.mp3")
_BassPlay($test)
Sleep(20000)
_BassEnd($test)

am I doing something wrong? Used latest beta.

Link to comment
Share on other sites

Try this.

#include <GUIConstants.au3>


Global $dllbass = DllOpen(@ScriptDir & "\bass.dll")



$file="Apocalypse Please.mp3"


$form1 = GUICreate("dummy")
DllCall($dllbass, "short", "BASS_Init", "int", -1, "long", 44100, "long", 0, "long", $form1, "long", "NULL"); initialisation de la dll
$bass_error = DllCall($dllbass, "int", "BASS_ErrorGetCode")
ConsoleWrite("bass error" & $bass_error[0] & @CRLF)


$stream=DllCall($dllbass,"hwnd","BASS_StreamCreateURL","str",$url,"dword",0,"dword",0,"ptr","NULL","dword",0)
$bass_error = DllCall($dllbass, "int", "BASS_ErrorGetCode")
ConsoleWrite("bass error" & $bass_error[0] & @CRLF)
ConsoleWrite($stream[0]&@CR)
If $bass_error[0] = 0 Then
    DllCall($dllbass,"short","BASS_ChannelPlay","hwnd",$stream[0],"long",0x40000)
    $bass_error = DllCall($dllbass, "int", "BASS_ErrorGetCode")
    ConsoleWrite("bass" & $bass_error[0] & @CRLF)
EndIf

while 1
    sleep(100)
WEnd
Link to comment
Share on other sites

Try this.

#include <GUIConstants.au3>


Global $dllbass = DllOpen(@ScriptDir & "\bass.dll")



$file="Apocalypse Please.mp3"


$form1 = GUICreate("dummy")
DllCall($dllbass, "short", "BASS_Init", "int", -1, "long", 44100, "long", 0, "long", $form1, "long", "NULL"); initialisation de la dll
$bass_error = DllCall($dllbass, "int", "BASS_ErrorGetCode")
ConsoleWrite("bass error" & $bass_error[0] & @CRLF)


$stream=DllCall($dllbass,"hwnd","BASS_StreamCreateURL","str",$url,"dword",0,"dword",0,"ptr","NULL","dword",0)
$bass_error = DllCall($dllbass, "int", "BASS_ErrorGetCode")
ConsoleWrite("bass error" & $bass_error[0] & @CRLF)
ConsoleWrite($stream[0]&@CR)
If $bass_error[0] = 0 Then
    DllCall($dllbass,"short","BASS_ChannelPlay","hwnd",$stream[0],"long",0x40000)
    $bass_error = DllCall($dllbass, "int", "BASS_ErrorGetCode")
    ConsoleWrite("bass" & $bass_error[0] & @CRLF)
EndIf

while 1
    sleep(100)
WEnd
Erm, you're trying to stream for an url even though you haven't set $url ?

gives an error obviousely:

>"C:\Program Files\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Documents and Settings\Tom\Bureaublad\bass24\test2.au3"   
bass error0
C:\Documents and Settings\Tom\Bureaublad\bass24\test2.au3 (17) : ==> Variable used without being declared.:
$stream=DllCall($dllbass,"hwnd","BASS_StreamCreateURL","str",$url,"dword",0,"dword",0,"ptr","NULL","dword",0)
$stream=DllCall($dllbass,"hwnd","BASS_StreamCreateURL","str",^ ERROR
>Exit code: 1   T
Link to comment
Share on other sites

The dll need a GUI to be initialsed with, and you will play a channel, returned by then BasStreamCreateFile fonction.

_BassStop stop the channel play and _BassEnd() without parameter unload dlls.

$dumy=guicreate("")
_BassInit("bass.dll", "tags.dll", "bass_fx.dll", $dumy)
$test=_BassStreamCreateFile("c:\record\part1two.mp3")
_BassPlay($test)
Sleep(20000)
_BassStop($test)
_BassEnd()
Link to comment
Share on other sites

Erm, you're trying to stream for an url even though you haven't set $url ?

gives an error obviousely:

>"C:\Program Files\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Documents and Settings\Tom\Bureaublad\bass24\test2.au3"   
bass error0
C:\Documents and Settings\Tom\Bureaublad\bass24\test2.au3 (17) : ==> Variable used without being declared.:
$stream=DllCall($dllbass,"hwnd","BASS_StreamCreateURL","str",$url,"dword",0,"dword",0,"ptr","NULL","dword",0)
$stream=DllCall($dllbass,"hwnd","BASS_StreamCreateURL","str",^ ERROR
>Exit code: 1   T
oops, bad line ...

$stream = DllCall($dllbass, "dword", "BASS_StreamCreateFile", "long", 0, "str", $file, "long", 0, "long", 0, "long", 0x200000); ouverture du fichier
Link to comment
Share on other sites

The dll need a GUI to be initialsed with, and you will play a channel, returned by then BasStreamCreateFile fonction.

_BassStop stop the channel play and _BassEnd() without parameter unload dlls.

$dumy=guicreate("")
_BassInit("bass.dll", "tags.dll", "bass_fx.dll", $dumy)
$test=_BassStreamCreateFile("c:\record\part1two.mp3")
_BassPlay($test)
Sleep(20000)
_BassStop($test)
_BassEnd()
Link to comment
Share on other sites

  • Moderators

Did I miss where "NULL" works as an actual null and not a string?

0 (zero) (for ptrs) or a blank string has always worked in the past.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Did I miss where "NULL" works as an actual null and not a string?

0 (zero) (for ptrs) or a blank string has always worked in the past.

well it works, maybe because that's how the .dll reads it

Link to comment
Share on other sites

  • Moderators

well it works, maybe because that's how the .dll reads it

I doubt the dll is overloaded to substitute a Long or a ptr for a string that contains the characters of "NULL" << which in itself is obviously not null. If it was great.

I was just trying to point out an "assumable apparent" mistake in the functions above that may or may not help you... but if you'd rather not see if what I said helps with your issue so be it.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

I doubt the dll is overloaded to substitute a Long or a ptr for a string that contains the characters of "NULL" << which in itself is obviously not null. If it was great.

I was just trying to point out an "assumable apparent" mistake in the functions above that may or may not help you... but if you'd rather not see if what I said helps with your issue so be it.

I actually confirmed that that was not the case by saying that that particular part works. Aka I did try it.

Link to comment
Share on other sites

Did I miss where "NULL" works as an actual null and not a string?

0 (zero) (for ptrs) or a blank string has always worked in the past.

lol

I think that you don't missed anything.

It was an error when I wrote my dllcall and it worked as it so I did not ask myself about that.

pfiu, sorry for my poor english, it was a long time without practice.

Link to comment
Share on other sites

  • Moderators

I actually confirmed that that was not the case by saying that that particular part works. Aka I did try it.

And I'm telling you that just because something appears to work in your mind correctly doesn't mean that is right and won't have long term effects.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Create an account or sign in to comment

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

Create an account

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

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

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