[Qt-interest] How to use a button click and open up Windows commandprompt
Nechypurenko, Andrey (GE Healthcare)
Andrey.Nechypurenko at ge.com
Tue Sep 15 10:17:12 CEST 2009
>From: qt-interest-bounces at trolltech.com
[mailto:qt-interest-bounces at trolltech.com] On Behalf Of Wilson Pok
>Sent: Montag, 14. September 2009 13:11
>To: qt-interest at trolltech.com
>Subject: [Qt-interest] How to use a button click and open up Windows
commandprompt
>
>
>#include <windows.h>
>#include <tchar.h>
>#include <iostream>
>
>using namespace std;
>
>void button_click()
>{
> HINSTANCE hInst = ShellExecute(0,
> "open", // Operation to perform
> "cmd.exe", // Application name
> "-d tes123", // Additional parameters
> 0, // Default directory
> SW_SHOW);
> return 0;
>}
>
>
>This code can work in MS Visual Studio. Now that I am
>using QT is there anyway I can do the same? open a
>windows command prompt window with some parameters
>I created a QT GUI project and put the same code in
>for button click action. It wont work anymore.
I do not see any reasons why the code sample above wont
work with Qt. However it is not portable.
You can take a look at QProcess to achieve the same
funcitonality:
http://doc.trolltech.com/4.5/qprocess.html#details
More information about the Qt-interest-old
mailing list