Bonjour PCPT , vous avez dit que je lance des questions sur le forum sans faire un suivi.oui vous avez raison mais je travaille pour une société mon application tourne bien sur cetrains ordi et à chaque fois ke je rencontre ce pb je me tourne vers le forum. pour mon logiciel j'ai deux version une vb + access et l'autre vb + SQL .
pour celle vb access je peut accéder à certains fenêtres et pour d'autre je reçois le message dit.et par contre je peut pas exécuter la version VB + SQL le système m'affiche le message "Erreur d'éxécution 7 : Mémoire insuffisante."
je démarre mon appli avec un sub Main dont voilà le code :
Sub Main()
Dim WindowsVersion As String
Dim ComputerNameCode As String
Dim SecuriteCode As String
Dim CurrentChar As String
Dim CurrentCharAsc As String
Dim Lng As Integer
Dim PreFixe As String
Dim i As Integer
Dim Nomserveur As String
Dim NumLicence As String
Dim NumLicenceSaisie As String
Dim MsgLicence As String
Dim CleSecret As String
Dim AscCle As String
''InitCommonControlsIsVB
ParaSociete = False
ComputerName = Space(255)
Call GetComputerName(ComputerName, 255)
ComputerName = Mid(Trim(ComputerName), 1, 6)
WindowsVersion = Trim(GetVersion())
Lng = Len(ComputerName)
PreFixe = Right(WindowsVersion, 6)
PreFixe = Trim(Str(Val(PreFixe) + 71))
CleSecret = Trim("Gest")
Lng = Len(ComputerName)
PreFixe = Right(WindowsVersion, 6)
'ComputerName = StrToLong(Comp uterName)
ComputerNameCode = ""
SecuriteCode = ""
Dim j As Integer
j = 0
For i = 1 To Lng
CurrentCharAsc = Asc(Mid(ComputerName, i, 1))
AscCle = Asc(Mid(CleSecret, IIf(Len(CleSecret) > i, i, 1), 1))
CurrentChar = Hex(Val(CurrentCharAsc) + Val(AscCle))
If Len(CurrentChar) = 1 Then
CurrentChar = "0" & CurrentChar
End If
ComputerNameCode = ComputerNameCode & CurrentChar
Next i
For i = 1 To 6
CurrentCharAsc = Asc(Mid(ComputerNameCode, i, 1))
AscCle = Asc(Mid(CleSecret, IIf(Len(CleSecret) > i, i, 1), 1))
Code1 = Code1 & Trim(CStr((Val(CurrentCharAsc) + Val(AscCle) + Val(Mid(PreFixe, IIf(Len(PreFixe) > i, i, 1), 1)))))
Next i
Code1 = Left(Code1, 6)
'''''''''''''''''''''''''''''' 2ème code '''''''''''''''''''''''''''''''''''''
CleSecret = "ALGEST"
ComputerNameCode = ""
For i = 1 To Lng
CurrentCharAsc = Asc(Mid(ComputerName, i, 1))
AscCle = Asc(Mid(CleSecret, IIf(Len(CleSecret) > i, i, 1), 1))
CurrentChar = Hex(Val(CurrentCharAsc) + Val(AscCle))
If Len(CurrentChar) = 1 Then
CurrentChar = "0" & CurrentChar
End If
ComputerNameCode = ComputerNameCode & CurrentChar
Next i
For i = 1 To 6
CurrentCharAsc = Asc(Mid(ComputerNameCode, i, 1))
AscCle = Asc(Mid(CleSecret, IIf(Len(CleSecret) > i, i, 1), 1))
Code2 = Code2 & Trim(CStr((Val(CurrentCharAsc) + Val(AscCle) + Val(Mid(PreFixe, IIf(Len(PreFixe) > i, i, 1), 1)))))
Next i
Code2 = Left(Code2, 6)
'''''''''''''''''''''''''''''' 3ème code ''''''''''''''''''''''''''''''''''''
CleSecret = "MsGest"
ComputerNameCode = ""
For i = 1 To Lng
CurrentCharAsc = Asc(Mid(ComputerName, i, 1))
AscCle = Asc(Mid(CleSecret, IIf(Len(CleSecret) > i, i, 1), 1))
CurrentChar = Hex(Val(CurrentCharAsc) + Val(AscCle))
If Len(CurrentChar) = 1 Then
CurrentChar = "0" & CurrentChar
End If
ComputerNameCode = ComputerNameCode & CurrentChar
Next i
For i = 1 To 6
CurrentCharAsc = Asc(Mid(ComputerNameCode, i, 1))
AscCle = Asc(Mid(CleSecret, IIf(Len(CleSecret) > i, i, 1), 1))
Code3 = Code3 & Trim(CStr((Val(CurrentCharAsc) + Val(AscCle) + Val(Mid(PreFixe, IIf(Len(PreFixe) > i, i, 1), 1)))))
Next i
Code3 = Left(Code3, 6)
'''''''''''''''''''''''''''''' 4ème code ''''''''''''''''''''''''''''''''''''
CleSecret = "COMMERCE"
ComputerNameCode = ""
For i = 1 To Lng
CurrentCharAsc = Asc(Mid(ComputerName, i, 1))
AscCle = Asc(Mid(CleSecret, IIf(Len(CleSecret) > i, i, 1), 1))
CurrentChar = Hex(Val(CurrentCharAsc) + Val(AscCle))
If Len(CurrentChar) = 1 Then
CurrentChar = "0" & CurrentChar
End If
ComputerNameCode = ComputerNameCode & CurrentChar
Next i
' Directory
For i = 1 To 6
CurrentCharAsc = Asc(Mid(ComputerNameCode, i, 1))
AscCle = Asc(Mid(CleSecret, IIf(Len(CleSecret) > i, i, 1), 1))
Code4 = Code4 & Trim(CStr((Val(CurrentCharAsc) + Val(AscCle) + Val(Mid(PreFixe, IIf(Len(PreFixe) > i, i, 1), 1)))))
Next i
Code4 = Left(Code4, 6)
SecuriteCode = Code1 & "L" & Code2 & "o" & Code3 & "B" & Code4
'''''''''''''''''''''' Extraire la Clé ''''''''''''''''''''
Dim s As String
Dim st As String
s = Space(255)
Call GetWindowsDirectory(s, 255)
st = Left(s, Len(Trim(s)) - 1)
Open st & "\system32\config\SysGUserKey.Don" For Random Access Read Write As #1 Len = Len(Enreg)
NumLicence = "" 'GetSetting("SysLG", App.ProductName, "Licence", 0)
i = Loc(1)
If i >= 1 Then
i = 1
Seek #1, i
Else
i = LOF(1) / Len(Enreg) + 1
If i >= 1 Then i = 1
End If
Get #1, i, Enreg
NumLicence = Enreg.Cle1 & "L" & Enreg.Cle2 & "o" & Enreg.Cle3 & "B" & Enreg.Cle4
' Close #1
'''''''''''''''''''''''''''''''''''''''''
If NumLicence <> SecuriteCode Then
'MsgBox "Vous avez droit à 30 accès au programme dans cas où vous n'avez pas de N°Licence." & Chr(13) & "Si vous atteignez ce nombre là vous n'avez plus possibilité d'accés au programme qu'aprés saisie du N°Licence."
If Enreg.NbrAcces >= 30 And Enreg.NbrEssai > 3 Then
End
Else
If Enreg.Gratuit = True And Enreg.NbrAcces <= 30 Then
If MsgBox("il vous reste " & 30 - Enreg.NbrAcces & " accèes gratuit au programme, dès que vous dépasserez 30 accèes, il vous sera demandé de saisir le N°Licence." & Chr(13) & Chr(13) & " - Si vous voulez resaisir le N°Licence Cliquez sur 'Oui'" & Chr(13) & " - Sinon cliquez sur 'Non' pour continuer.", vbInformation + vbYesNo, App.ProductName) = vbNo Then
i = Loc(1)
If i > 1 Then i = 1
Enreg.NbrAcces = Enreg.NbrAcces + 1
Enreg.NbrEssai = 0
Enreg.Gratuit = True
Enreg.Cle1 = "": Enreg.Cle2 = "": Enreg.Cle3 = "": Enreg.Cle4 = ""
Put #1, i, Enreg
Else
Load FrmPrincipale
FrmPrincipale.Show vbModal
End If
Else
Load FrmPrincipale
FrmPrincipale.Show vbModal
End If
End If
End If
' End Select
ComputerName = Space(255)
Call GetComputerName(ComputerName, 255)
ComputerName = Trim(ComputerName)
ComputerName = Left(ComputerName, Len(ComputerName) - 1)
Nomserveur = GetSetting(App.Title, "Settings", "ServerName", "")
If Dir(App.Path & "\MsGestConfig.ini") = "" Then
Close #1
Open App.Path & "\MsGestConfig.ini" For Output As #1
Close #1
EcritIni "MsGest", "SocName", "", App.Path & "\MsGestConfig.ini"
Dossier = ""
End If
If Nomserveur = "" Then
Dossier = ""
Else
If ComputerName <> Nomserveur Then
Dossier = GetSetting(App.Title, "Settings", "BdName", "")
End If
End If
If Dossier = "" Then Dossier = LitIni("MsGest", "SocName", App.Path & "\MsGestConfig.ini")
'Affichage de l'ecran de démarage
frmSplash.Show
If Dossier = "" Then
FrmOuvrirSoc.Show vbModal
Else
frmLogin.Show vbModal
End If
If Not frmLogin.OK Then
''l 'ouverture de session a échoué. Application terminée
End
End If
'''''''''''''L'ouverture de l'application'''''''''''''''''''''''
OuvrirSoc = False
Unload frmSplash
Unload frmLogin
Set fMainForm = New FrmMain
fMainForm.Show
MDIShow = True
If ParaSociete = True Then
frmEntreprise.Show
End If
''''''''''Initialisation de la table des valeurs par défaut''''''
fMainForm.sbStatusBar.Panels(2) = UCase(Utilisateur)
''Afficher le Chemin complet de la base de données
fMainForm.sbStatusBar.Panels(3).Text = UCase(Mid(Dossier, 3, 100))
End Sub
N.B: toutes les variables sont déclarées dans un module en mode Public.
Merci.