For Programmers: Free Programming Magazines  


Home > Archive > Visual Basic > March 2006 > File Name Command Line Parameter









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author File Name Command Line Parameter
will f

2006-03-29, 6:56 pm

Greetings.

I have created a file association with a VB app so that the app starts with
a command line parameter containing the path of the file that is
double-clicked.

When I double click on a file in the My Documents folder C:\Documents and
Settings\my user name\My Documents\my file.abcd, the Command$ variable
contains the value C:\Docume~1\myuser~1\MyDocu~1\my file.abc.

Truncating the folder names is not a problem. However, lopping off the last
character of the file extension is a problem.

Is there a way that I can instruct my VB app not to use the 8-dot-3 short
file name? Can I tell VB to use long file names?

I will be grateful for any help. Thank you.

- will f


Karl E. Peterson

2006-03-29, 6:56 pm

will f wrote:
> Is there a way that I can instruct my VB app not to use the 8-dot-3
> short file name? Can I tell VB to use long file names?


You'll probably want to call GetLongPathName on the truncated path, before
attempting to use it.
--
Working without a .NET?
http://classicvb.org/


Jack

2006-03-29, 6:56 pm

Please find this topic (March 27th):
Strange problem, after changing computer

and see the reply posts by Ken Halter
Jack

"will f" <null@nospam.net> wrote in message
news:ObQ5Ml2UGHA.5004@TK2MSFTNGP11.phx.gbl...
> Greetings.
>
> I have created a file association with a VB app so that the app starts
> with a command line parameter containing the path of the file that is
> double-clicked.
>
> When I double click on a file in the My Documents folder C:\Documents and
> Settings\my user name\My Documents\my file.abcd, the Command$ variable
> contains the value C:\Docume~1\myuser~1\MyDocu~1\my file.abc.
>
> Truncating the folder names is not a problem. However, lopping off the
> last character of the file extension is a problem.
>
> Is there a way that I can instruct my VB app not to use the 8-dot-3 short
> file name? Can I tell VB to use long file names?
>
> I will be grateful for any help. Thank you.
>
> - will f
>



will f

2006-03-29, 6:56 pm

Hallelujah! GetLongPathName did the trick! Thank you.

- will f.

"Karl E. Peterson" <karl@mvps.org> wrote in message
news:%23352Yw2UGHA.4976@TK2MSFTNGP11.phx.gbl...
> will f wrote:
>
> You'll probably want to call GetLongPathName on the truncated path, before
> attempting to use it.
> --
> Working without a .NET?
> http://classicvb.org/
>
>



Randy Birch

2006-03-29, 6:56 pm

Why not just fix the association to enclose the %1 at the end of the
registry shell string to include quotes, e.g. "%1".

--

Randy Birch
MS MVP Visual Basic
http://vbnet.mvps.org/

Please reply to the newsgroups so all can participate.




"will f" <null@nospam.net> wrote in message
news:eUOjI42UGHA.2704@tk2msftngp13.phx.gbl...
: Hallelujah! GetLongPathName did the trick! Thank you.
:
: - will f.
:
: "Karl E. Peterson" <karl@mvps.org> wrote in message
: news:%23352Yw2UGHA.4976@TK2MSFTNGP11.phx.gbl...
: > will f wrote:
: >> Is there a way that I can instruct my VB app not to use the 8-dot-3
: >> short file name? Can I tell VB to use long file names?
: >
: > You'll probably want to call GetLongPathName on the truncated path,
before
: > attempting to use it.
: > --
: > Working without a .NET?
: > http://classicvb.org/
: >
: >
:
:

MikeD

2006-03-29, 6:56 pm


"will f" <null@nospam.net> wrote in message
news:eUOjI42UGHA.2704@tk2msftngp13.phx.gbl...
> Hallelujah! GetLongPathName did the trick! Thank you.
>


You might also want to look into how you're creating the association. You
should be able to create it so that Windows actually passes the long file
name, and then you don't need to call GetLongPathName. Generally, the
parameter placeholder of your file association command line just needs
enclosed in quotation marks.

--
Mike
Microsoft MVP Visual Basic


Larry Serflaten

2006-03-29, 9:55 pm


"Randy Birch" <rgb_removethis@mvps.org> wrote
> Why not just fix the association to enclose the %1 at the end of the
> registry shell string to include quotes, e.g. "%1".


Wasn't there also a %L designation to pass long filenames? However
that might have been an NT (or later) only addition....

LFS


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com