Windows Shell Programming

Started by
10 comments, last by daerid 20 years, 10 months ago
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.
daerid@gmail.com
Advertisement
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!
ok, but what about things like making sure that GetDesktopWnd() returns the desktop window that I specify?

How about handling system tray notifications and such?

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 :\
daerid@gmail.com
It would be my guess that the first window created by the shell is taken to be the desktop window. Try it and see.
.
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:

SendMessage(GetDesktopWindow(), 0x400, 0, 0); // Undocumented call: Shell Loading Finished

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 )
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.

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
daerid@gmail.com
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!
daerid@gmail.com
quote:
ok, but what about things like making sure that GetDesktopWnd() returns the desktop window that I specify?

How about handling system tray notifications and such?

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.

Download it here:http://www.john.findlay1.btinternet.co.uk/links.htm

This topic is closed to new replies.

Advertisement