472,371 Members | 1,607 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,371 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 1072
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...
2
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and efficiency. While initially associated with cryptocurrencies...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and credentials and received a successful connection...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...
1
by: Johno34 | last post by:
I have this click event on my form. It speaks to a Datasheet Subform Private Sub Command260_Click() Dim r As DAO.Recordset Set r = Form_frmABCD.Form.RecordsetClone r.MoveFirst Do If...
0
by: jack2019x | last post by:
hello, Is there code or static lib for hook swapchain present? I wanna hook dxgi swapchain present for dx11 and dx9.

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.