Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
6819 connectés 

 


Dernière réponse
Sujet : MCI_MAKE_TMSF en VB [Résolu par moi même]
Kyle_Katarn j'au trouvé c'est :
 

Code :
  1. Public Function MCI_MAKE_TMSF( _
  2.   intTrack As Integer, _
  3.   intMinute As Integer, _
  4.   intSecond As Integer, _
  5.   intFrames As Integer) _
  6.   As Long
  7.     ' Comments  : This function converts from Tracks/Minute/Seconds to a position
  8.     '             usable by MCI
  9.     ' Parameters: intTrack - The track position
  10.     '             intMinute - The minute position
  11.     '             intSecond - The seconds position
  12.     ' Returns   : The converted position
  13.     '
  14.     On Error GoTo PROC_ERR
  15.     'MCI_MAKE_TMSF = CLng(intTrack) Or CLng(Shli(intMinute, 8)) Or CLng(Shll(intSecond, 16))
  16.    
  17.     MCI_MAKE_TMSF = CLng(intTrack) Or CLng(Shli(intMinute, 8)) Or CLng(Shll(intSecond, 16)) Or CLng(Shll(Shli(intFrames, 8), 16))
  18.    
  19. PROC_EXIT:
  20.     Exit Function
  21. PROC_ERR:
  22.     MsgBox "Error: " & Err.Number & ". " & Err.Description, , _
  23.             "MCI_MAKE_TMSF"
  24.     Resume PROC_EXIT
  25. End Function
  26. Private Function Shll(ByVal lngNumber As Long, ByVal bytPlaces As Byte) As Long
  27.     ' Comments  : Shifts a numeric Value left the specified number of bits.
  28.     ' Parameters: lngNumber - long Value to shift
  29.     '             bytPlaces - number of places to shift
  30.     ' Returns   : Shifted Value
  31.     '
  32.     Dim dblMultiplier As Double
  33.     ' if we are shifting 32 or more bits, then the result is always zero
  34.     If bytPlaces >= 32 Then
  35.         Shll = 0
  36.     Else
  37.         dblMultiplier = 2 ^ bytPlaces
  38.         Shll = CLng(lngNumber * dblMultiplier)
  39.     End If
  40. End Function
  41. Private Function Shli( _
  42.   ByVal intValue As Integer, _
  43.   ByVal bytPlaces As Byte) _
  44.   As Integer
  45.     ' Comments  : Shifts a numeric value left the specified number of bits.
  46.     '             Left shifting can be defined as a multiplication operation.
  47.     '             For the number of bits we want to shift a value to the
  48.     '             left, we need to raise two to that power, then multiply the
  49.     '             result by our original value.
  50.     ' Parameters: intValue - integer value to shift
  51.     '             bytPlaces - number of places to shift
  52.     ' Returns   : Shifted value
  53.     '
  54.     Dim lngMultiplier As Long
  55.     ' if we are shifting 16 or more bits, then the result is always zero
  56.     If bytPlaces >= 16 Then
  57.         Shli = 0
  58.     Else
  59.         lngMultiplier = 2 ^ bytPlaces
  60.         Shli = CInt(intValue * lngMultiplier)
  61.     End If
  62. End Function


 
A quand la mise en forme VB du texte...


Votre réponse
Nom d'utilisateur    Pour poster, vous devez être inscrit sur ce forum .... si ce n'est pas le cas, cliquez ici !
Le ton de votre message                        
                       
Votre réponse


[b][i][u][strike][spoiler][fixed][cpp][url][email][img][*]   
 
   [quote]
 

Options

 
Vous avez perdu votre mot de passe ?


Vue Rapide de la discussion
Kyle_Katarn j'au trouvé c'est :
 

Code :
  1. Public Function MCI_MAKE_TMSF( _
  2.   intTrack As Integer, _
  3.   intMinute As Integer, _
  4.   intSecond As Integer, _
  5.   intFrames As Integer) _
  6.   As Long
  7.     ' Comments  : This function converts from Tracks/Minute/Seconds to a position
  8.     '             usable by MCI
  9.     ' Parameters: intTrack - The track position
  10.     '             intMinute - The minute position
  11.     '             intSecond - The seconds position
  12.     ' Returns   : The converted position
  13.     '
  14.     On Error GoTo PROC_ERR
  15.     'MCI_MAKE_TMSF = CLng(intTrack) Or CLng(Shli(intMinute, 8)) Or CLng(Shll(intSecond, 16))
  16.    
  17.     MCI_MAKE_TMSF = CLng(intTrack) Or CLng(Shli(intMinute, 8)) Or CLng(Shll(intSecond, 16)) Or CLng(Shll(Shli(intFrames, 8), 16))
  18.    
  19. PROC_EXIT:
  20.     Exit Function
  21. PROC_ERR:
  22.     MsgBox "Error: " & Err.Number & ". " & Err.Description, , _
  23.             "MCI_MAKE_TMSF"
  24.     Resume PROC_EXIT
  25. End Function
  26. Private Function Shll(ByVal lngNumber As Long, ByVal bytPlaces As Byte) As Long
  27.     ' Comments  : Shifts a numeric Value left the specified number of bits.
  28.     ' Parameters: lngNumber - long Value to shift
  29.     '             bytPlaces - number of places to shift
  30.     ' Returns   : Shifted Value
  31.     '
  32.     Dim dblMultiplier As Double
  33.     ' if we are shifting 32 or more bits, then the result is always zero
  34.     If bytPlaces >= 32 Then
  35.         Shll = 0
  36.     Else
  37.         dblMultiplier = 2 ^ bytPlaces
  38.         Shll = CLng(lngNumber * dblMultiplier)
  39.     End If
  40. End Function
  41. Private Function Shli( _
  42.   ByVal intValue As Integer, _
  43.   ByVal bytPlaces As Byte) _
  44.   As Integer
  45.     ' Comments  : Shifts a numeric value left the specified number of bits.
  46.     '             Left shifting can be defined as a multiplication operation.
  47.     '             For the number of bits we want to shift a value to the
  48.     '             left, we need to raise two to that power, then multiply the
  49.     '             result by our original value.
  50.     ' Parameters: intValue - integer value to shift
  51.     '             bytPlaces - number of places to shift
  52.     ' Returns   : Shifted value
  53.     '
  54.     Dim lngMultiplier As Long
  55.     ' if we are shifting 16 or more bits, then the result is always zero
  56.     If bytPlaces >= 16 Then
  57.         Shli = 0
  58.     Else
  59.         lngMultiplier = 2 ^ bytPlaces
  60.         Shli = CInt(intValue * lngMultiplier)
  61.     End If
  62. End Function


 
A quand la mise en forme VB du texte...

Kyle_Katarn Comment fait on MCI_MAKE_TMSF avec VB car je pige rien à la macro définie par C++...

Copyright © 1997-2025 Groupe LDLC (Signaler un contenu illicite / Données personnelles)