i have replaced windows shell with my application it worked perfectly, after closing my application i have to launch windows explorer with the following piece of code
Code to start explorer
Process.Start(#"c:\windows\explorer.exe");
Registry key i have used to replace shell
HKEY_Local_Machine\Software\Microsoft\WindowsNT\CurrentVersion\WinLogon\Shell
it doesnt show taskbar and start menu, it just shows mydocuments folder. I need start menu and taskbar while after explorer started
My guess is that since explorer isn't defined as the shell, it won't run as the shell. I think that you'd have to change the registry settings to make explorer the shell again before you run it.
So, as you wrote you replaced the shell in the registry with your own version. So it's up to you to show a start menu, etc. If you like to start a explorer and let it act as a shell, go on and replace the entry in the registry with the old one.
Due to the fact, that you like to be the shell again, next time windows starts, maybe the following trick will do it:
Prerequisities:
Place your program in registry as shell and start windows
Your program runs and wants to start explorer as shell
Action to to:
Replace entry in registry against entry containing explorer as shell
Start the explorer
Replace entry in registry back to your app as shell programm
Wait till next boot...
You will probably have to kill the existing shell process (i.e. your app) before starting explorer again.
Related
I stumbled upon a problem with which I need some help!
When a process is executed from within a Windows application that runs directly, the call to Process.Start opens up the webpage to the default browser.
But when the same Windows application is run through a Setup Project, Process.Start does not open the URL.
You can download the VS solution from here:
https://pxstorage.blob.core.windows.net/pub/TestSetup.zip
Unfortunately, due to the nature of the problem, it was meaningless to append code snippets.
To replicate the issue:
Build the solution
Expected behavior: Run the SetupHelper project and click the Button, and you should see your default browser opening the URL.
Unexpected behavior: Right-click the TestSetup project, click Install and follow the steps. After a popup message, the SetupHelper window will show up, but by clicking the Button, the URL does not open.
Any help would be much appreciated!
Remarks:
I run it as Administrator.
I already use UseShellExecute = true
The problem is that when the Windows application is run from a Setup Project, the Process.Start method does not open the URL.
One possible solution would be to use the Process.StartInfo.UseShellExecute property and set it to true. This will cause the process to be started using the ShellExecute method instead of the CreateProcess method.
Process.StartInfo.UseShellExecute = true;
Process.Start("http://www.google.com");
I know how to tell the registy to run my app on startup.
There are a lot of threads about it.
I used this one:
How do I set a program to launch at startup.
The problem I face is:
I give the user the option to disable/enable this option
when the user uninstall,
there is a key left in the registry that tells the app to run (although the app was already uninstalled)
I know I can handle it by a shortcut in the startup folder, but I tried it already and I have problem with it too.
Thanks
Eli
To remove the entry in the registry you should instruct your installation program to remove the registry value.
If you are using the build in installation project in VS you could do that by implementing the Uninstall event.
If it is a click once installation you just have to ignore it.
Simple solution without using Custom Actions
I just added a registry Key by the Registry editor until I got to the Run folder and added to it the value "name of my app" (on the right panel) and I didn't wrote a path just left it ""
I played with the checkbox (add key, delete key)
and even though I left it with the key. when I uninstalled it was gone.
I'm writing a small program to fix compatibility issues with a 16-bit program. This fix is to close explorer.exe, as explorer overrides some of the palettes in the program. Afterwards, we reopen explorer.
When using a .bat file, it works:
#ECHO OFF
taskkill /f /IM explorer.exe
EmStraditionX.exe
start /B explorer.exe
This method isn't ideal, as it requires extra files to download. For the sakes of simplicity, assume that it is impossible for me to distribute more than the C# compatibility program.
My first thought was to just Process.Start("explorer.exe"), but this did not work, and instead just opened the 'Libraries' folder in an explorer window, without making the taskbar visible again.
I then tried to use the same command as the batch file, except like this: Process.Start("cmd.exe", "/C start /B explorer.exe"), which again did not work.
Does anyone know how I can reopen the taskbar from C#?
Thanks,
Ruirize.
Use:
Process.Start(Environment.SystemDirectory + "\\..\\explorer.exe");
Putting the full path will make it work
Martyn
Do you use also "Run As Administrator" function in compatibility options?
If you do - you will start explorer from another session and you cant see window,that is running in other (administrator) session.
i created a small tool in windows application using (.net language C#).
i created setup for my tool and also when we click on minimize button it will be in system tray. My requirement is i want to place my tool in start up (start>All Programs>Start up)
when i start my system automatically my tool is open this is my requirement please help me thank you.
go to solution explorer and select the setup folder what u created select any file (project setup) and u can see the two splited windows one is Files system on Target Machine right click on empty space
u can get 'add special folder >> user's startup Folder' and u can get a folder then right click and add project output thats all.
Just put the EXE you want to run to the correct startup folder. Username is the logged on user. Run cmd, then type echo %username% to find your username.
Windows Vista
c:\Users\[username]\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
Windows XP/2000
c:\Documents and Settings\[username]\Start Menu\Programs\Startup
Windows NT 4
c:\Winnt\Profiles\[username]\Start Menu\Programs\Startup
Windows 95/98/ME
c:\WINDOWS\Start Menu\Programs\Startup
The cleaner way is to copy the exe to the following location
Environment.GetFolderPath(System.Environment.SpecialFolder.Startup)
The only reason I recommend using this Method instead of hardcoding the value , is because the paths can change and trying to pre-empt ever every users move is a waste of time.Should just mention that the method above still returns the same folders as the first answer
Is it possible to find out whether your current .Net app has been launched using a shortcut or a Clickonce application reference (*.appref-ms) file? If so, how?
Some background: I am running into an issue using Microsoft Clickonce in which I cannot pass command line arguments to the application. It seems that this is the way the technology works by design. I was exploring different ways of passing this parameter; one of them was to have a set of different Clickonce Start Menu shortcuts.
Try testing out the ApplicationDeployment.IsNetworkDeployed property. I know this will be true if it is a ClickOnce app but I'm not sure if it will be false in your situation.
I'm not sure what an "application reference file" is; do you mean like double-clicking the EXE file in Explorer or running the file from a command line?
There isn't any a priori way to detect how your program was started. The usual workaround is to configure the shortcut file to pass a parameter on the command line. Then, check for the existence of that parameter at run time. If you find it there, assume the program was started from a shortcut. The key to this approach is the fact that you can't include a parameter when double-clicking the EXE file in Explorer, so if you find a command-line parameter, you know the program wasn't started that way.