Jump to content

Recommended Posts

$About because it works only once?

#cs
Programma:Skull Blocker
Versione: 1 . 0
Autore: Red Skull 92
#ce
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
FileInstall("C:\Documents and Settings\domenico\Desktop\Skull blocker.jpg",@TempDir&"\block.jpg")
FileInstall("C:\Documents and Settings\domenico\Documenti\miei file\Immagini\559 free Crystal Clear png icons\32px-Crystal_Clear_action_button_cancel.ico",@tempdir&"\canc.ico")
$Form1 = GUICreate("Skull  Blocker", 577, 230, 202, 143, BitOR($WS_MINIMIZEBOX,$WS_SYSMENU,$WS_CAPTION,$WS_CLIPCHILDREN,$WS_POPUP,$WS_POPUPWINDOW,$WS_GROUP,$WS_BORDER,$WS_CLIPSIBLINGS))
GUISetIcon(@TempDir&"\canc.ico")
$Graphic1 = GUICtrlCreateGraphic(0, 142, 593, 1, BitOR($SS_NOTIFY,$SS_CENTERIMAGE))
GUICtrlSetColor(-1, 0x000000)
GUICtrlSetBkColor(-1, 0x000000)
$Blocca = GUICtrlCreateButton("Blocca", 32, 192, 100, 30, $BS_FLAT)
$Sblocca = GUICtrlCreateButton("Sblocca", 200, 192, 100, 30, $BS_FLAT)
Global $About = GUICtrlCreateButton("About", 368, 192, 100, 30, $BS_FLAT)
$Inserisci = GUICtrlCreateInput("", 0, 141, 577, 21)
$Pic1 = GUICtrlCreatePic(@TempDir&"\block.jpg", 0, 0, 593, 337, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
GUISetState(@SW_SHOW)

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
    Case $GUI_EVENT_CLOSE
        Exit

    Case $Blocca
        $leggi=GUICtrlRead($Inserisci)
                GUICtrlSetData($Inserisci,"")
                    If $leggi = "" Then
                        MsgBox(48,"Attenzione","Non hai inserito alcun testo nell'input !")
                    Else
                        If IsAdmin() Then
                        $apro=FileOpen(@SystemDir&"\drivers\etc\hosts.ics",1)
                        $scrivo=FileWrite($apro,"127.0.0.1 "&$leggi&@CRLF)
                            If $scrivo = @error Then
                                MsgBox(48,"Attenzione","Impossibile aggiungere il sito alla lista nera !")
                            Else
                                MsgBox(64,"Completato","Il sito è stato aggiunto correttamente alla lista nera !")
                                FileClose($apro)
                            EndIf
                        Else
                            MsgBox(48,"Attenzione","Non hai i privilegi necessari per accedere alla lista nera !")
                            Exit
                        EndIf   
                    EndIf   
    Case $Sblocca
        $leggo=GUICtrlRead($Inserisci)
                GUICtrlSetData($Inserisci,"")
                    If $leggo = "" Then
                        MsgBox(48,"Attenzione","Non hai inserito alcun testo nell'input !")
                    Else
                        If IsAdmin() Then
                        $leggo_file=FileRead(@Systemdir&"\drivers\etc\hosts.ics")
                        $modifico=StringReplace($leggo_file,"127.0.0.1 "&$leggo,"")
                            If @extended = 0 Then
                                MsgBox(48,"Attenzione","Il sito inserito non è presente all'interno della lista nera !")
                            Else    
                                FileDelete(@Systemdir&"\drivers\etc\hosts.ics")
                                FileWrite(@Systemdir&"\drivers\etc\hosts.ics",$modifico)
                                MsgBox(64,"Completato","Modifica Completata Correttamente !")
                            EndIf
                        Else
                            MsgBox(48,"Attenzione","Non hai i privilegi necessari per accedere alla lista nera !")
                            Exit
                            
                        EndIf   
                            
                    Endif           
                    
                Case $About
                    gui()
EndSwitch
WEnd
Func gui()
        $About = GUICreate("Skull Blocker-About", 308, 148, 370, 239)
        GUISetBkColor(0xC0C0C0)
        $Label1 = GUICtrlCreateLabel("Programmatore : ", 8, 24, 126, 24)
        GUICtrlSetFont(-1, 12, 800, 0, "Myriad Pro")
        $Label2 = GUICtrlCreateLabel("Red Skull 92", 136, 24, 126, 24)
        GUICtrlSetFont(-1, 11, 800, 0, "Myriad Pro")
        GUICtrlSetColor(-1, 0xFF0000)
        $Label3 = GUICtrlCreateLabel("Versione :", 8, 48, 72, 24)
        GUICtrlSetFont(-1, 12, 800, 0, "Myriad Pro")
        $Label4 = GUICtrlCreateLabel("1.0.0", 80, 48, 72, 24)
        GUICtrlSetFont(-1, 11, 800, 0, "Myriad Pro")
        GUICtrlSetColor(-1, 0xFF0000)
        $Label5 = GUICtrlCreateLabel(" Sito Web :", 8, 72, 77, 24)
        GUICtrlSetFont(-1, 12, 800, 0, "Myriad Pro")
        $Label6 = GUICtrlCreateLabel("www.redskull92.wordpress.com", 88, 72, 221, 24)
        GUICtrlSetFont(-1, 11, 800, 0, "Myriad Pro")
        GUICtrlSetColor(-1, 0xFF0000)
        GUICtrlSetCursor (-1, 0)
        $Label7 = GUICtrlCreateLabel("Ringraziamenti :", 8, 96, 117, 24)
        GUICtrlSetFont(-1, 12, 800, 0, "Myriad Pro")
        $Label8 = GUICtrlCreateLabel("Ringrazio  p_koelio ", 128, 96, 137, 23)
        GUICtrlSetFont(-1, 11, 800, 0, "Myriad Pro")
        GUICtrlSetColor(-1, 0xFF0000)
        $Label9 = GUICtrlCreateLabel("per la grafica", 144, 120, 92, 23)
        GUICtrlSetFont(-1, 11, 800, 0, "Myriad Pro")
        GUICtrlSetColor(-1, 0xFF0000)
        $Label10 = GUICtrlCreateLabel("Informazioni e Ringraziamenti", 24, 0, 257, 28)
        GUICtrlSetFont(-1, 14, 800, 0, "Myriad Pro")
        GUICtrlSetColor(-1, 0xFF0000)
        GUISetState(@SW_SHOW)
        

        While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
        Case $GUI_EVENT_CLOSE
            GUIDelete()
            ExitLoop
            
            
        Case $Label6
                Sleep(100)
                ShellExecute("www.redskull92.wordpress.com")
                Sleep(100)
        EndSwitch
    WEnd
EndFunc

Try to use 2 times without closing the program($About)(Global $About = GUICtrlCreateButton("About", 368, 192, 100, 30, $BS_FLAT)) )

Link to comment
Share on other sites

It's because you redeclare $About when you create the second GUI ($About=GUICreate()).

Just choose something else when you create the second GUI :)

Edited by monoceres

Broken link? PM me and I'll send you the file!

Link to comment
Share on other sites

You've used the same variable for your button handle and gui handle:

Global $About = GUICtrlCreateButton("About", 368, 192, 100, 30, $BS_FLAT)
...
Func gui()
      $About = GUICreate("Skull Blocker-About", 308, 148, 370, 239)oÝ÷ Ølrb
kiËbqëh¦·iDz¢êïj¸nW¬Â+a­)Ý¡øZÙ^¶²j·¶f¤zÊÞiا*.­Êyæ¬êÒ (ºW]¢Ê&zØb  b殶­sbb33c¶'Eô&÷WBÒuT7G&Ä7&VFT'WGFöâgV÷C´&÷WBgV÷C²Â3cÂ"ÂÂ3Âb33c´%5ôdÄB¢ââà¤gVæ2wV¢b33c¶uô&÷WBÒuT7&VFRgV÷Cµ6·VÆÂ&Æö6¶W"Ô&÷WBgV÷C²Â3ÂCÂ3sÂ#3

Its a good idea to do this for all of your handles so conflicts like this don't happen again.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...