Jump to content

how to close explorer.exe


Swift
 Share

Recommended Posts

Any Ideas Anyone?

Because: I am making a script...which explorer.exe needs to be closed...but make a script to do

Processclose("explorer.exe")

and 2 seconds later...it reloads itself...I must stop it from doing that!

Heres my script! This Will Run on Startup once I set it too.! I stole manadars boot menu and edited it! so now its a really cool boot uper!

#include <A2D.au3>;Include the A2D header
#include <GUIConstants.au3>
Dim $sWidth = 720
Dim $sHeight = 400

Dim $sTitle="Old-Style Boot Menu", $sHomepage = "Esc Exits Boot Menu"
Dim $sMenuOptions[5] = ["Load Desktop","Restart","Shutdown","About","Close Boot Menu"]
Dim $sSelected = 0

$hWnd = GUICreate("Bootup Menu", $sWidth, $sHeight,-1,-1,$WS_POPUP)
GUISetState()
_A2DStartup("a2d.dll")

;Create the device.. with error checking.
if (_A2DFailed(_A2DCreateDevice($hWnd, $sWidth, $sHeight, $A2DFORMAT_A8R8G8B8))) Then
    MsgBox(0, "Error", "An error occurred while created the A2D Device!")
    _A2DShutdown("a2d.dll")
    Exit
EndIf

GUIRegisterMsg(0x001C, "_ToggleHotkeys"); Register the keys to toggle when something activates or deactives the app..; WM_ACTIVATEAPP = 0x001C
_ToggleHotkeys(); Initialise the hotkeys this way

$sTitleFont = _A2DCreateFont(20,11,600,False,"MS Sans Serif")
$sOptionFont = _A2DCreateFont(20,11,450,False,"MS Sans Serif")
WinSetOnTop($hWnd,"",1)

While GUIGetMsg() <> -3
    _A2DClear(0xFF0000A8);Clear the screen to blue. (AARRGGBB)
    _A2DBeginScene()
        _A2DDrawLine(10,15,$sWidth-10,15,0xFFA8A8A8); Top Line
        _A2DDrawLine(10,48,$sWidth-10,48,0xFFA8A8A8); Line below title
        _A2DDrawLine(10,$sHeight-15,$sWidth-10,$sHeight-15,0xFFA8A8A8); Bottom line
        
        _A2DDrawLine(10,15,10,$sHeight-14,0xFFA8A8A8); Left lines
        _A2DDrawLine(9,15,9,$sHeight-14,0xFFA8A8A8); Left lines
        
        _A2DDrawText($sTitleFont, $sTitle, 20,22, 300, 33, 0xFFFFFF57)
        _A2DDrawText($sTitleFont, $sHomepage, 485,22, 300, 33, 0xFFFFFF57) 
        
        For $i = 0 to UBound($sMenuOptions)-1
            If $i = $sSelected Then
                _A2DDrawRectangle(20,55+($i*18),$sWidth-40,20,0xFFA8A8A8)
                _A2DDrawText($sOptionFont, $sMenuOptions[$i], 20,55+($i*18), 300, 33, 0xFF000000)
            Else
                _A2DDrawText($sOptionFont, $sMenuOptions[$i], 20,55+($i*18), 300, 33, 0xFFA8A8A8)
            EndIf
        Next
        
        _A2DDrawLine($sWidth-10,15,$sWidth-10,$sHeight-14,0xFFA8A8A8); Right lines
        _A2DDrawLine($sWidth-9,15,$sWidth-9,$sHeight-14,0xFFA8A8A8); Right lines
        
    _A2DEndScene()
    _A2DPresentScene()
WEnd

_A2DReleaseDevice()
_A2DShutdown("a2d.dll")

Func _ToggleHotkeys($lHwnd = 0, $lMsg = 0, $wParam = 0, $lParam = 0)
    If WinActive($hWnd) Then
        HotKeySet("{UP}", "_Up")
        HotKeySet("{DOWN}", "_Down")
        HotKeySet("{ENTER}", "_Select")
    Else
        HotKeySet("{UP}")
        HotKeySet("{DOWN}")
        HotKeySet("{ENTER}")
    EndIf
EndFunc

Func _Up()
    If $sSelected > 0 Then
        $sSelected -= 1
    EndIf
EndFunc

Func _Down()
    If $sSelected < UBound($sMenuOptions)-1 Then
        $sSelected += 1
    EndIf
EndFunc

