Changing Windows registry with C#
-
Hi, Dave. I tried here, but didn't get it. I use VS Community 2022 in portuguese. In my superior menu there is "Tools" and then "Create GUID". Next appears a small form with many options (1 - IMPLEMENT_OLECREATE(...) 2 - DEFINE_GUID(...) and others). Menu says I must copy and paste the chosen option in my source code. But I don't understand what I should do. Have you seen this? Can you help me? Thanks again.
Pick Registry format, click the Copy button, then you go back into the Project Properties, ..., and paste that value into the GUID box and click OK.
Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles.
Dave Kreskowiak -
Pick Registry format, click the Copy button, then you go back into the Project Properties, ..., and paste that value into the GUID box and click OK.
Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles.
Dave KreskowiakDave. For me there is no GUID box. But I'll tell yu my original problem, and maybe you can give another tip. I'll install a desktop application for a client and need to store the instalation folder somewhere. Inicially I thougt of using windows registry, but the local available was CURRENTUSER, and I didn't like it. Then I read OriginalGriff's article and thougt of a text file anywhere I can find and the ALLUSERS folder appeared to be good for me. Then these problems arouse. Do you have any suggestion? Thanks a lot.
-
Dave. For me there is no GUID box. But I'll tell yu my original problem, and maybe you can give another tip. I'll install a desktop application for a client and need to store the instalation folder somewhere. Inicially I thougt of using windows registry, but the local available was CURRENTUSER, and I didn't like it. Then I read OriginalGriff's article and thougt of a text file anywhere I can find and the ALLUSERS folder appeared to be good for me. Then these problems arouse. Do you have any suggestion? Thanks a lot.
What type of app are you writing, which version of .NET or the .NET Framework are you writing this code against, and are you exposing any components in your app to COM?
Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles.
Dave Kreskowiak -
Dave. For me there is no GUID box. But I'll tell yu my original problem, and maybe you can give another tip. I'll install a desktop application for a client and need to store the instalation folder somewhere. Inicially I thougt of using windows registry, but the local available was CURRENTUSER, and I didn't like it. Then I read OriginalGriff's article and thougt of a text file anywhere I can find and the ALLUSERS folder appeared to be good for me. Then these problems arouse. Do you have any suggestion? Thanks a lot.
-
You do not need to store that. You can get that info at runtime.
Bastard Programmer from Hell :suss: "If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
Hi, Eddy. How can I obtain the installation folder of an application? Note that I need it from another application, not the one running at this moment. Thanks.
-
What type of app are you writing, which version of .NET or the .NET Framework are you writing this code against, and are you exposing any components in your app to COM?
Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles.
Dave KreskowiakI'm writing a program to control incomes and expenses of a small company. .NET Framework version 4.8.04084. Microsoft Visual Studio Community 2022 Version 17.2.6 Is this what you wanted?
-
I'm writing a program to control incomes and expenses of a small company. .NET Framework version 4.8.04084. Microsoft Visual Studio Community 2022 Version 17.2.6 Is this what you wanted?
OK, so you're writing either a Windows Forms app, or WPF, for some accounting function. You have no reason at all to be saving anything to HKEY_LOCAL_MACHINE. Follow the advice of Griff. As for the Guid of the app, you really have no use for it so why are you interested in it?
Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles.
Dave Kreskowiak -
Hi, Eddy. How can I obtain the installation folder of an application? Note that I need it from another application, not the one running at this moment. Thanks.
And it's prolly not an application that you launched, so it is a running app that you did not launch? Does the app have a windows handle? Then you can get the executables location. https://www.autohotkey.com/boards/viewtopic.php?t=69925[^]
Bastard Programmer from Hell :suss: "If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
-
OK, so you're writing either a Windows Forms app, or WPF, for some accounting function. You have no reason at all to be saving anything to HKEY_LOCAL_MACHINE. Follow the advice of Griff. As for the Guid of the app, you really have no use for it so why are you interested in it?
Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles.
Dave KreskowiakHi, Dave. I changed my approach. Now I get a special folder path and will use it to store a text file containing the installation folder of my app. The command is:
string caminho = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData).ToString();
I think it will solve my problem. Thanks for your help and interest!
-
Hi, Dave. I changed my approach. Now I get a special folder path and will use it to store a text file containing the installation folder of my app. The command is:
string caminho = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData).ToString();
I think it will solve my problem. Thanks for your help and interest!
GetFolderPath always returns a string, so why are you calling .ToString() on a string?
Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles.
Dave Kreskowiak