;Disable Windows Messenger v1.1 ;Author: Brian P. #include GUICreate ("Windows Messenger Disabler by Brian P.", 400, 110) ; will create a dialog box that when displayed is centered $enablebutton = GuiCtrlCreateButton ("Enable Windows Messenger", 10, 70, 150, 25) $disablebutton = GuiCtrlCreateButton ("Disable Windows Messenger", 10, 35, 150, 25) $aboutbutton = GuiCtrlCreateButton ("About/Help", 250, 35, 80, 25) $getmsnmessenger = GuiCtrlCreateButton ("Get MSN Messenger", 250, 70, 120, 25) $answer = 1 $answer2 = 1 $downloadsuccess = 2 $kilobytessize = 10 $kilobytesread = 5 Opt("TrayIconHide", 1) GUICtrlCreateLabel ("This program disables that anoying windows messenger that comes with windows. It prevents it from interfering with the better MSN Messenger and you can re-enable", 10,10) GUISetState () ; will display an empty dialog box ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() ;this is self explanatory If $msg = $GUI_EVENT_CLOSE Then ExitLoop Select Case $msg = $getmsnmessenger ;User clicks the get MSN Messenger button $answer = MsgBox(4, "MSN Messenger", "MSN Messenger is much different and is far better than Windows Messenger. Would you like to start downloading MSN Messenger to replace your now disabled Windows Messenger?" ) ; Displays the message box asking them if they want to download it and delcares a variables current state EndSelect Select Case $answer = 6 MsgBox(0, "Download will begin...", "The download MSN Messenger installer will begin as soon as you press the OK button. The current download status will be shown in the system tray below, press Esc to cancel the download." ) ; Tells the user that the download is about to begin and that they can cancel it at any time by pressing ESC HotKeySet("{Esc}", "terminate") ; Sets the hotkey ESC as a function DirCreate(@HomeDrive & "\temp") ; Creates a directory for the file that is about to be downloaded Opt("TrayIconHide", 0) ; Shows an icon in the tray so that the tray tip function works $size = InetGetSize("http://download.microsoft.com/download/5/d/9/5d9bb5b2-49c7-4890-94ab-d1d5e44a0e6d/INSTALL_MSN_MESSENGER_DL.EXE") ; Gets the size of the file that is being downloaded. $downloadsuccess = InetGet("http://download.microsoft.com/download/5/d/9/5d9bb5b2-49c7-4890-94ab-d1d5e44a0e6d/INSTALL_MSN_MESSENGER_DL.EXE", @HomeDrive & "\temp\INSTALL_MSN_MESSENGER_DL.EXE", 0, 1) ; Starts the download, give the download source, location and declares a variable $kilobytessize = $size/1024 ; Does a simple equation to display the download in Kilobytes instead of bytes since bytes are too small and aren't commonly used to measure file sizes While @InetGetActive ; Starts a loop that updates download information while the file is downloading $kilobytesread = @InetGetBytesRead/1024 ; Gets the current amount of the file that has been downloaded in Kilobytes TrayTip("Downloading. Esc cancels.", "Kilobytes Remaining = " & $kilobytessize - $kilobytesread, 10, 16) ; Displays the traytop and does an equation to show remaining kilobytes Sleep(250) ; Causes a pause in the program so that it doesn't constantly update the download info which would use 100 percent of the CPU power Wend Opt("TrayIconHide", 1) ; After it is done downloading the tray tip will cease to exist and the icon in the system tray will now hide EndSelect Select Case $answer = 11 ;This is true when the user hits the ESC key $downloadsuccess = InetGet("abort") ;Cancels the download MsgBox(0, "Download Cancelled", "The download of the MSN Messenger installer was cancelled. You may download the installer from the site at any time by going to http://messenger.msn.com" );Displays a message box telling the user that the download has been cancelled $downloadsuccess = 2 ; Resets the download success variable to default $answer = 1 ; Resets the answer variable to default EndSelect Select Case $downloadsuccess = 0 ; If download success is equal to 0 then an error occured. An error such as the program couldn't find the download server MsgBox(0, "Download Error", "There was an error and the download of the MSN Messenger installer could not be started. You may download the installer from the site at any time by going to http://messenger.msn.com. This program will now redirect you to the site." ); A message box appears informing the user that an error has occured and that the download wasn't completed. run("explorer.exe http://messenger.msn.com", "" , @SW_SHOWMAXIMIZED); Opens up a browser to the site where they can download MSN Messenger themselves $downloadsuccess = 2 ; resets the download success value to the default value of 2 $answer = 1 ; resets the answer variable to the default value of 1 EndSelect Select Case $downloadsuccess = 1 ; The file was downloaded successfully $answer = 10 ; Set the variable so that the section of the program that starts when the file is downloaded successfully starts $downloadsuccess = 2 ; reset the download success variable since it was downloaded sucessfully EndSelect Select Case $answer2 = 6 ; Starts because the user said that they wanted to run setup now Runwait(@HomeDrive & "\temp\INSTALL_MSN_MESSENGER_DL.EXE") ; Runs the setup and waits for it to finish Run ( "explorer.EXE " & @HomeDrive & "\temp", "" , @SW_SHOWMAXIMIZED); Once the setup is done, the folder where the setup program is located opens sleep(1000); A one second pause is given for explorer to receive the instructions and open the folder MsgBox(0, "Setup has finished.", "The original setup file is located in this folder. You may delete it now or move it to another folder for archiving. If the setup failed, you can run it again at any time." ); A message box will now appear over the opened and maximized folder window telling the user that this is the setup file and that they may now do whatever that want with it $answer2 = 1 ; Resets the answer variable to 1 EndSelect Select Case $answer2 = 7 ; The user clicked no when they were asked if that wanted to run the setup now Run ("explorer.EXE " & @HomeDrive & "\temp", "" , @SW_SHOWMAXIMIZED) ; Opens the folder where the setup program is located so the user knows where the executable is when the want to run it $answer2 = 1 ; resets the answer variable to 1 EndSelect Select Case $msg = $enablebutton ; This action occurs when the user clicks the enable windows messenger button FileMove( @ProgramFilesDir & "\Messenger\executables\msmsgs.exe", @ProgramFilesDir & "\Messenger\") ; Moves the first executable back to its original location FileMove( @ProgramFilesDir & "\Messenger\executables\msmsgsin.exe", @ProgramFilesDir & "\Messenger\") ; Moves the second executable back to its original location (this executable doesn't exist sometimes, but i have found that it appears in the folder from time to time) DirRemove(@ProgramFilesDir & "\Messenger\executables") ; It now removes the directory where the executables were kept when the Windows Messenger was disabled MsgBox(0, "Done!","Windows Messenger has been restored. Feel free to use it now.") ; It now opens a message box window telling the user that Windows Messenger has been restored and that they can now use it again EndSelect Select Case $answer = 10 ; This occurs when the download of the MSN Messenger file has been completed $answer2 = MsgBox(4, "Download Complete.", "The installer for MSN Messenger was downloaded sucessfully. Would you like to run setup now?" ) ; Asks the user if they want to run the setup now and declares a variable based on their answer $answer = 1 ; Resets the answer variable value to 1 EndSelect Select Case $msg = $disablebutton ; Occurs when the user presses the disable button ProcessClose("msmsgs.exe") ; Closes the process $PID = ProcessExists("msmsgs.exe") ; Will return the PID or 0 if the process isn't found. (I just put this in for kicks, it closes it a second time to make sure) If $PID Then ProcessClose($PID) ProcessClose("msmsgsin.exe"); Closes the process (This process doesn't exist sometimes) $PID = ProcessExists("msmsgsin.exe") ; Will return the PID or 0 if the process isn't found. (I just put this in for kicks, it closes it a second time to make sure) If $PID Then ProcessClose($PID) DirCreate(@ProgramFilesDir & "\Messenger\executables"); Creates a directory for the executables to be stored in Sleep(2000); Waits a total of two seconds for the executables to be off the memory and so that the program doesn't get a can't move the executable because it is currently in use error FileMove(@ProgramFilesDir & "\Messenger\msmsgs.exe", @ProgramFilesDir & "\Messenger\executables\"); Moves the executable to the new folder so that it is disabled FileMove(@ProgramFilesDir & "\Messenger\msmsgsin.exe", @ProgramFilesDir & "\Messenger\executables\"); Moves the executable to the new folder so that it is disabled (This process doesn't exist sometimes) MsgBox(0, "Done!","The anoying Windows Messenger has been fixed. Windows Messenger should no longer bother you. You may want to click the Get MSN Messenger button to get the new MSN Messenger which is completely different and much better."); Informs the user that Windows Messenger has been disabled and tells them that they can get the newer MSN Messenger to replace it because it is much better. EndSelect Select Case $msg = $aboutbutton ;The occurs if the user clicks the about button MsgBox(0, "About Windows Messenger Disabler","This program was created by Brian P. It will work with the Window XP Messenger program. Click the 'Disable Windows Messenger' button to disable it and to prevent it from starting up. Click the 'Enable Windows Messenger' button to re-enable it after disabling it with and only with this program. I am in no way responsible to any damages that may come from using this program. The user accepts all liability and responsibility for using this program."); Opens a message box telling the user about the program EndSelect Wend Func Terminate() ; This is the funtion for the hotkey ESC InetGet("abort") ; Attempt to cancel download $answer = 11 ; Let another section of the program know that the download should be cancelled and to start the If download cancelled case EndFunc