Hello. I have a question regarding using the 'system' command in C++. Using that command, i.e. system("myfile1.exe"), the command window appears. Is there a way of preventing the command window from appearing? Or is there any other way to do this using a different command? ( I do not want myfile.exe to run as a background application ).

I am using a Windows XP operating system.

Recommended Answers

All 3 Replies

Hi, and thanks for the reply.

On including the headers stdio.h and shellapi.h and adding the ShellExecute command given, I get the following errors while compiling:

c:\program files\microsoft visual studio\vc98\include\shellapi.h(53) : error C2065: 'HDROP' : undeclared identifier
c:\program files\microsoft visual studio\vc98\include\shellapi.h(53) : error C2501: 'DECLARE_HANDLE' : missing storage-class or type specifiers
c:\program files\microsoft visual studio\vc98\include\shellapi.h(55) : error C2146: syntax error : missing ';' before identifier 'UINT'
c:\program files\microsoft visual studio\vc98\include\shellapi.h(55) : error C2501: 'DECLSPEC_IMPORT' : missing storage-class or type specifiers
c:\program files\microsoft visual studio\vc98\include\shellapi.h(55) : fatal error C1004: unexpected end of file found
Error executing cl.exe.

I am using Microsoft Visual Studio 6.0 on a Windows XP operating system. How do I debug these errors?

Thanks.

Sorry, I used the command:

ShellExecute(NULL, "open","myfile1.exe", NULL, NULL, SW_HIDE);

...and I include the process.h and stdio.h header files.

Thanks.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.