- OPening Explorer in separate process without Explorer as shell
- Posted by Steve on June 29th, 2006
I have written my own shell replacement for Explorer. All is well. I use
this code:
void OpenLink(int CSIDL)
{
LPITEMIDLIST pidl;
SHGetFolderLocation(NULL,CSIDL,(HANDLE)-1,0,&pidl);
SHELLEXECUTEINFO sei;
ZeroMemory(&sei,sizeof(sei));
sei.cbSize=sizeof(sei);
sei.fMask=SEE_MASK_IDLIST|SEE_MASK_CLASSNAME;
sei.lpIDList=pidl;
sei.lpClass="folder";
sei.lpVerb="open";
sei.nShow=SW_SHOWNORMAL;
ShellExecuteEx(&sei);
}
to open virtual folders, such as Control Panel, My Documents, etc.
The problem is: if I exit the shell (for whatever reason), these folder
windows also close. How can I prevent them from quitting when my shell
ends? With Explorer as shell, there is a setting to open Folder Windows
in a separate process, in order that they stay open should anything
happen to the desktop shell. How can I do this?
- Posted by Eric Jensen on July 1st, 2006
Same way as explore does. Start a new process and pass the parameters you'll
need or whatever way you can think of.
//eric
- Posted by Steve on July 1st, 2006
Eric Jensen wrote:
Explorer window doesn't show as a process in Task Manager.
- Posted by Ali on July 1st, 2006
Steve wrote:
I guess it is something related to system implementation , have you
tried to use fork for that? i'm quite sure its not gonna work. It might
be possible that win32 subsystem only allows *one* explorer.exe process
running at any given time. Unless you present a different name to
Scheduler.
ali
- Posted by Steve on July 2nd, 2006
Ali wrote:
A fork?
With Explorer as shell, you can run folder windows in a separate
process, and Task Manager shows 2 distinct explorer.exe processes.
Don't know what you mean there?
- Posted by Eric Jensen on July 2nd, 2006
It should since you wrote your own replacement.
Here is a small sample of a console program that will if started with one
parameter open 3 more processes of it self.
#include <tchar.h>
#include <iostream>
#include <windows.h>
#include <shellapi.h>
#pragma comment (lib, "shell32.lib")
int _tmain(int argc, _TCHAR* argv[])
{
int i;
if (argc == 2) { // if there is 1 parameter then open 3 copies of this
process
for (i=0; i<3; i++) {
ShellExecute(0, 0, argv[0], 0, 0, SW_SHOW);
}
}
system("pause");
return 0;
}
- Posted by Ali on July 2nd, 2006
Steve wrote:
Don't have any UNIX machine near me at this time but i beleive that
fork is based on ANSI C, I'm sure you know that all but why there is
a question mark?
Try this,
1) Open up your kick your task manager with "Process View" so you
should be watching all the processes name , Handles and threads
columns.
2) Start->Run->CMD and try to open a new "explorer.exe".
3) You will endup a new windows explorer but your task manager will not
show any addition in process count. Though you will see addition in
Handle and thread count of existing "explorer.exe".
Got it?
Any way my point was that , the kernel's scheduler supporting win32
subsystem only allows a single view of process named
"explorer.exe". I havn't gone through the Scheduler code so its
just my guess and I do have reasons for that.
Let see if any Scheduler guy here can help us to understand this all.
ali
- Posted by Steve on July 2nd, 2006
Eric Jensen wrote:
and have it handle nothing but the explorer window.