AAZ-Custo-Logon-Screen x86-x64 - V.finale- by Nash

Les autres créations de la Team
Avatar du membre
Nash
Administrateur du site
Administrateur du site
Messages : 4403
Enregistré le : sam. 6 nov. 2010 14:19
Localisation : 89
    unknown unknown

AAZ-Custo-Logon-Screen x86-x64 - V.finale- by Nash

Message par Nash »

CUSTO-LOGON-SCREEN


Custo-logon-screen est fait pour changer l'image de la fenetre de connexion et son logo en quelques clique...


-compatible x86 et x64 (merci sh@rp)
-Possibilité de remettre l'image d'origine de seven
-pas de restriction de taille pour vos images , si celles ci sont trop lourdes , elles seront automatiquement redimensionnées a la taille 1024*768 ...
-fonction ajouter au clique droit
-fonction apercu
ne fonctionne pour l'instant qu'avec le format jpg.


screen :[/size] Image lien :
Contenu caché
Vous devez être inscrit et connecté sur ce forum pour voir le contenu caché.

Merci a sh@rp pour son aide et ses conseils
Merci d'avance pour vos retour et possibilité d'ameliorations :)
Image
• Ryzen 9 5900x
• B550 AORUS PRO 
• RTX 3060ti phoenix 
• thermaltake core p8 tg
• 1 x SSD 500GB   PCIe4 M.2 SEA
• 32 G DDR4 3600 corsaire
• Corsaire 1000w full modulaire passive
• MasterLiquid ML240R RGB
•1 to stockage NVME.M2 PCIe
gibe
Membre VIP
Membre VIP
Messages : 4215
Enregistré le : jeu. 2 déc. 2010 08:43
A remercié : 7 fois
A été remercié : 10 fois
    unknown unknown

Re: AAZ-Custo-Logon-Screen

Message par gibe »

Fonctionne nickel...normal j'y ai mis mes petites pepettes !
:lol:
Image Parfois je me dis que les gens vont se rendre compte de l'arnaque de la mondialisation, du tout électrique, de la cancel culture et qu'ils vont faire la révolution. Puis je réalise que les gens regardent Hanouna, Plus belle la vie, etc.
Avatar du membre
yahyah206
Membre VIP
Membre VIP
Messages : 3554
Enregistré le : mer. 11 mai 2011 18:03
Localisation : Suisse
    unknown unknown

Re: AAZ-Custo-Logon-Screen

Message par yahyah206 »

ah ba je prends direct :inlove:
merci Nash pour ce super taf :clap: :clap:
Zinzin
    unknown unknown

Re: AAZ-Custo-Logon-Screen

Message par Zinzin »

nickel et +12 pour le " restore" ;)
Avatar du membre
Bobby2dallas
Membre VIP
Membre VIP
Messages : 2821
Enregistré le : lun. 23 mai 2011 16:13
Localisation : ~ Nimes
A remercié : 1 fois
    unknown unknown

Re: AAZ-Custo-Logon-Screen

Message par Bobby2dallas »

:clap: Merci Nash! beau travail, encore une fois ! :clap:
Image
0101010001100101011000010110110100100000010000010110000101111010
Image
Avatar du membre
sh@rp
Membre VIP
Membre VIP
Messages : 585
Enregistré le : mar. 1 févr. 2011 13:03
Contact :
    unknown unknown

Re: AAZ-Custo-Logon-Screen

Message par sh@rp »

Bah voilà t'as réussi à faire ce prog. ;)

Mes critiques constructives :

-------------------------------------------------------Côté interface :

- Le filtre "Tous les fichiers(*.*)" dans ton "openfiledialog" est inutile
- Le titre "sélectionnez un fichier Jpeg" de fenêtre de ton "openfiledialog" contient des guillemets qui n'ont pas leur place.
- Le filtre "Fichiers jpeg(*.jpg) contient un guillemet qui n'a pas sa place non plus.
- Les "ToolStripMenuItem" de ton "MenuStrip1" pourraient être agrémentés d'icônes.

---------------------------------------------------------Côté code :

