Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 376
  • Last Modified:

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.
0
bcrotaz
Asked:
bcrotaz
  • 2
  • 2
  • 2
1 Solution
 
MadshiCommented:
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
 
bcrotazAuthor Commented:
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
 
wamozCommented:
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
bcrotazAuthor Commented:
With a bit of tweaking for NT4, it worked!
0
 
wamozCommented:
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
 
MadshiCommented:
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

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

  • 2
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now