WxTextCtrl as Cmd Out/input

If you are using wxDev-C++ for your wxWidgets design, please ask your questions here instead of in IDE Related.
Post Reply
Cuser
In need of some credit
In need of some credit
Posts: 1
Joined: Thu Nov 24, 2016 9:49 am

WxTextCtrl as Cmd Out/input

Post by Cuser »

Hello guys,

I am working on Gui Appclication in WxDevc ++ 7.
I have a Button which has a following funktion ... System("ip-config")..
I want get the output in my WxTextCtrl instead in a windows cmdbox.

How can use the WxTextCtrl as a Cmdbox?

There is no Solution @ "google" :(

help me.
User avatar
marcelinux
Knows some wx things
Knows some wx things
Posts: 40
Joined: Thu Nov 07, 2013 9:59 pm
Location: Madrid, Spain

Re: WxTextCtrl as Cmd Out/input

Post by marcelinux »

http://docs.wxwidgets.org/3.0/classwx_process.html
wxProcess also supports IO redirection of the child process. For this, you have to call its Redirect() method before passing it to wxExecute(). If the child process was launched successfully, GetInputStream(), GetOutputStream() and GetErrorStream() can then be used to retrieve the streams corresponding to the child process standard output, input and error output respectively.
I hope this help you.
I just need learn a little bit more. Thank you for your help.
PB
Part Of The Furniture
Part Of The Furniture
Posts: 4182
Joined: Sun Jan 03, 2010 5:45 pm

Re: WxTextCtrl as Cmd Out/input

Post by PB »

By the way, the bundled "exec" sample demonstrates how to capture and display output of another process.
jgrzybowski
Earned some good credits
Earned some good credits
Posts: 113
Joined: Sat Sep 24, 2011 9:32 pm
Location: Poland

Re: WxTextCtrl as Cmd Out/input

Post by jgrzybowski »

If output of your function is a text (wxString) you can show it inside of wxTextCtrl in this way:

Code: Select all

textctrlYourTextCtrl->AppendText(stringYourOutputText);
If output of your function is a number (int, long, etc) you can show it inside of wxTextCtrl in this way:

Code: Select all

textctrlYourTextCtrl->AppendText(wxString::Format(wxT("%d"), intYourOutputNumber));
regards, Jarek
Post Reply