#### Archived

This topic is now archived and is closed to further replies.

# Windows Shell Programming

This topic is 5655 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I was wondering if anybody has any good references/tutorials on writing a Windows Shell application, to replace explorer.exe Yes, I know this isn''t an easy or small task. But I wanted to give it a shot.

##### Share on other sites
Just create a window which fills the whole screen, and then add the features you want. shouldnt be to complicated.

Then open system.ini file and change the following:
shell = Explorer.exe
to :>
shell = YourProgram.exe

Reboot and enjoy!

##### Share on other sites
ok, but what about things like making sure that GetDesktopWnd() returns the desktop window that I specify?

Iterating through open programs to simulate a taskbar?

About the only thing I can think of that would be easy would be the start menu :\

##### Share on other sites
It would be my guess that the first window created by the shell is taken to be the desktop window. Try it and see.

##### Share on other sites
Hey there, I''m writing a shell replacement too (attempting to implement some of oluyseli''s ideas)

quote:

ok, but what about things like making sure that GetDesktopWnd() returns the desktop window that I specify?

Haven''t thought about that just yet. IMHO, download litestep or somesuch and look at the source. There are quite a lot of undocumented hoops you have jump through.
quote:

Iterating through open programs to simulate a taskbar?

Finally something I know how to do
First of all, if the shell starts running straight away and doesn''t replace explorer in mid-run, (heh..doable sorta) you can simply get messages by RegisterShellWindow() which you have to get by using a LoadLibrary and getProc cuz the standard windows headers don''t include it. Like this:
FARPROC (__stdcall *SetShellWindow)(HWND) = NULL;	BOOL (__stdcall *RegisterShellHookWindow)(HWND) = NULL;	SetShellWindow = (FARPROC (__stdcall *)(HWND))GetProcAddress(GetModuleHandle("USER32.DLL"), "SetShellWindow");	RegisterShellHookWindow = (BOOL (__stdcall *)(HWND))GetProcAddress(GetModuleHandle("USER32.DLL"), "RegisterShellHookWindow");...SetShellWindow(mainWin);RegisterShellHookWindow(mainWin);

This will let you get messages from the kernel like this:

case WM_QUIT:		PostQuitMessage(0);				return 0;		default:		if(nMessage == RegisterWindowMessage(TEXT("SHELLHOOK"))) {...

Google for RegisterShellHookWindow and you''ll get a list of the things you can hook. You will need to override the GetMinWindow or whatever to implement the taskbar (tell the windows where to minimize to). Also you will need to get the icon from the HWND of a program..look at litestep etc. for source on that, all the shells have copied it (it seems anyway) from the same person heh.

Oh, you''re also supposed to send:

To tell windows you''ve finished loading the shell. And, you also have to:
MINIMIZEDMETRICS mm;	mm.cbSize = sizeof(MINIMIZEDMETRICS);	SystemParametersInfo(SPI_GETMINIMIZEDMETRICS, mm.cbSize, &mm, 0);	if(!(mm.iArrange & ARW_HIDE))	{		mm.iArrange |= ARW_HIDE;		SystemParametersInfo(SPI_SETMINIMIZEDMETRICS, mm.cbSize, &mm, 0);	}

To get the shell messages to work properly.

HTH
(also if you get any more info on these fun undoc''ed stuff, give me an IM (AIM), risingdragon3 )

##### Share on other sites
quote:

Then open system.ini file and change the following:
shell = Explorer.exe
to :>
shell = YourProgram.exe

Not in win2k/XP.

You need to change the following registry keys:

HKey_Local_Machine\Software\Windows NT\CurrentVersion\IniFileMapping\system.ini\boot>SYS:Software\Microsoft\Windows NT\CurrentVersion\Winlogon

change this to USR:Software\Microsoft\Windows NT\CurrentVersion\Winlogon

HKey_Current_User\Software\Microsoft\Windows NT\CurrentVersion\Winlogon>Shell to
whatever.exe

This allows each user a different shell which can be useful for testing, you can simply fast-user-switch to the "testshell" user and log on for that to test your shell.

##### Share on other sites
quote:
Original post by risingdragon3
This allows each user a different shell which can be useful for testing, you can simply fast-user-switch to the "testshell" user and log on for that to test your shell.

Wish I could. It''s on a domain, and WinXP pro disables fast user switching for computers on a domain

##### Share on other sites
Ah..devilish. Logging on and off is a pain in the butt... even fast-user-switch gets annoying. I just write the shell, testing it w/ the windows shell already in place. Then every now and again I test w/ a real log in and so on.

also, you may find this list of newly documented undocumented stuff useful (part of MS''s so called settlement):
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnapiover/html/api-overview.asp.
A lot of the stuff is not really connected to shell replacement programming.

Finally, there is a mailing list whose archives are here called shell-coding which could be some help.

HTH!

thanks!

##### Share on other sites
quote:

ok, but what about things like making sure that GetDesktopWnd() returns the desktop window that I specify?

Iterating through open programs to simulate a taskbar?

About the only thing I can think of that would be easy would be the start menu :\

If you had the windows reference, this would be easy. As it has all information on this you need.

1. 1
2. 2
3. 3
Rutin
15
4. 4
5. 5

• 10
• 9
• 9
• 11
• 11
• ### Forum Statistics

• Total Topics
633682
• Total Posts
3013314
×