Jump to content

exe file in C++.

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
8 replies to this topic

#1
moonrise

moonrise

    Learning Programmer

  • Members
  • PipPipPip
  • 40 posts
hello
How I can Run exe file in C++.
i have this problem as iam new to this problem iam unable to solve it can someone suggest about it

#2
Crane

Crane

    Programming Expert

  • Members
  • PipPipPipPipPipPip
  • 398 posts
Managed C++
System::Diagnostics::Process::Start("file.exe");

#3
dargueta

dargueta

    Writes binary right handed and hex left handed

  • Moderators
  • 4,709 posts
A much faster way, though potentially problematic, would be:

system("file.exe");

This executes the program through the DOS shell. Any arguments can be passed to the function as if it were on the command line. The only problem is that it interrupts execution of your own program until the called program is finished.

#4
v0id

v0id

    Retired

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 2,936 posts
Dargueta, you shouldn't bump years-old threads. The chances that the author still needs the help is minimal.

Besides that, your code will not be executed in the DOS shell, but in the command prompt.

#5
dargueta

dargueta

    Writes binary right handed and hex left handed

  • Moderators
  • 4,709 posts
Didn't look at the date, sorry. Besides, isn't the command prompt sort of an interface to the shell, and technically the program would then be executed by the shell?

#6
v0id

v0id

    Retired

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 2,936 posts
I'm not completely sure about this, but I don't think MSDOS is used at all by Windows anymore for larger purposes. The last full-supported MSDOS was shipped with Windows ME, and later versions only includes a subset of it, which is only used if it's really necessary.

#7
dargueta

dargueta

    Writes binary right handed and hex left handed

  • Moderators
  • 4,709 posts
I've noticed that. Windows 95 comes with DOS 6, and XP comes with 5.0. What a ripoff...

Anyway, I apologize again for my noob mistake.

#8
v0id

v0id

    Retired

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 2,936 posts
You don't have to apologize for it, everybody makes mistakes - but at least, we're learning from them. :-)

#9
kkelly

kkelly

    Learning Programmer

  • Members
  • PipPipPip
  • 49 posts
You can start an application through a shell command or the Win32_Process class. Specifically, the Create method which requires an object of Win32_ProcessStartup. This is the entry point that is preferred by Microsoft, but there are probably other ways.
Conerning DOS: Windows 2000 and up kernels do not use MS-DOS. All 16-bit control is handled in NTLDR during the boot process. If an application requires a 16 bit memory space, it runs in a protected memory range, and the calls are thunked back and forth during execution. CMD.exe, the command prompt, and Explorer.exe, the default shell, reference many of the same libraries. Most, if not all, the difference between the two is at the presentation layer.