Set Process 'image name' and 'description' wtih C# - c#

I want to go into as much detail as possible so this question is easily understood and answer-able
Essentially I need a way set up the process name and process description with C# on the applications startup.
Here is an example of what I would like changing;
Note: I want to set my OWN C# applications image and description with CODE.
I want to be able to change the following things in my application on startup.
Image Name in the Processes list, as well as the Description in the Processes list.
So far in my C# application i can set the process name with the properties but id rather be able to set it with some sort of code snippet (as well as the description).
I hope this has been a information question and you good clever people at stackoverflow can help.

You can't change the image name. It's the name of your executable file.
The process description, however, can be changed on your C# project assembly info:
Right click on your C# project in Visual Studio > Properties > Application > Assembly information > Title.
You can't change the description at runtime from code: the OS loads the description at startup from the Version Information file resource.

The Image Name property is the name of the executable itself (ie Foobar.exe), the Description property is the Title of the application in the Assembly Information dialogue box, as shown below:
At this point, when you run your program, you will see two entries into the task manager as shown below:
One will say the name you specified in the Title box, the other will say vshost32.exe as the description. To fix this, untick the option called Enable the Visual Studio hosting process in the project properties page.

As close as I can come to an answer is to pragmatically create a new executable with the desired name and description launch that executable then allow your launch process to die.

Try using your application as a 'host' for another app.
As soon as the application is launched, it downloads a file from a dropbox link (a direct download link) and saves it locally, (In the temp folder probably).
Then our application launches that application and then kills itself with maybe an error.
now the process running on that one would be gone, and we have a new process with our set title and description. Easy!

Related

C# : capturing the file and path of a file when right I right click on the file

I am developing a windows application with c#. I need to get the file and folder name when I right click on a file to use for other functions. Right now I have made the registry keys to get my application running.
When I right click on a file (word, ppt, txt, etc) my context menu shows the option I added, Set Perm/ When that is selected my windows application opens up. In a text box on the form, I want to display the full file name and path of the file the user clicked on. Is there a way to do that?
I've added %0 and %1 in the registry to then end of the arguument to launch my app, but it does not work. I've tried h:\temp\myapp.exe %1 and h:\temp\myapp.exe %0. Putting the %1 or %0 in quotes did not change anything.
I am in Windows 8 using Visual Studio 2017. Searching brought me to this question, but it has not answered my problem yet.
if I understand what you're asking,
to have the path passed in the register,
void Main(string[] args)
the Path class has some useful methods to get to the folder and the string of a string
Path.GetFullPath("the path")
sometimes path is args[0](when you drag the file on icon), but in your case you have to iuse args[1].
I hope I understand what you're asking for
Thanks for the help. The question referenced earlier did provide the answer. I was having issues with the form I was using. After working it with for a while I must have really messed it up. I created a new form and used it, using the code provided in that post i referenced.

Getting the short cut name

I have one program, the exe is called main.exe. when main.exe is excuted. I allowed the user to be able to create a shortcut off main.exe. But when the user can create any name for the shortcut. so if the user is selecting the shortcut. I need the name of this short cut. not the program its pointing to
You can't getting the shortcut name from running exe. Application does not receive information about shortcut used to launch it.
You can use command line arguments and/or current working directory to configure your application (both can be set via properties of a shortcut).

I would like to get list of installed programs as shown in Add/Remove Programs of the control panel

I would like to get list of installed programs as shown in Add/Remove Programs of the control panel using C sharp
I know using SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall (32bit) or SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall (64bit) can get program names but how to get its exe file name?
Example MS Word is the program name which the above mentioned registers help me to get but its application file is winword.exe. I need to get this information so that I can start those applications through the code
Edited:
I need to to get the list of installed programs along with their exe information so that when user selects that program name from my application I should be able to trigger that application
Windows Add/Remove does not contain that kind of information.
Let's take Office as an example, you install a whole package, having excel.exe, winword.exe among others.
What you could do, is cross that information with the one available from the Start Menu, where most of the shortcuts are.
Most people don't delete the Start Menu shortcuts, so maybe it is an option.
Another one, would be to read the installation folder and filter out every .exe
Check this for executing lnk: c# memory usage for starting lnk shortcuts

"GodMode" folder contents c#

I am currently building an application that will need to use all of the Control Panel's shortcuts which can be found in "shell:::{ED7BA470-8E54-465E-825C-99712043E01C}" aka GodMode folder.
However, when I try to access the folder through code, I get no result. This also happens when I try to enumerate the files using the command prompt (using 'dir').
Any help is appreciated.
Thanks
The God Mode is implemented in the Windows Explorer Shell. If you look at it at the file system level it's just an ordinary folder with a peculiar name. That's why you won't see anything special in it when reading it as a directory in code. If you look at it with the command prompt it's the same - just a plain empty folder with a peculiar name.
You won't be able to access the shortcuts through the file system API, so you have to look for an API that exposes the control panel contents instead.

start .net application from start menu search

bla.exe (application alias) points to a .net application called wpfapp1.exe.
When i add a key&value to eg. this key:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\bla.exe
and then start application using Run -> bla.exe it starts
however when i start application using windows search i get an "windows cannot find wpfapp1.exe. make sure you typed the name correctly, and then try again."
I have successfully identified problem: this error only occurs to .net applications while native one start normally (eg. firefox.exe).
So is there any .net config that i've missed during development?
From MSDN:
The App Paths key is not used when
computing the DLL search path.
Maybe you're missing some dependent DLL...
I don't really understand your "points to" or if Windows search is specific to using the explorer search or using the start menu search.
I've had a similar problem with another application that the search could not find at all, neither in Explorer or Start menu (since it did not have an indexed folder to locate it) and solved it with a simple shortcut.
If you can create a shortcut of your application in your start menu or some other indexed folder, like a %PATH% folder, Windows search should be able to pick it up and then you can name your shortcut to whatever you want, for instance bla.exe.

Categories