- Ton code pour ajouter ton soft au clic droit est chargé et redondant et de ce fait peut largement être diminuer de moitié (voir plus).
Q : Comment se rendre compte que le code est redondant (à répétitions) ?
R : Quand une certaine partie (des lignes) sont les mêmes que d'autres dans différents endroits d'une même méthode : procédure (Sub) ou fonction (Function).

Q : Que faire pour diminuer ce code redondant ?
R : On doit créer une méthode générique qui permettrait avec la partie redondante de ce code d'être appliquée pour les différents scénarios.

Q : Comment faire ?
R : En identifiant les variables : les valeurs qui sont visibles dans le code redondant. Ce sont ces valeurs qui font que le code n'est pas entièrement identique pour les différents scénarios.

Dans ton cas :

Code : Tout sélectionner

    Dim objArray As Object()
    Dim box As TextBox
    Dim objArray2 As Object()
    Dim flagArray As Boolean()
   If Operators.ConditionalCompareObjectEqual(Me.ComboBox1.SelectedItem, "Haut", False) Then
        Me.AppPath = Application.ExecutablePath
        Me.TextBox1.Text = Me.AppPath
        Me.WshShell = RuntimeHelpers.GetObjectValue(Interaction.CreateObject("WScript.Shell", ""))
        NewLateBinding.LateCall(Me.WshShell, Nothing, "RegWrite", New Object() { "HKEY_CLASSES_ROOT\DesktopBackground\Shell\NCLS\", "NCLS", "REG_SZ" }, Nothing, Nothing, Nothing, True)
        objArray = New Object(3  - 1) {}
        objArray(0) = "HKEY_CLASSES_ROOT\DesktopBackground\Shell\NCLS\icon"
        box = Me.TextBox1
        objArray(1) = box.Text
        objArray(2) = "REG_SZ"
        objArray2 = objArray
        flagArray = New Boolean() { False, True, False }
        NewLateBinding.LateCall(Me.WshShell, Nothing, "RegWrite", objArray2, Nothing, Nothing, flagArray, True)
        If flagArray(1) Then
            box.Text = CStr(Conversions.ChangeType(RuntimeHelpers.GetObjectValue(objArray2(1)), GetType(String)))
        End If
        NewLateBinding.LateCall(Me.WshShell, Nothing, "RegWrite", New Object() { "HKEY_CLASSES_ROOT\DesktopBackground\Shell\NCLS\Position", "Top", "REG_SZ" }, Nothing, Nothing, Nothing, True)
        objArray2 = New Object(3  - 1) {}
        objArray2(0) = "HKEY_CLASSES_ROOT\DesktopBackground\Shell\NCLS\command\"
        box = Me.TextBox1
        objArray2(1) = box.Text
        objArray2(2) = "REG_SZ"
        objArray = objArray2
        flagArray = New Boolean() { False, True, False }
        NewLateBinding.LateCall(Me.WshShell, Nothing, "RegWrite", objArray, Nothing, Nothing, flagArray, True)
        If flagArray(1) Then
            box.Text = CStr(Conversions.ChangeType(RuntimeHelpers.GetObjectValue(objArray(1)), GetType(String)))
        End If
    ElseIf Operators.ConditionalCompareObjectEqual(Me.ComboBox1.SelectedItem, "Milieu", False) Then
        Me.AppPath = Application.ExecutablePath
        Me.TextBox1.Text = Me.AppPath
        Me.WshShell = RuntimeHelpers.GetObjectValue(Interaction.CreateObject("WScript.Shell", ""))
        NewLateBinding.LateCall(Me.WshShell, Nothing, "RegWrite", New Object() { "HKEY_CLASSES_ROOT\DesktopBackground\Shell\NCLS\", "NCLS", "REG_SZ" }, Nothing, Nothing, Nothing, True)
        objArray2 = New Object(3  - 1) {}
        objArray2(0) = "HKEY_CLASSES_ROOT\DesktopBackground\Shell\NCLS\icon"
        box = Me.TextBox1
        objArray2(1) = box.Text
        objArray2(2) = "REG_SZ"
        objArray = objArray2
        flagArray = New Boolean() { False, True, False }
        NewLateBinding.LateCall(Me.WshShell, Nothing, "RegWrite", objArray, Nothing, Nothing, flagArray, True)
        If flagArray(1) Then
            box.Text = CStr(Conversions.ChangeType(RuntimeHelpers.GetObjectValue(objArray(1)), GetType(String)))
        End If
        NewLateBinding.LateCall(Me.WshShell, Nothing, "RegWrite", New Object() { "HKEY_CLASSES_ROOT\DesktopBackground\Shell\NCLS\Position", "Center", "REG_SZ" }, Nothing, Nothing, Nothing, True)
        objArray2 = New Object(3  - 1) {}
        objArray2(0) = "HKEY_CLASSES_ROOT\DesktopBackground\Shell\NCLS\command\"
        box = Me.TextBox1
        objArray2(1) = box.Text
        objArray2(2) = "REG_SZ"
        objArray = objArray2
        flagArray = New Boolean() { False, True, False }
        NewLateBinding.LateCall(Me.WshShell, Nothing, "RegWrite", objArray, Nothing, Nothing, flagArray, True)
        If flagArray(1) Then
            box.Text = CStr(Conversions.ChangeType(RuntimeHelpers.GetObjectValue(objArray(1)), GetType(String)))
        End If
    ElseIf Operators.ConditionalCompareObjectEqual(Me.ComboBox1.SelectedItem, "Bas", False) Then
        Me.AppPath = Application.ExecutablePath
        Me.TextBox1.Text = Me.AppPath
        Me.WshShell = RuntimeHelpers.GetObjectValue(Interaction.CreateObject("WScript.Shell", ""))
        NewLateBinding.LateCall(Me.WshShell, Nothing, "RegWrite", New Object() { "HKEY_CLASSES_ROOT\DesktopBackground\Shell\NCLS\", "NCLS", "REG_SZ" }, Nothing, Nothing, Nothing, True)
        objArray2 = New Object(3  - 1) {}
        objArray2(0) = "HKEY_CLASSES_ROOT\DesktopBackground\Shell\NCLS\icon"
        box = Me.TextBox1
        objArray2(1) = box.Text
        objArray2(2) = "REG_SZ"
        objArray = objArray2
        flagArray = New Boolean() { False, True, False }
        NewLateBinding.LateCall(Me.WshShell, Nothing, "RegWrite", objArray, Nothing, Nothing, flagArray, True)
        If flagArray(1) Then
            box.Text = CStr(Conversions.ChangeType(RuntimeHelpers.GetObjectValue(objArray(1)), GetType(String)))
        End If
        NewLateBinding.LateCall(Me.WshShell, Nothing, "RegWrite", New Object() { "HKEY_CLASSES_ROOT\DesktopBackground\Shell\NCLS\Position", "Bottom", "REG_SZ" }, Nothing, Nothing, Nothing, True)
        objArray2 = New Object(3  - 1) {}
        objArray2(0) = "HKEY_CLASSES_ROOT\DesktopBackground\Shell\NCLS\command\"
        box = Me.TextBox1
        objArray2(1) = box.Text
        objArray2(2) = "REG_SZ"
        objArray = objArray2
        flagArray = New Boolean() { False, True, False }
        NewLateBinding.LateCall(Me.WshShell, Nothing, "RegWrite", objArray, Nothing, Nothing, flagArray, True)
        If flagArray(1) Then
            box.Text = CStr(Conversions.ChangeType(RuntimeHelpers.GetObjectValue(objArray(1)), GetType(String)))
        End If
    End If

On remarque vite la redondance de cette partie de code :

Code : Tout sélectionner

        Me.AppPath = Application.ExecutablePath
        Me.TextBox1.Text = Me.AppPath
        Me.WshShell = RuntimeHelpers.GetObjectValue(Interaction.CreateObject("WScript.Shell", ""))
        NewLateBinding.LateCall(Me.WshShell, Nothing, "RegWrite", New Object() { "HKEY_CLASSES_ROOT\DesktopBackground\Shell\NCLS\", "NCLS", "REG_SZ" }, Nothing, Nothing, Nothing, True)
        objArray = New Object(3  - 1) {}
        objArray(0) = "HKEY_CLASSES_ROOT\DesktopBackground\Shell\NCLS\icon"
        box = Me.TextBox1
        objArray(1) = box.Text
        objArray(2) = "REG_SZ"
        objArray2 = objArray
        flagArray = New Boolean() { False, True, False }
        NewLateBinding.LateCall(Me.WshShell, Nothing, "RegWrite", objArray2, Nothing, Nothing, flagArray, True)
        If flagArray(1) Then
            box.Text = CStr(Conversions.ChangeType(RuntimeHelpers.GetObjectValue(objArray2(1)), GetType(String)))
        End If
        NewLateBinding.LateCall(Me.WshShell, Nothing, "RegWrite", New Object() { "HKEY_CLASSES_ROOT\DesktopBackground\Shell\NCLS\Position", "Top", "REG_SZ" }, Nothing, Nothing, Nothing, True)
        objArray2 = New Object(3  - 1) {}
        objArray2(0) = "HKEY_CLASSES_ROOT\DesktopBackground\Shell\NCLS\command\"
        box = Me.TextBox1
        objArray2(1) = box.Text
        objArray2(2) = "REG_SZ"
        objArray = objArray2
        flagArray = New Boolean() { False, True, False }
        NewLateBinding.LateCall(Me.WshShell, Nothing, "RegWrite", objArray, Nothing, Nothing, flagArray, True)
        If flagArray(1) Then
            box.Text = CStr(Conversions.ChangeType(RuntimeHelpers.GetObjectValue(objArray(1)), GetType(String)))
        End If

Donc pour diminuer en grande partie tout ca il suffit d'identifier les variables (Haut, milieu, bas (Top, Center, Bottom).
) qui font que chaque partie redondantes sont différentes afin de les passer en argument à une procédure.

-->Le nom de ta procédure pourrait s'appeler : CreateRightClic()
-->L'argument à passer à ta procédure serait : La variable de la position de l'item qu'on pourrait nommer "Posit".

-->La procédure s'écrit donc ainsi :

Code : Tout sélectionner

Private sub CreateRightClic (Byval Posit as string)
'Tu places ici ton code redondant et ta variable "Posit" là ou il est nécessaire de l'utiliser
End sub
-->Et voilà la procédure complète :

Code : Tout sélectionner

Private sub CreateRightClic (Byval Posit as string)
        Dim objArray As Object()
        Dim box As TextBox
        Dim objArray2 As Object()
        Dim flagArray As Boolean()
        Me.AppPath = Application.ExecutablePath
        Me.TextBox1.Text = Me.AppPath
        Me.WshShell = RuntimeHelpers.GetObjectValue(Interaction.CreateObject("WScript.Shell", ""))
        NewLateBinding.LateCall(Me.WshShell, Nothing, "RegWrite", New Object() { "HKEY_CLASSES_ROOT\DesktopBackground\Shell\NCLS\", "NCLS", "REG_SZ" }, Nothing, Nothing, Nothing, True)
        objArray = New Object(3  - 1) {}
        objArray(0) = "HKEY_CLASSES_ROOT\DesktopBackground\Shell\NCLS\icon"
        box = Me.TextBox1
        objArray(1) = box.Text
        objArray(2) = "REG_SZ"
        objArray2 = objArray
        flagArray = New Boolean() { False, True, False }
        NewLateBinding.LateCall(Me.WshShell, Nothing, "RegWrite", objArray2, Nothing, Nothing, flagArray, True)
        If flagArray(1) Then
            box.Text = CStr(Conversions.ChangeType(RuntimeHelpers.GetObjectValue(objArray2(1)), GetType(String)))
        End If
        NewLateBinding.LateCall(Me.WshShell, Nothing, "RegWrite", New Object() { "HKEY_CLASSES_ROOT\DesktopBackground\Shell\NCLS\Position", Posit, "REG_SZ" }, Nothing, Nothing, Nothing, True)
        objArray2 = New Object(3  - 1) {}
        objArray2(0) = "HKEY_CLASSES_ROOT\DesktopBackground\Shell\NCLS\command\"
        box = Me.TextBox1
        objArray2(1) = box.Text
        objArray2(2) = "REG_SZ"
        objArray = objArray2
        flagArray = New Boolean() { False, True, False }
        NewLateBinding.LateCall(Me.WshShell, Nothing, "RegWrite", objArray, Nothing, Nothing, flagArray, True)
        If flagArray(1) Then
            box.Text = CStr(Conversions.ChangeType(RuntimeHelpers.GetObjectValue(objArray(1)), GetType(String)))
        End If

End sub
-->Il ne faut pas oublier que lorsque l'utilisateur sélectionne une valeur dans la Combobox qu'il choisit entre celleslà :

- Haut
- Milieu
- Bas

Il faut donc établir une correspondance pour que la valeur qui sera envoyé en tant qu'argument dans ta procédure "CreateRightClic()" c'est à dire l'argument "Posit" arrive dans le corps de ta procédure en tant que valeur qui sera inscrite comme cela dans le registre :

- Top
- Center
- Bottom

Pour se faire tu peux utiliser une conditionnel (If ...Elseif...Elseif... End if) ou un connecteur de sélection (Select ....Case....Case...Case... End Select) :

---> Voilà enfin la procédure finale à placer dans ton "form1" :

Code : Tout sélectionner

Private sub CreateRightClic (Byval Posit as string)
Dim Posit as string = Posit
  Select Case Posit
            Case "Haut"
              Posit = "Top"
            Case "Milieu"
              Posit = "Center"          
            Case "Bas"
              Posit = "Bottom"
  End Select
        Dim objArray As Object()
        Dim box As TextBox
        Dim objArray2 As Object()
        Dim flagArray As Boolean()
        Me.AppPath = Application.ExecutablePath
        Me.TextBox1.Text = Me.AppPath
        Me.WshShell = RuntimeHelpers.GetObjectValue(Interaction.CreateObject("WScript.Shell", ""))
        NewLateBinding.LateCall(Me.WshShell, Nothing, "RegWrite", New Object() { "HKEY_CLASSES_ROOT\DesktopBackground\Shell\NCLS\", "NCLS", "REG_SZ" }, Nothing, Nothing, Nothing, True)
        objArray = New Object(3  - 1) {}
        objArray(0) = "HKEY_CLASSES_ROOT\DesktopBackground\Shell\NCLS\icon"
        box = Me.TextBox1
        objArray(1) = box.Text
        objArray(2) = "REG_SZ"
        objArray2 = objArray
        flagArray = New Boolean() { False, True, False }
        NewLateBinding.LateCall(Me.WshShell, Nothing, "RegWrite", objArray2, Nothing, Nothing, flagArray, True)
        If flagArray(1) Then
            box.Text = CStr(Conversions.ChangeType(RuntimeHelpers.GetObjectValue(objArray2(1)), GetType(String)))
        End If
        NewLateBinding.LateCall(Me.WshShell, Nothing, "RegWrite", New Object() { "HKEY_CLASSES_ROOT\DesktopBackground\Shell\NCLS\Position", Posit, "REG_SZ" }, Nothing, Nothing, Nothing, True)
        objArray2 = New Object(3  - 1) {}
        objArray2(0) = "HKEY_CLASSES_ROOT\DesktopBackground\Shell\NCLS\command\"
        box = Me.TextBox1
        objArray2(1) = box.Text
        objArray2(2) = "REG_SZ"
        objArray = objArray2
        flagArray = New Boolean() { False, True, False }
        NewLateBinding.LateCall(Me.WshShell, Nothing, "RegWrite", objArray, Nothing, Nothing, flagArray, True)
        If flagArray(1) Then
            box.Text = CStr(Conversions.ChangeType(RuntimeHelpers.GetObjectValue(objArray(1)), GetType(String)))
        End If
End sub
---> Et voilà enfin ton code diminué de 2/3 :

Code : Tout sélectionner

Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
    If Operators.ConditionalCompareObjectEqual(Me.ComboBox1.SelectedItem, "Haut", False) Then
         CreateRightClic(Me.ComboBox1.SelectedItem) 
    ElseIf Operators.ConditionalCompareObjectEqual(Me.ComboBox1.SelectedItem, "Milieu", False) Then
         CreateRightClic(Me.ComboBox1.SelectedItem)
    ElseIf Operators.ConditionalCompareObjectEqual(Me.ComboBox1.SelectedItem, "Bas", False) Then
         CreateRightClic(Me.ComboBox1.SelectedItem)
    End If
End sub
Voilà le raisonnement. On otpimise le code en supprimant le superflux. ;)

Maintenant ton code pour ajouter un menu contextuel est très lourd, il y a plus simple mais c'est ton choix...Tu préfères toujours utiliser le shell de vbs tu déclares une multitude de variables alors qu'elles inutiles et consommatrices de mémoire...OO
J'espère que tu tireras un trait sur cette méthode car le framework offre bien plus de possibilités et qui sont bien plus simples à mettre en place. ;) *

Bonne continuation.
Le dev ne se réduit pas à du simple copier/coller de codes sources mais à une incommensurable phase d'apprentissage d'un domaine en perpétuelle évolution !
http://3dotdevcoder.blogspot.fr/
Avatar du membre
Nash
Administrateur du site
Administrateur du site
Messages : 4403
Enregistré le : sam. 6 nov. 2010 14:19
Localisation : 89
    unknown unknown

Re: AAZ-Custo-Logon-Screen

Message par Nash »

Voilà le raisonnement. On otpimise le code en supprimant le superflux.

Maintenant ton code pour ajouter un menu contextuel est très lourd, il y a plus simple mais c'est ton choix...Tu préfères toujours utiliser le shell de vbs tu déclares une multitude de variables alors qu'elles inutiles et consommatrices de mémoire...OO
J'espère que tu tireras un trait sur cette méthode car le framework offre bien plus de possibilités et qui sont bien plus simples à mettre en place. *
tout d'abords , merci d'avoir pris le temps de jeter un oeil sur mon code ;)

oui , j'ai cherché un bout de temps pour le clique droit , et c'est la seule facon que j'a itrouver lollll
je vais donc analyser ton code a tete reposé , et a premiere vue , c'est clair que ca parait bien plus propre ;)

je corrige les quelques "erreurs" qui traine dans le we :) et essaierai de comprendre un peu plus ta methode , car la , j'ai plus fait des essaies en cherchant une methode qui marchait :)

merci pour tout ;)

merci encore ;)

ps: la vache lol , tu as l'oeil , javais meme pas vu guillemets dans openfilediag :D
Image
• Ryzen 9 5900x
• B550 AORUS PRO 
• RTX 3060ti phoenix 
• thermaltake core p8 tg
• 1 x SSD 500GB   PCIe4 M.2 SEA
• 32 G DDR4 3600 corsaire
• Corsaire 1000w full modulaire passive
• MasterLiquid ML240R RGB
•1 to stockage NVME.M2 PCIe
Avatar du membre
Nash
Administrateur du site
Administrateur du site
Messages : 4403
Enregistré le : sam. 6 nov. 2010 14:19
Localisation : 89
    unknown unknown

Re: AAZ-Custo-Logon-Screen V 1.1 by Nash

Message par Nash »

maj v 1.1

-ajouts d'icones dans menu
-retrait des guillemets inutiles ;)
Image
• Ryzen 9 5900x
• B550 AORUS PRO 
• RTX 3060ti phoenix 
• thermaltake core p8 tg
• 1 x SSD 500GB   PCIe4 M.2 SEA
• 32 G DDR4 3600 corsaire
• Corsaire 1000w full modulaire passive
• MasterLiquid ML240R RGB
•1 to stockage NVME.M2 PCIe
jeff64
    unknown unknown

Re: AAZ-Custo-Logon-Screen V 1.1 by Nash

Message par jeff64 »

Salut et merci ;)
Bravo au développeur et à son aide..... :D
Avatar du membre
Prof
Administrateur du site
Administrateur du site
Messages : 8259
Enregistré le : lun. 5 avr. 2010 20:07
Localisation : Vosges
A remercié : 3 fois
A été remercié : 8 fois
Contact :
    unknown unknown

Re: AAZ-Custo-Logon-Screen x86-x64 - V 1.1 by Nash

Message par Prof »

:clap: :clap: :clap:
Règlement du forum
Toute demande d'aide ou de liens par MP est inutile !
Répondre