Menu sources

Sources des modifications de Setup1.exe

La majeur partie des modifications se fait par l'ajout de se module, j'appelle ensuite les fonctions
MakeModif pour chaque STEPxx
MakeModifCopy pour chaque xx%
CenterFrm dans la fonction CenterFrm existant

( Sources convertis en 6 couleurs avec mon programme VB to HTML)


'****************************************************************************************
Public Sub MakeModif(ByVal Section As String)
Dim vbConst As Long
Dim Ligne As String
Dim tempo
    
    On Error Resume Next
    
    Ligne = ReadIniFile(gstrSetupInfoFile, Section, "LABEL", "")
    If Ligne <> "" Then
    tempo = Split(Ligne, ",")
        Load frmSetup1.lblModif(CLng(tempo(0)))
        Err.Clear
        With frmSetup1.lblModif(CLng(tempo(0)))
            .Caption = Replace(tempo(1), "\n", vbCrLf)
            .Top = PCvalue(tempo(2), frmSetup1.ScaleHeight - .Height)
            .Left = PCvalue(tempo(3), frmSetup1.ScaleWidth - .Width)
            .ForeColor = RGB(CLng(tempo(4)), CLng(tempo(5)), CLng(tempo(6)))
            .Font.Size = CLng(tempo(7))
            .Font.Bold = CBool(CLng(tempo(8)))
            .Font.Italic = CBool(CLng(tempo(9)))
            If Err.Number = 0 Then
                .Visible = True
                .ZOrder
            Else
                .Visible = False
            End If
        End With
    End If
    
    Ligne = ReadIniFile(gstrSetupInfoFile, Section, "IMAGE", "")
    If Ligne <> "" Then
    tempo = Split(Ligne, ",")
        Load frmSetup1.imgModif(CLng(tempo(0)))
        Err.Clear
        If tempo(1) <> "" Then ExtractFileFromCab gsCABFULLNAME, "@" & tempo(1), gsTEMPDIR & tempo(1), gintCabs, gstrSrcPath
    With frmSetup1.imgModif(CLng(tempo(0)))
            .Picture = LoadPicture(gsTEMPDIR & tempo(1))
            .Top = PCvalue(tempo(2), frmSetup1.ScaleHeight - .Height)
            .Left = PCvalue(tempo(3), frmSetup1.ScaleWidth - .Width)
            If Err.Number = 0 Then
                .Visible = True
                .ZOrder
            Else
                .Visible = False
            End If
        End With
        DoEvents
        SetAttr gsTEMPDIR & tempo(1), vbNormal
        Kill gsTEMPDIR & tempo(1)
    End If
    
    Ligne = ReadIniFile(gstrSetupInfoFile, Section, "ALERT", "")
    If Ligne <> "" Then
    tempo = Split(Ligne, ",")
        vbConst = 64
        vbConst = CLng(tempo(1))
        MsgBox Replace(tempo(0), "\n", vbCrLf), vbConst, tempo(2)
    End If
    
End Sub

'****************************************************************************************
Public Sub MakeModifCopy(ByVal Section As String)
Dim tempo
Dim TempoIni As String
Dim Ligne As String

    On Error Resume Next
    
    MakeModif Section
       
    TempoIni = ReadIniFile(gstrSetupInfoFile, Section, "TOP", "")
    If TempoIni <> "" Then
    frmCopy.Top = PCvalue(TempoIni, Screen.Height - frmCopy.Height, Screen.TwipsPerPixelY)
    End If
    
    TempoIni = ReadIniFile(gstrSetupInfoFile, Section, "LEFT", "")
    If TempoIni <> "" Then
    frmCopy.Left = PCvalue(TempoIni, Screen.Width - frmCopy.Width, Screen.TwipsPerPixelX)
    End If
    
    frmCopy.Caption = ReadIniFile(gstrSetupInfoFile, Section, "TITLE", frmCopy.Caption)
    TempoIni = ReadIniFile(gstrSetupInfoFile, Section, "FORECOLOR", "0,0,128")
    If TempoIni <> "" Then
    tempo = Split(TempoIni, ",")
        frmCopy.picStatus.ForeColor = RGB(CLng(tempo(0)), CLng(tempo(1)), CLng(tempo(2)))
    End If
        
End Sub

'****************************************************************************************
Public Function InstallADO() As Boolean
On Error Resume Next
    
    InstallADO = True
    
    If ReadIniFile(gstrSetupInfoFile, "ADO", "ASK", "0") = "1" Then
        If MsgBox(ReadIniFile(gstrSetupInfoFile, "ADO", "MSG", "Voulez vous installer l'acces aux données ?"), _
            vbQuestion + vbYesNo, _
            ReadIniFile(gstrSetupInfoFile, "ADO", "TITLE", "Question ...")) = vbNo Then
            InstallADO = False
        End If
    End If
    
End Function


'****************************************************************************************
Public Function CenterFrm(ByVal frm As Form) As Boolean
Dim TempoIni As String
On Error Resume Next
    CenterFrm = True
    
    If ReadIniFile(gstrSetupInfoFile, frm.Name, "CENTER", "1") = "0" Then
        TempoIni = ReadIniFile(gstrSetupInfoFile, frm.Name, "TOP", "")
        If TempoIni <> "" Then frm.Top = PCvalue(TempoIni, Screen.Height - frm.Height, Screen.TwipsPerPixelY)
    TempoIni = ReadIniFile(gstrSetupInfoFile, frm.Name, "LEFT", "")
        If TempoIni <> "" Then frm.Left = PCvalue(TempoIni, Screen.Width - frm.Width, Screen.TwipsPerPixelX)
    If Err.Number = 0 Then CenterFrm = False
    End If
    
    TempoIni = ReadIniFile(gstrSetupInfoFile, frm.Name, "TITLE", "")
    If TempoIni <> "" Then frm.Caption = TempoIni

End Function

'****************************************************************************************
Public Function PCvalue(ByVal PC As String, ByVal ValueTotal As Long, _
                        Optional ByVal Coef As Long = 1) As Long
Dim tempo As String

On Error Resume Next

    If InStr(1, PC, "%") <> 0 Then
    tempo = Left(PC, Len(PC) - 1)
        PCvalue = CLng(tempo) * ValueTotal / 100
    Else
        PCvalue = CLng(PC) * Coef
    End If
    
End Function