Bonjour. Je veux traduire le code suivant en Windev mais je n'y arrive pas. C'est pour régler le gamma de l'ordi. Si quelqu'un sait le faire ça serait cool ! Merci.
Option Explicit 'Declaration de variales ( array ), et des apis pour avoir le gamma, le changer. Private abc1(0 To 255, 0 To 2) As Integer Private abc2(0 To 255, 0 To 2) As Integer Dim a As Integer, b As Integer Private Declare Function GetDeviceGammaRamp Lib "gdi32" (ByVal hdc As Long, lpv As Any) As Long Private Declare Function SetDeviceGammaRamp Lib "gdi32" (ByVal hdc As Long, lpv As Any) As Long Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long) Private Sub Command1_Click() 'Augmenter le gamma On Error Resume Next Dim iCtr As Integer Dim lVal As Long For iCtr = 0 To 255 lVal = Int2Lng(abc1(iCtr, 0)) abc2(iCtr, 0) = Lng2Int(Int2Lng(abc1(iCtr, 0)) * a) abc2(iCtr, 1) = Lng2Int(Int2Lng(abc1(iCtr, 1)) * a) abc2(iCtr, 2) = Lng2Int(Int2Lng(abc1(iCtr, 2)) * a) Next iCtr a = a + 2 b = b - 2 SetDeviceGammaRamp Me.hdc, abc2(0, 0) End Sub Private Sub Command2_Click() 'Le Diminuer... On Error Resume Next Dim iCtr As Integer Dim lVal As Long For iCtr = 0 To 255 lVal = Int2Lng(abc1(iCtr, 0)) abc2(iCtr, 0) = Lng2Int(Int2Lng(abc1(iCtr, 0)) / b) abc2(iCtr, 1) = Lng2Int(Int2Lng(abc1(iCtr, 1)) / b) abc2(iCtr, 2) = Lng2Int(Int2Lng(abc1(iCtr, 2)) / b) Next iCtr b = b + 2 a = a - 2 SetDeviceGammaRamp Me.hdc, abc2(0, 0) End Sub Private Sub Command3_Click() 'Restaurer SetDeviceGammaRamp Me.hdc, abc1(0, 0) End Sub Private Sub Command4_Click() 'Fermer Unload Me End Sub Private Sub Form_Load() 'Restaurer avant de quitter completement... GetDeviceGammaRamp Me.hdc, abc1(0, 0) a = 2 b = 2 End Sub Private Sub Form_Unload(Cancel As Integer) SetDeviceGammaRamp Me.hdc, abc1(0, 0) End Sub Public Function Int2Lng(IntVal As Integer) As Long ' Convertir Integer en Long CopyMemory Int2Lng, IntVal, 2 End Function Public Function Lng2Int(Value As Long) As Integer ' Convertir Long en Integer CopyMemory Lng2Int, Value, 2 End Function |