Link to home
Start Free TrialLog in
Avatar of bcrotaz
bcrotaz

asked on

Turn an exe into a shell

I'm writing a machine control app, that runs under NT.  As it's a dedicated app, I'd like to stop the user getting at anything other than the app.  Therefore I'd like to write it as a shell for NT.

The question is, how?

It's currently a working Exe, with no required DLLs.
Avatar of Madshi
Madshi

In win95 you would have to change "c:\windows\system.ini\[boot]\shell=Explorer.Exe" to "...\shell=c:\YourAppsPath\YourApp.exe".
AFAIK, in winNT the "system.ini" is mirrored in the registry. So please look if you find the corresponding entries in the registry. But I don't know if it works - you'll have to try it.
If it works, your application is just started instead of "explorer.exe", which is responsible for drawing the desktop icons and the taskbar and ...
So I think that would be exactly what you need. The only thing - as I said before - I don't know if it works with winNT as well.

Regards, Madshi.
Avatar of bcrotaz

ASKER

Anyone else - are there any things you need to do in the exe to support being a shell in NT?

Setting the shell to notepad.exe seems to still bring up explorer....
ASKER CERTIFIED SOLUTION
Avatar of wamoz
wamoz

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of bcrotaz

ASKER

With a bit of tweaking for NT4, it worked!
I also found the following information. Once again there is no clear indication of what version of Windows is described, however, in this case it is at least clear that it applies to Win32. Most of the information I found on this topic applied to Win16. It appears that the sample given shuts down progman.exe and runs explorer.exe in its stead. I suppose you could try shutting down explorer.exe and running your own shell.

For god's sake don't do this to your primary development machine, you could easily toast it completely messing about with shell replacements.

Once again, excerpted from MSDN...

How to Restart the Windows Shell Programmatically
Last reviewed: October 2, 1995
Article ID: Q137572  
The information in this article applies to:
Microsoft Win32 Software Development Kit (SDK) version 4.0


SUMMARY
Creating and updating shell extensions in Windows requires that the shell be restarted. This may be accomplished by having the user manually perform this task; however, in many cases, you may find it is better to do it programmatically.



MORE INFORMATION
To restart the shell programmatically, find the shell window, post it a quit message, and then call WinExec() with explorer.exe. For Example:



   HWND hwndShell = FindWindow("Progman", NULL);
   PostMessage(hwndShell, WM_QUIT, 0, 0L);
   WinExec("Explorer.exe",SW_SHOW);

 

wamoz,

the stuff in your last comment is about shell extensions like ContextMenu shell extensions or CopyHookHandlers or PropertySheetHandlers or DragDropHandlers, not about changing the whole shell itself...
But your answer is quite well.  :-)

Regards, Madshi.