Hey,can anyone tell me how to invoke a new application/software using c++ or visual c++.
Also, gor interfacing a gui with my c++ code,should i go for vc++?

Recommended Answers

All 10 Replies

You can start another program using the system() function.

As for a GUI, I would suggest Qt4.

Dave

Along with the system() function, you could also try to use the fork() and exec() methods, shown here:

http://www.yolinux.com/TUTORIALS/ForkExecProcesses.html

For a GUI toolkit, the big ones are

-Qt
-GTK+
-WxWidgets

There is also FLTK, which is a very powerful GUI toolkit, and it has a less steep learning curve than the ones listed above. But, it is less common, and some people consider it to "lack polish". However, if you are just starting with GUI programming, I would consider FLTK to be the best choice. After you have more experience with GUI programming, I would use Qt. Very professional, and widely used. Also, last year, they released an option to use Qt with the LGPL license. Here are a couple of articles on this:

http://qt.nokia.com/about/news/lgpl-license-option-added-to-qt
http://arstechnica.com/open-source/news/2009/01/nokia-qt-lgpl-switch-huge-win-for-cross-platform-development.ars

Here are a few comparisons for all the toolkits:

http://www.wikivs.com/wiki/GTK_vs_Qt
http://www.gidforums.com/t-8113.html
http://stackoverflow.com/questions/1257894/wxwindows-vs-gtk-for-cross-platform-gui-programming
http://ubuntuforums.org/showthread.php?t=782887

how to invoke another process is operating system dependent. fork() creates another process from the currently running process, it does not invoke a new process that is not currently running -- and its only supported by *nix machines.. system() as suggested by dave is supported on all (or most) operating systems.

>>Also, gor interfacing a gui with my c++ code,should i go for vc++?
vc++ is NOT a language -- its just another IDE/compiler like g++.

Hey,
Thank you guys.

My application would run on Windows. Would I be able to invoke and run another application (say,provide the files selected by the user in the GUI to Matlab) using system() command while my C++ program is still running?

Can't SPAWN() and exec() do the job?

Does VisualC++ provide some mechanism or libraries to interface GUI with my C++ code?

Can you suggest me some tutorials on QT or FLTK?

Sorry for writing gor instead of for

There are a number of ways to start another process. system() is just one of them. On MS-Windows you can also call CreateProcess(), ShellExecute(), and spawn(). The all do basically the same thing, but CreateProess() gives your program a lot more control over the process being executed than the other functions.

>>Does VisualC++ provide some mechanism or libraries to interface GUI with my C++ code?
Not the free version. With that you have to resort to pure win32 api function calls. But you could use the free wxWidgets c++classes.

I have licensed version of VC++. Can you suggest me some compiler which would be easy to work with when it comes to making GUIs(say using QT or libraries proovided in VC++),interfacing it with your C++ program,invoking another application while your program is still running and later storing your data in a database.?

If you have the Professional version or better then you could use MFC (unmanaged code) or even Windows Forms (CLR managed code)

We've already covered invoking other application, so I won't repeat myself and others.

Databases. If it's an SQL compliant database like MySQL, Access, Oracle, Sybase and many others, you will also have to learn SQL. google for SQL tutorials and you will easily find them. After that you might want to learn ODBC, which is a very common set of database access functions. If you are using MySQL there is a MySQL++ c++ class that makes it a little easier.

If your data is not really very complicated and SQL might be overkill, then you could just write out the data in a normal text or binary file.

in window, you can use createprocess() to call any application and in linux use system or exec system call to call new application.

thank you all.
:)

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.