?
Solved

Turn an exe into a shell

Posted on 1998-09-21
6
Medium Priority
?
374 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
6 Comments
 
LVL 20

Expert Comment

by:Madshi
ID: 1340462
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
ID: 1340463
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 400 total points
ID: 1340464
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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 1

Author Comment

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

Expert Comment

by:wamoz
ID: 1340466
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
ID: 1340467
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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

801 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