| View previous topic :: View next topic |
| Author |
Message |
Slugsnack Grandmaster Cheater Supreme
Reputation: 71
Joined: 24 Jan 2007 Posts: 1857
|
Posted: Tue Jul 14, 2009 3:31 pm Post subject: bounding console windows to a dialog |
|
|
if i have a main dialog and i want to force multiple console windows inside it how would i go about doing that ?
to explain properly, i want to bind multiple consoles within the same place in a main window ( which i create ) then i can use tab controls to switch between the different consoles
|
|
| Back to top |
|
 |
Chaosis13 Master Cheater
Reputation: 0
Joined: 14 Aug 2007 Posts: 372
|
Posted: Tue Jul 14, 2009 5:43 pm Post subject: |
|
|
| Do you mean using AllocConsole() to make new consoles, then using GetStdHandle() to get a handle to all of them?
|
|
| Back to top |
|
 |
Slugsnack Grandmaster Cheater Supreme
Reputation: 71
Joined: 24 Jan 2007 Posts: 1857
|
Posted: Wed Jul 15, 2009 5:59 am Post subject: |
|
|
pretend i just opened up 2 instances of command prompt ( cmd.exe ) one running ping and one running tracert. i wanna force those two windows inside my main one. and then be able to tab between them using tab controls.
i had an idea which was to get the window handles of the 2 consoles. then change their style attributes so they can be child windows. the setparent() but not sure if that's gonna work. i'll try that when i get home tonight
illustration :
//edit : gay, i need to think of something else.. setwindowlong to force it to become a child window won't work since the same process doesn't own it.. making the handle inherited in the createprocess call doesn't work either. still access_denied
|
|
| Back to top |
|
 |
kitterz Grandmaster Cheater Supreme
Reputation: 0
Joined: 24 Dec 2007 Posts: 1268
|
Posted: Thu Jul 16, 2009 8:32 pm Post subject: |
|
|
I don't think that is possible....But take a look at something called MDI (Multiple Document Interface)
_________________
|
|
| Back to top |
|
 |
Chaosis13 Master Cheater
Reputation: 0
Joined: 14 Aug 2007 Posts: 372
|
Posted: Thu Jul 16, 2009 9:48 pm Post subject: |
|
|
I think it isn't possible, but you can use this:
| Code: | string command = textBox1->Text;
string rtn = system(command);
textBox2->Text = rtn; |
Or I think there is a powershell control... You will need to install powershell.
|
|
| Back to top |
|
 |
Slugsnack Grandmaster Cheater Supreme
Reputation: 71
Joined: 24 Jan 2007 Posts: 1857
|
Posted: Fri Jul 17, 2009 5:16 am Post subject: |
|
|
| i know about powershell + MDI. last solution i'm considering now is piping which seems like a nice one to look at
|
|
| Back to top |
|
 |
HomerSexual Grandmaster Cheater Supreme
Reputation: 5
Joined: 03 Feb 2007 Posts: 1657
|
Posted: Fri Jul 17, 2009 9:13 am Post subject: |
|
|
| Slugsnack wrote: | | i know about powershell + MDI. last solution i'm considering now is piping which seems like a nice one to look at |
you could at least bind them by getting the coords of the parent window and not letting WM_MOVE move them outside of that coord.
_________________
|
|
| Back to top |
|
 |
Slugsnack Grandmaster Cheater Supreme
Reputation: 71
Joined: 24 Jan 2007 Posts: 1857
|
Posted: Fri Jul 17, 2009 12:02 pm Post subject: |
|
|
nah putting it as a child window just makes it display all weird anyway.. see :
nah piping seems like the perfect solution. home now, gonna try it now
|
|
| Back to top |
|
 |
BanMe Master Cheater
Reputation: 0
Joined: 29 Nov 2005 Posts: 375 Location: Farmington NH, USA
|
|
| Back to top |
|
 |
Slugsnack Grandmaster Cheater Supreme
Reputation: 71
Joined: 24 Jan 2007 Posts: 1857
|
Posted: Fri Jul 17, 2009 3:44 pm Post subject: |
|
|
wahoo
thanks banme but pipe is so much better for what i want now i got it working : )
|
|
| Back to top |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
Posted: Fri Jul 17, 2009 6:21 pm Post subject: |
|
|
I was using a console in as a 'log' in one of my programs a while ago. If WriteConsole is too restrictive, you can use freopen to redirect it.
printf is certainly nicer than WriteConsole.
|
|
| Back to top |
|
 |
Slugsnack Grandmaster Cheater Supreme
Reputation: 71
Joined: 24 Jan 2007 Posts: 1857
|
Posted: Fri Jul 17, 2009 6:41 pm Post subject: |
|
|
| freopen seems to do basically what pipes do o_O
|
|
| Back to top |
|
 |
HomerSexual Grandmaster Cheater Supreme
Reputation: 5
Joined: 03 Feb 2007 Posts: 1657
|
Posted: Fri Jul 17, 2009 7:29 pm Post subject: |
|
|
can you post / pm me the source to the piping. I wanna see how its done
_________________
|
|
| Back to top |
|
 |
Slugsnack Grandmaster Cheater Supreme
Reputation: 71
Joined: 24 Jan 2007 Posts: 1857
|
Posted: Sat Jul 18, 2009 2:31 am Post subject: |
|
|
http://9dt.zwit.org/
sorry it's not a direct link, i don't want googling my website's URL make it appear on dozens of hacking forums since i'm using webspace provided by my uni : |
there is a small 'bug' in the code in case you can't see it btw. so when createprocess is called it creates cmd.exe with commandline parameters to make it call PING.exe. now the problem is i am using terminateprocess to close the cmd.exe. however the PING.exe remains....... i don't even know how to get rid of that short of enumerating processes and finding it. i tried to enumerate windows and getwindowthreadprocessid and openprocess but there were no matches to the handle returned by createprocess. what i originally intended to do was if i got the window to send it a wm_close message which should make it properly terminate ping.exe as well
i was also thinking of piping 'ctrl-c' and the string 'exit' back to the console but haven't gotten around to that yet, i'm sure there must be an elegant solution to this
either way this should give you an idea to how piping works, it's really really simple as you can see
//edit : about to edit it. there IS an elegant way haha. there is no need for the cmd.exe. i could just createprocess on ping.exe straight off
|
|
| Back to top |
|
 |
|