DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Command line length

  1. #1
    Shawn K. Hall Guest

    Command line length

    Hello All,

    I designed a vb class that parses the contents of the command line and
    keys at startup so you can determine *exactly* how the app was
    started. THe problem is that when you have a file association and you
    clik on more than so many files (where the command line would be in
    excess of some 265 (or something) characters in length) the app will
    *not* load and an error displays saying "access to the specified
    device, path or file is denied" (this also occurs using a "send to"
    link).

    I can't conceive of *why* this would occur in VB. In a C++ app I've
    never seen this happen (though, I have never needed nor tried in C++
    to parse the command line). Is there a solution *anywhere* that anyone
    can think of? I really hate the idea of my app not working simply
    because the command line was too long.

    TIA,

    Shawn K. Hall
    Programmer / Analyst
    *Please* post/respond in the newsgroups!





  2. #2
    Klaus H. Probst Guest

    Re: Command line length

    Hi Shawn,


    > I designed a vb class that parses the contents of the command line and
    > keys at startup so you can determine *exactly* how the app was
    > started. THe problem is that when you have a file association and you
    > clik on more than so many files (where the command line would be in
    > excess of some 265 (or something) characters in length) the app will
    > *not* load and an error displays saying "access to the specified
    > device, path or file is denied" (this also occurs using a "send to"
    > link).


    I can confirm this problem for you -- it happens in Win9x, NT4 and Win2000.

    Unfortunately, I believe the only way to circumvent this is to write a shell
    extension that works with the shell namespace (as opposed to paths). Doing
    it in C++ (using the standard C argument array passed to main() or the
    GetCommandLine() API) doesn't help, as you still get the same error. It's
    not a problem with VB or VC -- it's possibly a problem with how Windows
    handles environment space for a process.

    .. . . . . . . . . . . . . . . . . . . . . .
    Klaus H. Probst, MVP
    http://www.vbbox.com/
    http://www.mvps.org/ccrp/

    Please post/reply to the newsgroup(s)




  3. #3
    Shawn K. Hall Guest

    Re: Command line length

    Thank you Klaus,

    Looks like the class will simply have that limitation. I can't expect
    everyone that downloads it to be able to work with namespace
    extensions for each of their projects, so it looks like that's a real
    end-game.

    It would be nice if instead of popping an error that doesn't do
    anything at all to explain the actual problem to the user that it
    would enable the program to still load but with some sort of error
    contant (like CL_TOO_MUCH_DATA) on GetCommandLine().

    --
    Shawn K. Hall
    Programmer / Analyst
    *Please* post/respond in the newsgroups!


    "Klaus H. Probst" <kprobst@vbbox.com> wrote in message
    news:390e0583$1@news.devx.com...
    > Hi Shawn,
    >
    >
    > > I designed a vb class that parses the contents of the command line

    and
    > > keys at startup so you can determine *exactly* how the app was
    > > started. THe problem is that when you have a file association and

    you
    > > clik on more than so many files (where the command line would be

    in
    > > excess of some 265 (or something) characters in length) the app

    will
    > > *not* load and an error displays saying "access to the specified
    > > device, path or file is denied" (this also occurs using a "send

    to"
    > > link).

    >
    > I can confirm this problem for you -- it happens in Win9x, NT4 and

    Win2000.
    >
    > Unfortunately, I believe the only way to circumvent this is to write

    a shell
    > extension that works with the shell namespace (as opposed to paths).

    Doing
    > it in C++ (using the standard C argument array passed to main() or

    the
    > GetCommandLine() API) doesn't help, as you still get the same error.

    It's
    > not a problem with VB or VC -- it's possibly a problem with how

    Windows
    > handles environment space for a process.
    >
    > . . . . . . . . . . . . . . . . . . . . . .
    > Klaus H. Probst, MVP
    > http://www.vbbox.com/
    > http://www.mvps.org/ccrp/
    >
    > Please post/reply to the newsgroup(s)





Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center