DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 6 of 6

Thread: ShellExecute

Hybrid View

  1. #1
    Guest

    ShellExecute


    I am using the ShellExecute command in a C++ program(Visual C++). I need
    to send a parameter string that can be up to 700 characters long, but it
    doesn't seem to execute unless the string is less than that. Does anyone
    know of a maximum on the length of the parameter string that can be passed?

  2. #2
    jonnin Guest

    Re: ShellExecute


    Taking a stab, the limit may be with command.com, not shellex.
    Can you send that many args to the program from a command prompt?
    Shellexecute wants a char* (under a different name) and should not have a
    size limit (maybe a fake one though ...)

    if it works from the command prompt, then there is a limit. and if it works
    with less than 700 as you said, then the limit is 699...

    everyone has been saying use shellexecutex because shellexecute is flaky.
    I used it and its fine under win98, but thats code just for my use ...



    <pjohnson@e3corp.com> wrote:
    >
    >I am using the ShellExecute command in a C++ program(Visual C++). I need
    >to send a parameter string that can be up to 700 characters long, but it
    >doesn't seem to execute unless the string is less than that. Does anyone
    >know of a maximum on the length of the parameter string that can be passed?



  3. #3
    Paul Kohlmiller Guest

    Re: ShellExecute


    If you get stuck on this, consider using a spawn function such as _spawnl()
    <pjohnson@e3corp.com> wrote:
    >
    >I am using the ShellExecute command in a C++ program(Visual C++). I need
    >to send a parameter string that can be up to 700 characters long, but it
    >doesn't seem to execute unless the string is less than that. Does anyone
    >know of a maximum on the length of the parameter string that can be passed?



  4. #4
    Danny Kalev Guest

    Re: ShellExecute

    typically, the limit is 254 characters + a terminating null. This is not
    a standard requirement, just common practice. Perhaps you should pass a
    filename as a parameter and store the actual string in the file. There
    are other techniques but they are much more complicated and depend on
    the compiler and platform you're using. For example, in Linux and Unix
    you can use the exec() family of functions and pass a pointer to a
    process' stack.

    Danny

    pjohnson@e3corp.com wrote:
    >
    > I am using the ShellExecute command in a C++ program(Visual C++). I need
    > to send a parameter string that can be up to 700 characters long, but it
    > doesn't seem to execute unless the string is less than that. Does anyone
    > know of a maximum on the length of the parameter string that can be passed?


  5. #5
    Assaf Lavie Guest

    Re: ShellExecute

    The command.com program doesn't use ShellExecute, it uses CreateProcess.

    As far as I can recall, there's not documented limit on the length of the
    lpParameters argument.

    Assaf.

    "jonnin" <jonnin@vol.com> wrote in message news:3a562ef3$1@news.devx.com...
    >
    > Taking a stab, the limit may be with command.com, not shellex.
    > Can you send that many args to the program from a command prompt?
    > Shellexecute wants a char* (under a different name) and should not have a
    > size limit (maybe a fake one though ...)
    >
    > if it works from the command prompt, then there is a limit. and if it

    works
    > with less than 700 as you said, then the limit is 699...
    >
    > everyone has been saying use shellexecutex because shellexecute is flaky.
    > I used it and its fine under win98, but thats code just for my use ...
    >
    >
    >
    > <pjohnson@e3corp.com> wrote:
    > >
    > >I am using the ShellExecute command in a C++ program(Visual C++). I need
    > >to send a parameter string that can be up to 700 characters long, but it
    > >doesn't seem to execute unless the string is less than that. Does anyone
    > >know of a maximum on the length of the parameter string that can be

    passed?
    >




  6. #6
    Guest

    Re: ShellExecute


    Thanks for your response, but due to the limitations of the executable I am
    trying to run, I have to do it the way I'm doing it. I tried cutting the
    number of characters I was sending in lpParameters until I hit a magic number
    where it quit. It turned out to be 493. Unfortunately, that won't work
    for what I'm trying to do. I will have to explore other alternatives.



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