MSFN Forum: Launch and EXE from VB - MSFN Forum

Jump to content



Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Launch and EXE from VB Not quite as easy as first thought Rate Topic: -----

#1 User is offline   mongee 

  • Group: Members
  • Posts: 3
  • Joined: 01-June 05

Posted 01 June 2005 - 01:51 AM

I am trying to launch an exe, without using the ShellAPI to do it. I have tried in both Delphi and VB but have been unsuccessful.

Basically we are trying to write a program which will load as the shell, then when complete hand over control of the shell to explorer.exe. When I try to fire up explorer.exe using the shell api:
Shell ("c:\windows\explorer.exe")

all that happens is that the explorer file manager opens, not the full shell.

I know that it can be done, as there is a simpl little program called shellselect (available here.

has me pretty stumped, all I know is that I am pretty sure I can't call it with the ShellAPI function.


#2 User is offline   Carl_Maddox 

  • Group: Members
  • Posts: 3
  • Joined: 31-May 05

Posted 01 June 2005 - 06:08 AM

Are you trying to make explorer the activate window. If so does this work for VB :

GetApp = Shell("c:\windows\explorer.exe", 1)

Cheers,
Carl :thumbup

#3 User is offline   mongee 

  • Group: Members
  • Posts: 3
  • Joined: 01-June 05

Posted 01 June 2005 - 07:54 PM

In a way yes, I am trying to make explorer run as the shell, instead of an application as it seems to.

When I use the shell method it simply runs the file manager explorer and nothing else. At the moment I am toying around with the CreateProcess function, as I have a suspicion that this might be a bit more successful for me.

If anyone has seen or has a copy of the source code for shellsel.exe (in the first post) that would be great, would show me what I am doing wrong :)

#4 User is offline   mongee 

  • Group: Members
  • Posts: 3
  • Joined: 01-June 05

Posted 01 June 2005 - 09:32 PM

OK, I have a solution, and for our situation it is a lot nicer.

Basically what we have done is instead of setting our application as the shell we have changed the registry key:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon
Userinit reg_sz c:\windows\system32\userinit.exe

to
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon
Userinit reg_sz c:\ourapplication.exe

then in "ourapplication.exe" instead of launching explorer.exe when we are finished we launch c:\windows\userinit.exe
Shell ("c:\windows\system32\userinit.exe")

and it starts up windows as it normally would.

This way we can start our application before explorer.exe (our shell) and if the process is ended it will not load explorer.

Thanks for your help carl_maddox, it got me thinking about different ways of doing it :)

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users



All trademarks mentioned on this page are the property of their respective owners
Copyright © 2001 - 2011 msfn.org
Privacy Policy