473,947 Members | 18,894 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Q: Getting a directory

Hiya

I have written a small application which I've then generated a setup project
to install the application on other computers.

How can I determine, from the application, where the program has been
installed to?

Thanks in advance

Geoff
Nov 21 '05 #1
11 1162
Application.Sta rtupPath()

Chris

"Geoff Jones" <no********@ema il.com> wrote in message
news:42******** **************@ news.dial.pipex .com...
Hiya

I have written a small application which I've then generated a setup
project to install the application on other computers.

How can I determine, from the application, where the program has been
installed to?

Thanks in advance

Geoff

Nov 21 '05 #2
Geoff,

"Geoff Jones" <no********@ema il.com> schrieb:
How can I determine, from the application, where the program has been
installed to?


'Application.St artupPath' (for Windows Forms applications). For libraries,
console applications, etc. (ignore the text and take a look at the code):

<URL:http://dotnet.mvps.org/dotnet/code/application/#ApplicationPat h>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #3
Hi Herfried

Thanks for the suggestion. It isn't exactly what I want; although I didn't
make myself very clear.

Using the Deployment project, the application is stored in a directory
called, for example, ABC Ltd, which is the "Manufactur er" producing the
software. What I'd like to do is to find, within the application, the path
to this folder.

I guess this is done using the registry etc. but I'm unsure how to proceed.

Can you be of any further help?

Geoff

"Herfried K. Wagner [MVP]" <hi************ ***@gmx.at> wrote in message
news:uM******** ******@TK2MSFTN GP15.phx.gbl...
Geoff,

"Geoff Jones" <no********@ema il.com> schrieb:
How can I determine, from the application, where the program has been
installed to?


'Application.St artupPath' (for Windows Forms applications). For
libraries, console applications, etc. (ignore the text and take a look at
the code):

<URL:http://dotnet.mvps.org/dotnet/code/application/#ApplicationPat h>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #4
Geoff,

"Geoff Jones" <no********@ema il.com> schrieb:
Using the Deployment project, the application is stored in a directory
called, for example, ABC Ltd, which is the "Manufactur er" producing the
software. What I'd like to do is to find, within the application, the path
to this folder.


Typically, the executable is installed into this directory.

You can use a WMI query ('System.Manage ment') with the 'Win32_Product' class
and check its 'InstallLocatio n' property:

Platform SDK: Windows Management Instrumentation -- 'Win32_Product'
<URL:http://msdn.microsoft. com/library/en-us/wmisdk/wmi/win32_product.a sp>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #5
Geoff,
I would use 'Application.St artupPath' as that is the path where the
executable is, it normally will be the path where it is installed to, unless
the user manually copies or moves the exe.

I would use System.IO.Path to get the individual parts of the StartupPath...

In addition to a WMI query to find the folder where it was installed, you
could have the Setup Project create a registry key that contains the path
where the app was installed to.

Hope this helps
Jay
"Geoff Jones" <no********@ema il.com> wrote in message
news:42******** *************@n ews.dial.pipex. com...
Hi Herfried

Thanks for the suggestion. It isn't exactly what I want; although I didn't
make myself very clear.

Using the Deployment project, the application is stored in a directory
called, for example, ABC Ltd, which is the "Manufactur er" producing the
software. What I'd like to do is to find, within the application, the path
to this folder.

I guess this is done using the registry etc. but I'm unsure how to
proceed.

Can you be of any further help?

Geoff

"Herfried K. Wagner [MVP]" <hi************ ***@gmx.at> wrote in message
news:uM******** ******@TK2MSFTN GP15.phx.gbl...
Geoff,

"Geoff Jones" <no********@ema il.com> schrieb:
How can I determine, from the application, where the program has been
installed to?


'Application.St artupPath' (for Windows Forms applications). For
libraries, console applications, etc. (ignore the text and take a look at
the code):

<URL:http://dotnet.mvps.org/dotnet/code/application/#ApplicationPat h>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>


Nov 21 '05 #6
Hi Jay

I'm interested further in your last point. I had a look at the deployment
project and couldn't see any options to writing to the registry. Just to
clarify, I am using the inbuilt deployment project in Visual Studio.

Could you help further?

Geoff

"Jay B. Harlow [MVP - Outlook]" <Ja************ @msn.com> wrote in message
news:u2******** *******@TK2MSFT NGP15.phx.gbl.. .
Geoff,
I would use 'Application.St artupPath' as that is the path where the
executable is, it normally will be the path where it is installed to,
unless the user manually copies or moves the exe.

I would use System.IO.Path to get the individual parts of the
StartupPath...

In addition to a WMI query to find the folder where it was installed, you
could have the Setup Project create a registry key that contains the path
where the app was installed to.

Hope this helps
Jay
"Geoff Jones" <no********@ema il.com> wrote in message
news:42******** *************@n ews.dial.pipex. com...
Hi Herfried

Thanks for the suggestion. It isn't exactly what I want; although I
didn't make myself very clear.

Using the Deployment project, the application is stored in a directory
called, for example, ABC Ltd, which is the "Manufactur er" producing the
software. What I'd like to do is to find, within the application, the
path to this folder.

I guess this is done using the registry etc. but I'm unsure how to
proceed.

Can you be of any further help?

