2 Replies - 6061 Views - Last Post: 28 March 2007 - 09:25 PM Rate Topic: -----

#1 shuaib  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 12-December 06

Open Application Programatically

Posted 28 March 2007 - 06:39 PM

i want to open the notepad window with c. i dont know how to start with please help
Is This A Good Question/Topic? 0
  • +

Replies To: Open Application Programatically

#2 Amadeus  Icon User is offline

  • g+ + -o drink whiskey.cpp
  • member icon

Reputation: 248
  • View blog
  • Posts: 13,507
  • Joined: 12-July 02

Re: Open Application Programatically

Posted 28 March 2007 - 06:41 PM

It will depend what platform you are using - is it windows? Linux?

Generally, a system call will do the trick for windows:
system("pathtoapplicationhere");


Was This Post Helpful? 0
  • +
  • -

#3 Xing  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 19
  • View blog
  • Posts: 725
  • Joined: 22-July 06

Re: Open Application Programatically

Posted 28 March 2007 - 09:25 PM

Although system() is easy to use but it has lot of problems like:
1. The child program is un-interruptible from the parent program. This means that you cannot stop the program you have started. If it takes 5 hours to complete, that's how long your program will wait
2. You cannot communicate or share variables with the child process
3. For various security reasons, its unsafe and may leave your system open to exploitation.
4. In system terms, its relatively slow.

Depending on your platform you can use spawn, _spawn, fork/exec, CreateProcess, ShellExecute etc.

This post has been edited by Xing: 28 March 2007 - 09:25 PM

Was This Post Helpful? 1

Page 1 of 1