473,323 Members | 1,560 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,323 software developers and data experts.

Filename from Open With

I'm building a small app that is launched by right-clicking on an XML file
and choosing "Open With...". Ugly, I know, but I can't associate .xml with
my app. Anyway, once the app is launched, how can I get the full path to the
XML file that was opened?
Aug 14 '06 #1
3 1125
I believe using Open With passes as a parameter to the opening application
the full path and filename of the document to be opened. Once you grab the
file parameter as a switch from My.Application.CommandLineArgs. Once you
have the string, use System.IO.Path.GetFullPath to retrieve only the path
portion.

Jim Wooley
http://devauthority.com/blogs/jwooley/default.aspx
I'm building a small app that is launched by right-clicking on an XML
file and choosing "Open With...". Ugly, I know, but I can't associate
.xml with my app. Anyway, once the app is launched, how can I get the
full path to the XML file that was opened?

Aug 14 '06 #2
Hello smay,

What Open with... does is... Pass the file name you have clicked as a commandline
argument to your application. So what you should be looking for is how to
read the commandline arguments from your application.

I think in .Net + VB, this can be done pretty easily.

System.Environment.GetCommandLineArgs()

I think that should do the trick... but I am writing from memory, and I could
be wrong. Let me know if you get anywhere

Regards
Cyril Gupta

You can do anything with a little bit of 'magination.
I'm building a small app that is launched by right-clicking on an XML
file and choosing "Open With...". Ugly, I know, but I can't associate
.xml with my app. Anyway, once the app is launched, how can I get the
full path to the XML file that was opened?

Aug 14 '06 #3
You are right. The full path and file name are passed as the first and only
arg. Thanks very much!

"Jim Wooley" wrote:
I believe using Open With passes as a parameter to the opening application
the full path and filename of the document to be opened. Once you grab the
file parameter as a switch from My.Application.CommandLineArgs. Once you
have the string, use System.IO.Path.GetFullPath to retrieve only the path
portion.

Jim Wooley
http://devauthority.com/blogs/jwooley/default.aspx
I'm building a small app that is launched by right-clicking on an XML
file and choosing "Open With...". Ugly, I know, but I can't associate
.xml with my app. Anyway, once the app is launched, how can I get the
full path to the XML file that was opened?


Aug 14 '06 #4

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

Similar topics

7
by: Kornelius Finkenbein | last post by:
Hello folks! I've got a strange problem with my download-script in conjunction with M$ internet explorer, if the filename I want to link to includes more than one points. In Netscape the problem...
2
by: Nemesis | last post by:
In the python docs about shelve module I read: ----------------------------------------------------------------------------- open( filename]]]) Open a persistent dictionary. The filename...
1
by: Sameh Abdelatef | last post by:
Dear perl experts, I used to use to open and add new lines to $filename, but it didn't work any more. The perl version is 5.8.1. When I try it's work but the content of $filename is deletd....
5
by: cpp | last post by:
When I create an instance of ofstream, what is the name of the member variable that holds the filename? For example: ofstream ofs("Output.txt"); cout << ofs.WhatIsThePathVariable; If there...
10
by: sam | last post by:
Hi, Can anyone tell me how to print a file name from ifstream? the following cout code does not print the filename I created with ifstream preivous: ifstream is; is.open ("text.txt");
3
by: zweng | last post by:
I checked a few sites on exporting data from asp.net to excel and most of them point to the same source a http://support.microsoft.com/default.aspx?scid=kb;EN-US;317719 with some modifications My...
7
by: pedagani | last post by:
Dear comp.lang.c++, I'm trying to read a file with very long filename using ifstream. Although, the file exists the file open for read fails. Is there a restriction on the size? I'm using winXP...
0
by: Ofelia | last post by:
Hi, I'm new to this forum and to Perl language but I would like to ask for your help. I'm working in Linux and the files I need to process are in the format “file.gz”. I created a script which...
0
by: Darqer | last post by:
Hello There is a possibility to show DownloadFile form in web browser using following peace of code HttpContext context = HttpContext.Current; context.Response.ContentType =...
3
beacon
by: beacon | last post by:
Hi, I'm doing a homework assignment, but I have done most of the work and am only looking for some tutoring to get past this small portion of the program I have been tasked to write. The...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.