Sorry, I couldn't remember back that far :o) I remember there was a lot of
hoopla when Microsoft dumped 16 bit for 32 bit. Now, looking back, I wonder
why anyone would use that old stuff these days. I guess if there is some
library that you are married to that can't be updated.... but any library
concerned.
"Joseph M. Newcomer" <newcomer@flounder.com> wrote in message
ShellExecute doesn't exist in 1.52c (that's the old 16-bit compiler).
Consider using WinExec and specifying the name of the Acrobat reader
(acroread.exe or
something like that...)
Unless there is a compelling reason to stay in the 16-bit world, you
really should update
yourself to the 32-bit world. Then ShellExecute would be available and
your task would be
very easy.
(I still have a client who uses a 16-bit app that I largely wrote, and the
reason is that
it critically depends on a very complex and elaborate third-party library
that is not
available in 32-bit; the company that made the library, and delivered only
the binary,
went out of business years ago. I estimate that it will take many
thousands of dollars to
rewrite the code [the use of the library is pervasive!] to use modern
libraries, and
consequently the client is reluctant to spend money on doing this
development.
Fortunately, the program has not required maintenance in many, many years;
the last change
log entry is dated 1999. I keep encouraging him to move into the 32-bit
world, but thus
far it hasn't been possible. I'm hoping Win64 will finally force the
issue...)
joe
On Fri, 8 Feb 2008 11:33:43 -0800, "Tom Serface"
<tom.nospam@camaswood.com> wrote:
To add to what Doug wrote... I think you could just call ShellExecute()
with
a .pdf file type and the shell would resolve this for you. I haven't seen
anyone use this kind of code for a really long time and since you're using
C++ you may as well get all the benefit of it.
Tom
"DBC User" <dbcuser@gmail.com> wrote in message
news:d7069faa-93be-4350-8aa1-7a284b40a01d@b2g2000hsg.googlegroups.com...
I have a vc1.52 code and there I am trying to launch a PDF file. This
is the code I have
/* SYSTEM.C: This program uses
* system to TYPE its source file.
*/
#include <stdio.h>
#include <process.h>
void main( int argc, char *argv[] )
{
char cmd[256];
int i=0;
for(i=0;i<argc;i++)
printf("%d - %s\n", i, argv[i]);
if (argc > 0)
{
system( argv[1] );
}
else
{
printf("No help file to show. Please contact support");
}
}
I run the program like the following
test.exe test.pdf
when I run it gives an error 'bad command or file name', but when I
type just the name test,pdf in the dos mode, it opens up the pdf
properly. What am I doing wrong here?
Thanks.
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm