473,408 Members | 2,427 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,408 software developers and data experts.

File association - Problem with argument begin passed in

I have set up file association for my application (VB.Net). I'm having
problems getting the filename that was double-clicked. On my machine at
work, if the filename being passed in to the application has spaces in any
of the folder names, they get split up at every space. This happens
regardless if I use a Sub Main(ByVal args() as String) or use
System.Environment.GetCommandLineArgs(). For example, if I launch a file
that's on my desktop, the string array is something like this (I am not able
to open the file unless I were to append args together to make a complete
path\filename, which doesn't seem too safe to me):
args(0) = C:\Documents
args(1) = and
args(2) = Settings\MyUsername\Desktop\MyFile.sql

If I run the same application on my computer at home, args looks like this
(I am able to open the file):
args(0) = C:\Docume~1\MyUser~1\Desktop\MyFile.sql

My question is twofold. Why does this act differently on two machines both
running WinXP Pro SP2? And what is the "right" way to get the complete
path\filename?

Thanks,
Justin
Nov 22 '05 #1
6 2087
Sorry, the WinXP machines have SP1, not SP2...my mistake.
"Justin F" <x@x.us> wrote in message news:LbRec.3008$bl.126@okepread03...
I have set up file association for my application (VB.Net). I'm having
problems getting the filename that was double-clicked. On my machine at
work, if the filename being passed in to the application has spaces in any
of the folder names, they get split up at every space. This happens
regardless if I use a Sub Main(ByVal args() as String) or use
System.Environment.GetCommandLineArgs(). For example, if I launch a file
that's on my desktop, the string array is something like this (I am not able to open the file unless I were to append args together to make a complete
path\filename, which doesn't seem too safe to me):
args(0) = C:\Documents
args(1) = and
args(2) = Settings\MyUsername\Desktop\MyFile.sql

If I run the same application on my computer at home, args looks like this
(I am able to open the file):
args(0) = C:\Docume~1\MyUser~1\Desktop\MyFile.sql

My question is twofold. Why does this act differently on two machines both running WinXP Pro SP2? And what is the "right" way to get the complete
path\filename?

Thanks,
Justin

Nov 22 '05 #2
Sorry, the WinXP machines have SP1, not SP2...my mistake.
"Justin F" <x@x.us> wrote in message news:LbRec.3008$bl.126@okepread03...
I have set up file association for my application (VB.Net). I'm having
problems getting the filename that was double-clicked. On my machine at
work, if the filename being passed in to the application has spaces in any
of the folder names, they get split up at every space. This happens
regardless if I use a Sub Main(ByVal args() as String) or use
System.Environment.GetCommandLineArgs(). For example, if I launch a file
that's on my desktop, the string array is something like this (I am not able to open the file unless I were to append args together to make a complete
path\filename, which doesn't seem too safe to me):
args(0) = C:\Documents
args(1) = and
args(2) = Settings\MyUsername\Desktop\MyFile.sql

If I run the same application on my computer at home, args looks like this
(I am able to open the file):
args(0) = C:\Docume~1\MyUser~1\Desktop\MyFile.sql

My question is twofold. Why does this act differently on two machines both running WinXP Pro SP2? And what is the "right" way to get the complete
path\filename?

Thanks,
Justin

Nov 22 '05 #3
On Tue, 13 Apr 2004 08:27:02 -0500, Justin F wrote:
I have set up file association for my application (VB.Net). I'm having
problems getting the filename that was double-clicked. On my machine at
work, if the filename being passed in to the application has spaces in any
of the folder names, they get split up at every space. This happens


In the file association, enclose the argument in quotation marks. For
example, in the registry, the setup for a .vbproj file is as follows:

"C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\IDE\devenv.exe"
"%1"
Notice that the %1 is inside quotation marks.

In the registry under your file association, look at the open registry key
and make sure the %1 is in quotation marks. That should keep it from being
split on the spaces.

HTH

--
Chris

To send me an E-mail, remove the underscores and lunchmeat from my E-Mail
address.
Nov 22 '05 #4
On Tue, 13 Apr 2004 08:27:02 -0500, Justin F wrote:
I have set up file association for my application (VB.Net). I'm having
problems getting the filename that was double-clicked. On my machine at
work, if the filename being passed in to the application has spaces in any
of the folder names, they get split up at every space. This happens