Geoff

"Herfried K. Wagner [MVP]" <hi************ ***@gmx.at> wrote in message
news:uM******** ******@TK2MSFTN GP15.phx.gbl...
Geoff,

"Geoff Jones" <no********@ema il.com> schrieb:
How can I determine, from the application, where the program has been
installed to?

'Application.St artupPath' (for Windows Forms applications). For
libraries, console applications, etc. (ignore the text and take a look
at the code):

<URL:http://dotnet.mvps.org/dotnet/code/application/#ApplicationPat h>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>



Nov 21 '05 #7
Thanks Herfried

"Herfried K. Wagner [MVP]" <hi************ ***@gmx.at> wrote in message
news:Oj******** ******@TK2MSFTN GP14.phx.gbl...
Geoff,

"Geoff Jones" <no********@ema il.com> schrieb:
Using the Deployment project, the application is stored in a directory
called, for example, ABC Ltd, which is the "Manufactur er" producing the
software. What I'd like to do is to find, within the application, the
path to this folder.


Typically, the executable is installed into this directory.

You can use a WMI query ('System.Manage ment') with the 'Win32_Product'
class and check its 'InstallLocatio n' property:

Platform SDK: Windows Management Instrumentation -- 'Win32_Product'
<URL:http://msdn.microsoft. com/library/en-us/wmisdk/wmi/win32_product.a sp>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #8
Geoff,

All about the stephchild Deployment and Setup project seems to be hidden you
would expect it under Edit however it is.

When you have opened a setup project

View -> Editor ->Registry

I hope this helps?

Cor
Nov 21 '05 #9
Thanks Cor. That makes a lot more sense now.

K

"Cor Ligthert" <no************ @planet.nl> wrote in message
news:uh******** ******@TK2MSFTN GP10.phx.gbl...
Geoff,

All about the stephchild Deployment and Setup project seems to be hidden
you would expect it under Edit however it is.

When you have opened a setup project

View -> Editor ->Registry

I hope this helps?

Cor

Nov 21 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
3654
by: Kali K E | last post by:
Hi, I could not understand how I can do the following things in Python. Please help me. 1. First I have to find the current directory from where the script is invoked. 2. Next I have to form a directory structure there. If the current directory in step 1 is /home/mylogin, then from there I have to build a directory structure like /home/mylogin/result
8
829
by: Opa | last post by:
Hi, Does anyone know how to get a list of files for a given directory from a given url. I have the following, but get an error indicating that URI formats are not supported. System.IO.DirectoryInfo di di = new System.IO.DirectoryInfo("http://www.websitehere.com/files/"); System.IO.FileInfo rgFiles = di.GetFiles("*.jpg");
6
1720
by: Binoy | last post by:
Hello, I am getting this error once in a while from my web sites. When I will refresh web browser, it goes off and sites are working fine. Directory structures and file names are as below- C:\WWW - corporate site, C:\WWW\default.aspx is the default page and this site works fine.
2
2133
by: David Hearn | last post by:
Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. SQLExpress database file auto-creation error: The connection string specifies a local SQL Server Express instance using a...
0
3724
by: ruju00 | last post by:
I am getting an error in Login() method of the following class FtpConnection public class FtpConnection { public class FtpException : Exception { public FtpException(string message) : base(message){} public FtpException(string message, Exception innerException) : base(message,innerException){}
8
6321
by: lawrence k | last post by:
I've installed Apache 1.3.36 on my Redhat EL 3 machine. Now I'm trying to install PHP 5.1.4. I can not get the ./configure command to work. I keep getting this error: configure: error: Invalid Apache directory - unable to find httpd.h under /usr/local/apache/include So then I run this command: find / -name httpd.h
4
4791
by: herc | last post by:
My objective is to get the "label" information for the different volumes that are mounted. I want to display the same information as Windows Explorer. I wrote this test code with gets me the drive letter, but the label is always blank. Any thoughts? DriveInfo drives = DriveInfo.GetDrives(); foreach (DriveInfo di in drives) { Console.WriteLine("----------------------");
5
13234
by: Michael Howes | last post by:
I'm writing a utility to manage a machines *local* accounts in c# I am getting all the users in a specific Group just fine but when I want to get some of the information on each user from their Properties collection I can't get the properties on some users. For example, I get all the users that are part of my machines Administrators Group. I get get the properties of the built in local Administrator account and some local IT account,...
13
2834
by: lawpoop | last post by:
Hello all - I have a two part question. First of all, I have a website under /home/user/www/. The index.php and all the other website pages are under /home/user/www/. For functions that are used in multiple files, I have php files under / home/user/www/functions/. These files simply have So, in index.php and other files, I have
3
14739
lifeisgreat20009
by: lifeisgreat20009 | last post by:
I am getting the following error :- 1>------ Build started: Project: Polygon Drawer, Configuration: Debug Win32 ------ 1>Compiling... 1>Dialog.cpp 1>g:\my subjects\3rd semester\project samples for 3rd semester\visual c++ project samples\polygon drawer\dialog.h(4) : fatal error C1083: Cannot open include file: 'afxwin.h': No such file or directory 1>DrawerApp.cpp
0
10164
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
11173
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10694
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
8256
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7431
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
6118
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4948
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4540
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3544
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.