|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
File Path (Application Path)(installed). I am developing an addin for a 3rd party application....... and in my addin I would like to find the location when that 3rd party application is installed, so that once I have the path I can go to specific folders in it. For Example: User 1 can have it installed in - C:\Program Files\myApps User 2 can have it installed in - D:\Program Files\myApps User 3 can have it installed in - C:\Applications\myApps FYI: No entry in the PATH settings (I did run "set" and there is no entry in the path). This addin code that I am working on is in VB.NET The installed path for each machine is correctly written in the registry...... but I have always dread of using code to read and write into registry.... Reason (and I am honest about it) I have never understood the read and write to registry code properly hence I have stay away from it. But I will take a working sample if all I have to change is couple of things in the code :-) Can someone please advice me how to do this with possibly a working sample! Thanks in advance for the help! Hi,this example opens the
registrykeyHKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Runan d then reads a value from it or writes one to it, I hope this makes it clear to you. Imports Microsoft.Win32 Dim oRegKey As RegistryKey Dim oBaseKey As RegistryKey oBaseKey = Registry.CurrentUser oRegKey = oBaseKey.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Run", True) If Not oRegKey Is Nothing Then 'Read the value Dim val As Object = oRegKey.GetValue("YourValueName") msgbox(CStr(val)) 'Set the value oRegKey.SetValue("YourValueName", "your path") End If Show quoteHide quote hth Peter"Cor Ligthert" <notmyfirstn***@planet.nl> schreef in bericht news:O$M4ylMQFHA.3760@TK2MSFTNGP10.phx.gbl... > LCD, > > Application.startuppath > > I hope this helps, > > Cor > > Peter,
What if "YourValueName" = (default) Software\myApp\myApp\HomeDir and in that you have the (default) - C:\........ I tried putting (default), just default of "YourValueName" and it doesn't seem to work. Please advice. Show quoteHide quote "Peter Proost" wrote: > Hi,this example opens the > registrykeyHKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Runan > d then reads a value from it or writes one to it, I hope this makes it clear > to you. > Imports Microsoft.Win32 > > Dim oRegKey As RegistryKey > Dim oBaseKey As RegistryKey > > oBaseKey = Registry.CurrentUser > oRegKey = > oBaseKey.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Run", True) > > If Not oRegKey Is Nothing Then > 'Read the value > Dim val As Object = oRegKey.GetValue("YourValueName") > msgbox(CStr(val)) > > 'Set the value > oRegKey.SetValue("YourValueName", "your path") > End If > > hth Peter"Cor Ligthert" <notmyfirstn***@planet.nl> schreef in bericht > news:O$M4ylMQFHA.3760@TK2MSFTNGP10.phx.gbl... > > LCD, > > > > Application.startuppath > > > > I hope this helps, > > > > Cor > > > > > > > Did you put it between "", I can't realy test anything fo the moment cause
I'm not at work and I haven't got vb.net on this pc. So if you haven't got an answer from someone else by monday, I'll test it at work why it doesn't work. Greetz Peter Show quoteHide quote "LCD" <L**@discussions.microsoft.com> schreef in bericht registrykeyHKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Runannews:F46DC993-891E-4FD3-9B2F-ECD4BDF43081@microsoft.com... > Peter, > > What if "YourValueName" = (default) > > Software\myApp\myApp\HomeDir and in that you have the (default) - C:\........ > > I tried putting (default), just default of "YourValueName" and it doesn't > seem to work. Please advice. > > > > "Peter Proost" wrote: > > > Hi,this example opens the > > Show quoteHide quote > > d then reads a value from it or writes one to it, I hope this makes it clear > > to you. > > Imports Microsoft.Win32 > > > > Dim oRegKey As RegistryKey > > Dim oBaseKey As RegistryKey > > > > oBaseKey = Registry.CurrentUser > > oRegKey = > > oBaseKey.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Run", True) > > > > If Not oRegKey Is Nothing Then > > 'Read the value > > Dim val As Object = oRegKey.GetValue("YourValueName") > > msgbox(CStr(val)) > > > > 'Set the value > > oRegKey.SetValue("YourValueName", "your path") > > End If > > > > hth Peter"Cor Ligthert" <notmyfirstn***@planet.nl> schreef in bericht > > news:O$M4ylMQFHA.3760@TK2MSFTNGP10.phx.gbl... > > > LCD, > > > > > > Application.startuppath > > > > > > I hope this helps, > > > > > > Cor > > > > > > > > > > > >
Show quote
Hide quote
"LCD" <L**@discussions.microsoft.com> schrieb: \\\> How can I find the path as to where a specific application is loaded > (installed). I am developing an addin for a 3rd party application....... > and > in my addin I would like to find the location when that 3rd party > application > is installed, so that once I have the path I can go to specific folders in > it. > > For Example: > User 1 can have it installed in - C:\Program Files\myApps > User 2 can have it installed in - D:\Program Files\myApps > User 3 can have it installed in - C:\Applications\myApps > > FYI: No entry in the PATH settings (I did run "set" and there is no entry > in the path). This addin code that I am working on is in VB.NET Imports System.IO Imports System.Reflection .. .. .. Private Function ApplicationPath() As String Return _ Path.GetDirectoryName([Assembly].GetEntryAssembly().Location) End Function /// -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/>
Only 2 Days left to get REALbasic 5.5 for FREE!
Execption Handling disection Dependency Error: The dependency <dll> in project <project> cannot be coppied to the run directory b Data Relation question enum item from string Conversion from VB6 to VB.NET Architectural Question Re: THE GREATEST NEWS EVER! °º·._._.·º°`°º·._._.·º°`°º·._._.·º°`°º·._._.·º°`°º·._._.·º°`°º·._._.·º°` No one Find Directory created by me... run file remotely Stepping into a referenced assembly |
|||||||||||||||||||||||