In the file association, enclose the argument in quotation marks. For
example, in the registry, the setup for a .vbproj file is as follows:

"C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\IDE\devenv.exe"
"%1"
Notice that the %1 is inside quotation marks.

In the registry under your file association, look at the open registry key
and make sure the %1 is in quotation marks. That should keep it from being
split on the spaces.

HTH

--
Chris

To send me an E-mail, remove the underscores and lunchmeat from my E-Mail
address.
Nov 22 '05 #5
"Chris Dunaway" <dunawayc@_lunchmeat_sbcglobal.net> wrote in message
news:1i*****************************@40tude.net...
On Tue, 13 Apr 2004 08:27:02 -0500, Justin F wrote:
I have set up file association for my application (VB.Net). I'm having
problems getting the filename that was double-clicked. On my machine at work, if the filename being passed in to the application has spaces in any of the folder names, they get split up at every space. This happens

In the file association, enclose the argument in quotation marks. For
example, in the registry, the setup for a .vbproj file is as follows:

"C:\Program Files\Microsoft Visual Studio .NET

2003\Common7\IDE\devenv.exe" "%1"
Notice that the %1 is inside quotation marks.

In the registry under your file association, look at the open registry key
and make sure the %1 is in quotation marks. That should keep it from being split on the spaces.

HTH

--
Chris

To send me an E-mail, remove the underscores and lunchmeat from my E-Mail
address.


That worked, thanks a bunch!
Nov 22 '05 #6
"Chris Dunaway" <dunawayc@_lunchmeat_sbcglobal.net> wrote in message
news:1i*****************************@40tude.net...
On Tue, 13 Apr 2004 08:27:02 -0500, Justin F wrote:
I have set up file association for my application (VB.Net). I'm having
problems getting the filename that was double-clicked. On my machine at work, if the filename being passed in to the application has spaces in any of the folder names, they get split up at every space. This happens

In the file association, enclose the argument in quotation marks. For
example, in the registry, the setup for a .vbproj file is as follows:

"C:\Program Files\Microsoft Visual Studio .NET

2003\Common7\IDE\devenv.exe" "%1"
Notice that the %1 is inside quotation marks.

In the registry under your file association, look at the open registry key
and make sure the %1 is in quotation marks. That should keep it from being split on the spaces.

HTH

--
Chris

To send me an E-mail, remove the underscores and lunchmeat from my E-Mail
address.


That worked, thanks a bunch!
Nov 22 '05 #7

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

Similar topics

6
by: Justin F | last post by:
I have set up file association for my application (VB.Net). I'm having problems getting the filename that was double-clicked. On my machine at work, if the filename being passed in to the...
1
by: john conwell | last post by:
I've got a process engine written in .Net. the user writes a data file and saves it as file type ".xyz". I have a file assiciation set up in the database that when a .xyz file is invoked (double...
3
by: A_StClaire_ | last post by:
hi, not sure what I'm doing wrong here. getting "error C2064: term does not evaluate to a function taking 2 arguments" in response to my SortCardVector function...? Card.h: #pragma once
165
by: Dieter | last post by:
Hi. In the snippet of code below, I'm trying to understand why when the struct dirent ** namelist is declared with "file" scope, I don't have a problem freeing the allocated memory. But...
2
by: techspirit | last post by:
Hello , After installing the application, if I right click on the file associated with the application and select the option "Play", it only opens the application, but does not play the file....
1
by: Chris | last post by:
Hi Everyone, I have a backup application I'm working on that saves backups with an extension of .ABF. I have figured out how to make the association change with PInvoke/shell32, but would...
1
by: laredotornado | last post by:
Hi, I'm using PHP 4.4.4 on Apache 2 on Fedora Core 5. PHP was installed using Apache's apxs and the php library was installed to /usr/local/php. However, when I set my "error_reporting"...
28
by: Tim Daneliuk | last post by:
I have a program wherein I want one behavior when a file is set as executable and a different behavior if it is not. Is there a simple way to determine whether a given named file is executable...
185
by: jacob navia | last post by:
Hi We are rewriting the libc for the 64 bit version of lcc-win and we have added a new field in the FILE structure: char *FileName; fopen() will save the file name and an accessor function will...
16
by: John Doe | last post by:
Hi, I wrote a small class to enumerate available networks on a smartphone : class CNetwork { public: CNetwork() {}; CNetwork(CString& netName, GUID netguid): _netname(netName),...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...

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.