Func _Select()
    WinSetOnTop($hWnd,"",0)
    If $sSelected = 0 Then checkifdesktopisactive()
    If $sSelected = 1 Then Shutdown(2)
    If $sSelected = 2 Then Shutdown(9)
    If $sSelected = 3 Then MsgBox(0, "About", "Simple Boot Menu By Manadar!")
    If $sSelected = 4 Then Exit
EndFunc


Func checkifdesktopisactive()
    If ProcessExists("explorer.exe") Then MsgBox(0, "Desktop", "Your Desktop Is Already Loaded!")
If Not ProcessExists("explorer.exe") Then Run("explorer.exe")
EndFunc

be aware to run this script you will need some .dll's

Edited by Swift
Link to comment
Share on other sites

Registry:

HKLM\Software\Microsoft\Windows NT\Currentversion\Winlogon

You can changed the "Shell" parameter.

If you change the shell parameter, it should load another .exe in place of explorer.exe at startup.

[font="Verdana"]Valik:Get it straight - I'm not here to say please, I'm here to help - if my help's not appreciated then lotsa luck, gentlemen.[/font]

Link to comment
Share on other sites

Well, I can give it a try for you.

So it isn't a leap into the dark.

I'm out of other ideas.

[font="Verdana"]Valik:Get it straight - I'm not here to say please, I'm here to help - if my help's not appreciated then lotsa luck, gentlemen.[/font]

Link to comment
Share on other sites

_ProcessSuspend("explorer.exe")


Func _ProcessSuspend($process)
$processid = ProcessExists($process)
If $processid Then
    $ai_Handle = DllCall("kernel32.dll", 'int', 'OpenProcess', 'int', 0x1f0fff, 'int', False, 'int', $processid)
    $i_sucess = DllCall("ntdll.dll","int","NtSuspendProcess","int",$ai_Handle[0])
    DllCall('kernel32.dll', 'ptr', 'CloseHandle', 'ptr', $ai_Handle)
    If IsArray($i_sucess) Then
        Return 1
    Else
        SetError(1)
        Return 0
    Endif
Else
    SetError(2)
    Return 0
Endif
EndFunc

Func _ProcessResume($process)
$processid = ProcessExists($process)
If $processid Then
    $ai_Handle = DllCall("kernel32.dll", 'int', 'OpenProcess', 'int', 0x1f0fff, 'int', False, 'int', $processid)
    $i_sucess = DllCall("ntdll.dll","int","NtResumeProcess","int",$ai_Handle[0])
    DllCall('kernel32.dll', 'ptr', 'CloseHandle', 'ptr', $ai_Handle)
    If IsArray($i_sucess) Then
        Return 1
    Else
        SetError(1)
        Return 0
    Endif
Else
    SetError(2)
    Return 0
Endif
EndFunc

That will pause explorer from doing anything. You do however, have to use _processresume. It will take a few seconds for explorer to catch up, not sure what the long-term would be. The only direct method I can 'think' of is the registry. It performs how I explained.

[font="Verdana"]Valik:Get it straight - I'm not here to say please, I'm here to help - if my help's not appreciated then lotsa luck, gentlemen.[/font]

Link to comment
Share on other sites

Hmmm...ok...The file needs to be in C:\WINDOWS right?

Edit: well...im tring this...so...wish me luck!

If I dont post back in 5 minutes. Something has went wrong.

Edited by Swift
Link to comment
Share on other sites

Hmm...well It sorta worked...but I guess since there is NOTHING running...it couldnt open a .dll or something..because it gave me the error that it couldnt load some thing...

this is the error message i got

if (_A2DFailed(_A2DCreateDevice($hWnd, $sWidth, $sHeight, $A2DFORMAT_A8R8G8B8))) Then
    MsgBox(0, "Error", "An error occurred while created the A2D Device!")
    _A2DShutdown("a2d.dll")
    Exit
EndIf
Link to comment
Share on other sites

Hmm...well It sorta worked...but I guess since there is NOTHING running...it couldnt open a .dll or something..because it gave me the error that it couldnt load some thing...

this is the error message i got

if (_A2DFailed(_A2DCreateDevice($hWnd, $sWidth, $sHeight, $A2DFORMAT_A8R8G8B8))) Then
    MsgBox(0, "Error", "An error occurred while created the A2D Device!")
    _A2DShutdown("a2d.dll")
    Exit
EndIf
Right, if your script is meant to run on windows, but you're loading it in place of windows, it doesn't have a valid runtime environment and the API's that autoit interacts with are at that point non-existent... AutoIT is not the language to use to write something to be loaded as a shell as it depends on the operating system which you're stopping.
Link to comment
Share on other sites

run this reg file and notepad will run at next reboot

halting the shell until notepad is closed :)

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce]
"notepad"="notepad.exe"
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...