- more command line parameters in windows
- Posted by Yandos on September 1st, 2006
Hi,
I have a simple app compiled under windows with bcc32:
#include <stdio.h>
int main(int argc, char *argv[]) {
int i;
for (i=0; i<argc; i++) {
printf("%s\n",argv[i]);
}
return(0);
}
What should I do to force such an application accept more than limited
number of command line parameters? I'd like to pass a lot of files to
the application (using "SendTo" menu when you rightclick files), but
depending on file names length, this will handle only about 50 files
(tested on window xp) 
When more files are sent to the comiled exe I will receive the message
Windows cannot access the specified device, path, or file. You may not
have the appropriate permission to access the item", but for example
send to compressed zip folder accepts unlimited number of files.
What technique should I use to read selected files when argc/argv[]
does not work?
Thank you for any help.
Y.
- Posted by Scott McPhillips [MVP] on September 3rd, 2006
Yandos wrote:
You can put an unlimited number of file names in a file, then pass that
file as the command line argument.
--
Scott McPhillips [VC++ MVP]
- Posted by [Jongware] on September 4th, 2006
"Scott McPhillips [MVP]" <org-dot-mvps-at-scottmcp> wrote in message
news:lMqdncYF0-5jfGfZnZ2dnUVZ_t6dnZ2d@comcast.com...
I don't think the SendTo menu uses that trick ...
The drag-and-drop system for windows (with a small 'w') manages with only
three functions: DragQueryFile, to retrieve the number of files; one
DragQueryFile (w/other params) per file, to retrieve each file name; and
DragFinish. Since #1 and #2 are the same function, and I always forget to
DragFinish, it's even just one function 
These functions can be used from inside windows handlers *only*, but I
imagine a similar system might be used in the bare bones system interface.
[jongware]
- Posted by Yandos on September 4th, 2006
"Scott McPhillips [MVP]" <org-dot-mvps-at-scottmcp> wrote in news:lMqdncYF0-
5jfGfZnZ2dnUVZ_t6dnZ2d@comcast.com:
Thank you for reply, yes, but how do I get selected files into a file? The idea is that user
selects some files in windows explorer and sends them to my application, but without
the need to launch it first (or any other application that would prepare the list)
Y.
- Posted by Yandos on September 4th, 2006
"[Jongware]" <sorry@no_spam.plz> wrote in
news:44fbf5f6$0$4518$e4fe514c@news.xs4all.nl:
I don't know if SendTo or internal windows zip compressor uses some kind of trick, but
somehow it is possible - send -> compressed zip folder menu really takes unlimited
number of files (without using drag and drop). This is exactly what I need to do, except
I'm not going to compress the files 
Thank you for the reply, but drag and drop is not the way I'd like to go. I think there's
some better way - for example winrar also knows which files has been selected and
takes them for compressing - user only rightclick, and selcted files are compressed
with winrar. This way I'd like to go.
Y.
- Posted by [Jongware] on September 4th, 2006
"Yandos" <fakemail@fakeisp.com> wrote in message
news:44fbfbc1$1_3@x-privat.org...
Oddly, just as I already said --
Oh, alright, I've googled it for you. The term I was looking for is "Shell
Extension". A good introduction is The Complete Idiot's Guide to Writing
Shell Extensions at http://www.codeproject.com/shell/shellextguideindex.asp
And I'll only say dis once: START WITH PART 1! I repeat-- START WITH PART 1!
The comment on Part 2 promises "I'll show how to handle multiple files in a
single right-click operation" (and Part IV is all about the Send To menu),
but this is very tricky stuff, it might mess up your system real bad. Before
you know it you're mailing from another computer, asking us how to repair
various-things-that-went-wrong. [No smiley here]
[Jongware]
- Posted by Yandos on September 4th, 2006
"[Jongware]" <sorry@no_spam.plz> wrote in
news:44fc03d4$0$4525$e4fe514c@news.xs4all.nl:
Wow, thank you, that looks promising
Google is great, when you know what you are
looking for 
I doubt I will be able to compile that with bcc32, but I will try that. I have thought that it
will go much easier without messing with the registry, just like using argc and argv =-o
but it looks like this is the right and only way...
Many thanks for help, have a nice day,
Y.
- Posted by [Jongware] on September 4th, 2006
"Yandos" <fakemail@fakeisp.com> wrote in message
news:44fc2234_3@x-privat.org...
I actually searched sth like "send to menu", and recognized this article
series from doodling with custom icons and file popups, but I never tried
the shell menu extensions. [very nearly broke my windows as well.]
you're having a problem right at the start, as step 1 for every article
seems to be "start the ATL COM appwizard". You can read the assembler
version (though the link to there seems to be dead?), because this *will* do
the initialization step by step. Otherwise, google how to start with ATL COM
in bcc32 
I also use bcc32 (because it integrates nicely with my code editor) and I
can write regular proggies without help of talking paperclips, but for stuff
like this I have an old Visual Studio.
[Jongware]