Page 1 sur 1
[R] capGetDriverDescription
Posté : mar. 16 nov. 2010 19:23
par matwachich
Svp je n'arrive pas à utiliser cette fonction: capGetDriverDescription
http://msdn.microsoft.com/en-us/library ... S.85).aspx
Merci
Re: [..] capGetDriverDescription
Posté : mar. 16 nov. 2010 20:44
par timmalos
Essayez ceci:
Code : Tout sélectionner
Global $aTest
For $i = 0 To 9
$aTest = _capGetDriverDescription($i)
If @error Then ExitLoop
ConsoleWrite($aTest[0] & @TAB & $aTest[1] & @CRLF)
Next
Func _capGetDriverDescription($iDriverIndex)
Local $aCall = DllCall("avicap32.dll", "int", "capGetDriverDescriptionW", _
"ushort", $iDriverIndex, _
"wstr", "", _
"int", 1024, _
"wstr", "", _
"int", 1024)
If @error Or Not $aCall[0] Then
Return SetError(1, 0, 0)
EndIf
Local $aRet[2] = [$aCall[2], $aCall[4]]
Return $aRet
EndFunc
Ou ceci :
Code : Tout sélectionner
#include <WinAPI.au3>
Local $aTest
For $i = 0 To 9
$aTest = _capGetDriverDescription($i)
If @error Then ExitLoop
ConsoleWrite($aTest[0] & @TAB & $aTest[1] & @CRLF)
Next
Func _capGetDriverDescription($iIndex)
Local $tBuffName, $tBuffVer
Local $aResult, $aRet[2]
$tBuffName = DllStructCreate("char[128]")
$tBuffVer = DllStructCreate("char[128]")
$aResult = DllCall("avicap32.dll", "int", "capGetDriverDescriptionA", "ushort", $iIndex, "ptr", DllStructGetPtr($tBuffName), _
"int", 128, "ptr", DllStructGetPtr($tBuffVer), "int", 128)
If @error Then Return SetError(@error, @extended, 0)
If $aResult[0] Then
$aRet[0] = DllStructGetData($tBuffName, 1)
$aRet[1] = DllStructGetData($tBuffVer, 1)
Return $aRet
EndIf
Return SetError(1, 0, 0)
EndFunc
Re: [..] capGetDriverDescription
Posté : mar. 16 nov. 2010 22:05
par matwachich
Un grand merci à toi!!!
Les deux marchent à merveille!
Au fait je bloquais sur le fait qu'il faut passer des buffers à la fonction, en C je saurais le faire mais la...
J'ai bien essayé des DllStruct mais j'ai pas eu l'idée de mettre char[128]!
Encore merki!
Re: [R] capGetDriverDescription
Posté : mar. 16 nov. 2010 23:16
par Jerome
Coucou,
Pour ma simple culture général, pourrez t'on m'expliquer a quoi sa sert de creer sa et dans quel but

Buffer aussi ?
Jérôme