Solved

Turn an exe into a shell

Posted on 1998-09-21
6
368 Views
Last Modified: 2010-04-06
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.
0
Comment
Question by:bcrotaz
  • 2
  • 2
  • 2
6 Comments
 
LVL 20

Expert Comment

by:Madshi
Comment Utility
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.
0
 
LVL 1

Author Comment

by:bcrotaz
Comment Utility
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....
0
 
LVL 1

Accepted Solution

by:
wamoz earned 200 total points
Comment Utility
According to MSDN, you can indeed replace the shell on Windows NT. Note from the references to Program Manager that this information was written with reference to WinNT 3.x

Excerpted from MSDN:

Replacing the Shell (Program Manager)
Last reviewed: November 2, 1995
Article ID: Q100328  
The information in this article applies to:
Microsoft Win32 Application Programming Interface (API) included with:


    - Microsoft Windows NT versions 3.1, 3.5, and 3.51



SUMMARY
To replace the current shell, change the following registry key:


   HKEY_LOCAL_MACHINE\
      SOFTWARE\
      Microsoft\
      Windows NT\
      CurrentVersion\
      Winlogon\
      Shell

Note that Program Manager combines the functionality of Program Manager and Task Manager (the Task Manager installed is not actually run). Therefore, you must take this into account. In Windows NT 3.1, if the new shell does not replace the Task Manager functionality, the replacement string should contain both the new shell name and TASKMAN.EXE, separated by commas. In Windows NT 3.5, the new shell should either spawn TASKMAN.EXE or your own task manager, specified in

   HKEY_LOCAL_MACHINE\
      SOFTWARE\
      Microsoft\
      Windows NT\
      CurrentVersion\
      Winlogon\
      Taskman

The value does not exist by default, it must be added. The value type is REG_SZ.
To update the string that is retrieved when you call GetPrivateProfileString(), change the string in the following registry key:


   HKEY_LOCAL_MACHINE\
      SOFTWARE\
      MICROSOFT\
      Windows NT\
      Current Version\
      WOW\
      Boot\
      Shell

The duplicate entry is for compatibility with Windows 3.1.  

0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 1

Author Comment

by:bcrotaz
Comment Utility
With a bit of tweaking for NT4, it worked!
0
 
LVL 1

Expert Comment

by:wamoz
Comment Utility
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);

 

0
 
LVL 20

Expert Comment

by:Madshi
Comment Utility
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.
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now