Click here to Skip to main content
13,509,783 members
Rate this:
Please Sign up or sign in to vote.
i've made a windows form application in .Net Framework 4.0 that should keep track on the shell process i.e. "explorer.exe" and if any window or program starts under this "explorer.exe" process, i want to kill it immediately, but NOTE : i don't want to kill "explorer.exe" process because it is required for my other metro style app to be run within.

Hope u get it the question, if not then ask me again and again. But just help me out from this issue.

let me explain my scenario: I am using Windows 8. Now when i open My Computer or My Documents or any other folder that is shown under Windows Explorer, i have captured a screenshot, here is its link. May be now you all can understand my question.

Image Link

I want to prevent the user from opening such windows, until he/she is authenticated by my metro style application. That means when the user will be authenticated, a value in my .xml file is changed and according to that value, i will allow the user to open such windows.

Sorry for my poor English..
Posted 11-Apr-13 23:11pm
Updated 12-Apr-13 3:28am
Steve44 12-Apr-13 5:22am
Your description makes it sound pretty far out of supported scenarios for the explorer.exe process. I would not be surprised, if the resulting behavior would be "strange", bordering on "unexpected".
Vivek-The Geek 12-Apr-13 5:32am
i have seen some snippets that can enumerate all the currently running windows in taskbar, but they just returns the running windows names. They haven't provided how to kill them. They accomplish this by importing user32.dll file..

here is the link i have found :
CHill60 12-Apr-13 6:45am
I think you might be confusing people with saying that they are processes starting "under explorer.exe". I think what you want to do is identify windows processes that are started after your program and issue an EndTask (see[^])
[EDIT]This is the other link I was looking for[^]
Vivek-The Geek 12-Apr-13 9:31am
please see my updated question, i have explained more clearly about my problem there.. Thanx in advance..
ryanb31 12-Apr-13 8:57am
I don't think you actually want what you say you want, even if it were possible.
Vivek-The Geek 12-Apr-13 9:31am
please see my updated question, i have explained more clearly about my problem there.. Thanx in advance..
Dave Kreskowiak 12-Apr-13 15:30pm
Why are you doing this? This sounds like a very poorly thought out idea to control access to a kiosk workstation.
Vivek-The Geek 12-Apr-13 23:13pm
Hello sir, thanks for the reply. Actually I want to prevent the user from accessing the files and folders until they are authenticated from a Metro Style App (also developed by me).

I can't kill the "explorer.exe" process because that process is required to run my Metro Style App, that's why i thought of checking continuously for Child Windows of "explorer.exe" (As all the folders are browsed under this process), and kill them if any exist.

Hope u understood my problem, if not, here is an image link to explain you more clearly.

I tried using EnumChildWindows() from the user32.dll but could not apply successfully, because I'm not too familiar with using this kind of functions.

If there is another way, share with us. Any suggestion will be appreciated.

Sorry for my poor English as its not my first language.
Dave Kreskowiak 13-Apr-13 0:10am
Apparently, Windows authentication isn't enough?? I fail to see the point of authenticating in your app again.
Vivek-The Geek 13-Apr-13 0:34am
Actually i wanted to replace the windows authentication process with my metro app but as it is not possible, i am authenticating the user again.

This is my college project and we are making a metro style app based on pc security, that contains different methods for providing more security.

For example USB Security, whenever the windows starts up, my metro app will prompt the user for right USB device (i.e. previously configured), if it finds the right USB device then only the user can proceed further, till then he should be unable access the files and folders.

Moreover, there are several tricks available on internet on how to bypass windows passwords, for example, if i am not wrong, we can change the windows password from other OS, like Ubuntu, e.g.
Dave Kreskowiak 13-Apr-13 12:05pm
OK. Forget the app entirely. Metro is just a bunch of pretty crap you're using to mask a poor concept underneath. All you're doing is taking what is essentially a username and password and then trying to do crap that really has no value at all. It's very easy to get around what you're attempting to do.

Killing Explorer windows will eventually only get you a crashed Explorer.

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

hi try this,

using System.Diagnostics;

Process me = Process.GetCurrentProcess();
foreach (Process p in Process.GetProcesses())
    if (P.Id != me.Id) // CHANGE me.Id to explorer PID
        P.CloseMainWindow(); // Sends WM_CLOSE; less gentle methods available too
Vivek-The Geek 12-Apr-13 10:24am
but i think this will kill my application too. I want to close all windows explorer windows i.e. My Computer or My Documents or any other folder.

I mean if i open My Computer, it will have the same process ID as the explorer.exe because explorer.exe is the process that provides the GUI for viewing any folder. I want to close all these GUIs, not the explorer.exe process.

Hope you got my concept..

Here is the link to the image, hope that will explain you better...

Image Link :

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web01 | 2.8.180417.1 | Last Updated 12 Apr 2013
Copyright © CodeProject, 1999-2018
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100