473,396 Members | 1,866 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,396 software developers and data experts.

How to get full pathnames with startup arguments?

In my WinForms app I'm retrieving the command line arguments with this
standard code: static void Main(string[] args)

Here's the problem. I've now associated my app with a particular extension;
let's call it ".abc". This way if a user is using Windows Explorer they can
double-click on a ".abc" data file and my app will be automatically started.
This works fine except for one thing.

Let's say the datafile is called "Big Tree.abc". Instead of this full
filename being passed to my app, I get "big~1.abc" instead.

What do I have to do to retrieve the full filename?

--
Robert W.
Vancouver, BC
www.mwtech.com

May 21 '06 #1
3 2174
Robert,

Mind, you, unless you are displaying the name of the file, there isn't a
reason to convert it, since it will just work in any functions that you need
it to.

If you want to get the full name, call the GetLongPathName through the
P/Invoke layer.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Robert W." <Ro*****@discussions.microsoft.com> wrote in message
news:F6**********************************@microsof t.com...
In my WinForms app I'm retrieving the command line arguments with this
standard code: static void Main(string[] args)

Here's the problem. I've now associated my app with a particular
extension;
let's call it ".abc". This way if a user is using Windows Explorer they
can
double-click on a ".abc" data file and my app will be automatically
started.
This works fine except for one thing.

Let's say the datafile is called "Big Tree.abc". Instead of this full
filename being passed to my app, I get "big~1.abc" instead.

What do I have to do to retrieve the full filename?

--
Robert W.
Vancouver, BC
www.mwtech.com

May 21 '06 #2
Nicholas,

Yes, it has to do with displaying the full filename in the title bar, as
well as the aesthetics of using Save As.

After much more research I found this excellent article:
http://www.c-sharpcorner.com/UploadF...d-8d2348b8c6d2
--
Robert W.
Vancouver, BC
www.mwtech.com

"Nicholas Paldino [.NET/C# MVP]" wrote:
Robert,

Mind, you, unless you are displaying the name of the file, there isn't a
reason to convert it, since it will just work in any functions that you need
it to.

If you want to get the full name, call the GetLongPathName through the
P/Invoke layer.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Robert W." <Ro*****@discussions.microsoft.com> wrote in message
news:F6**********************************@microsof t.com...
In my WinForms app I'm retrieving the command line arguments with this
standard code: static void Main(string[] args)

Here's the problem. I've now associated my app with a particular
extension;
let's call it ".abc". This way if a user is using Windows Explorer they
can
double-click on a ".abc" data file and my app will be automatically
started.
This works fine except for one thing.

Let's say the datafile is called "Big Tree.abc". Instead of this full
filename being passed to my app, I get "big~1.abc" instead.

What do I have to do to retrieve the full filename?

--
Robert W.
Vancouver, BC
www.mwtech.com


May 21 '06 #3
Robert,

You might want to try http://www.pinvoke.net for the P/Invoke
declarations, as it has quite a comprehensive list. It will prevent you
from having to search all over the web.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Robert W." <Ro*****@discussions.microsoft.com> wrote in message
news:EE**********************************@microsof t.com...
Nicholas,

Yes, it has to do with displaying the full filename in the title bar, as
well as the aesthetics of using Save As.

After much more research I found this excellent article:
http://www.c-sharpcorner.com/UploadF...d-8d2348b8c6d2
--
Robert W.
Vancouver, BC
www.mwtech.com

"Nicholas Paldino [.NET/C# MVP]" wrote:
Robert,

Mind, you, unless you are displaying the name of the file, there
isn't a
reason to convert it, since it will just work in any functions that you
need
it to.

If you want to get the full name, call the GetLongPathName through
the
P/Invoke layer.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Robert W." <Ro*****@discussions.microsoft.com> wrote in message
news:F6**********************************@microsof t.com...
> In my WinForms app I'm retrieving the command line arguments with this
> standard code: static void Main(string[] args)
>
> Here's the problem. I've now associated my app with a particular
> extension;
> let's call it ".abc". This way if a user is using Windows Explorer
> they
> can
> double-click on a ".abc" data file and my app will be automatically
> started.
> This works fine except for one thing.
>
> Let's say the datafile is called "Big Tree.abc". Instead of this full
> filename being passed to my app, I get "big~1.abc" instead.
>
> What do I have to do to retrieve the full filename?
>
> --
> Robert W.
> Vancouver, BC
> www.mwtech.com
>


May 21 '06 #4

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

Similar topics

1
by: Matt Rapoport | last post by:
I'd like to programmatically remove a service or change its startup type to disabled. I know how to remove it from the command line but is there another way using the win32 extensions? I've...
3
by: Thomas Rademacher | last post by:
Hallo, my application want to scan WIN directories with UNC pathnames. The methods os.path.isdir(pathname) and os.listdir(pathname) work fine with pathname="\\\\servername\\path". But with...
7
by: Lynn | last post by:
I'm running Oracle 8.1.7.4.1 on W2K and have the services for my oracle instances set to automatically startup and shutdown with the W2K server. Unfortunately, neither is working. Nothing gets...
3
by: Jason Heyes | last post by:
I want to open a file with a known location and process its contents. The contents are to be treated as a list of pathnames. Each pathname is an absolute or relative pathname in the following...
0
by: Michael Allen | last post by:
I have a textbox in form bound to a Hyperlink field. I have set the database startup options not to allow full menus. Therefore when a user attempts to edit the Hyperlink, this option is not...
6
by: Ramaraj | last post by:
Hi All, I am very interest to know the c-startup routine (like GNU gcc C-startup routine). and it s working principle and How this function is attached to operating system Thanks in...
1
by: draco | last post by:
Hi, Let's say I have a dynamic library libapple.so with a method applemethod() which expects a filename string. I call this method from main() which is in the file foo.c. Now foo.c and apple.so...
3
by: Dpage | last post by:
Hello, I'm trying to allow users to drag a file (in this case a crystal report .rpt file) onto my application's icon and have that drop event open my application and open the report in the...
22
by: Sven-Thorsten Fahrbach | last post by:
Hi Does anybody know of a library that offers a function to split pathnames. It should work somewhat like the following code snippet: ----------------- char *path =...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.