Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#
hey guys,
 
if you read my last question, i am making a game, but i also need to know how to make multi console windows interact with each other. like if i were to do something, in the main window it would keep the data of what i just did, but then another would write something to the screen. the reason i want this is because of making my inventory, i want to have the main window with the game and all the data stored in there, but i want the other window to show my stats and my inventory.
Posted 6-Oct-12 16:29pm
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Multiple consoles are not supported. According to the MSDN doc's on the Console API, a process can only have a single console attached.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

The answer is no and yes. No, because windows does not allow a process to have multiple consoles, and yes, because you can achieve the same result with some not so complicated tricks. This article is describing how to do it in c++: Multiple consoles for a single application[^], but there are ways to use it from .net or transcribe it to c#.
  Permalink  
Comments
Maxim Kartavenkov at 8-Oct-12 0:41am
   
Wow, you found an article which is described same stuff as I did in my solution. Are you reading that article or you just google and then copy link here, bcs why you downwove mine solution if it describes the same way? You are only found the proof that my solution is works fine. For you seems posting solution means to put any link in answer. I always describing the solution based on my experience and only if that's not enought explained I put the links.
Zoltán Zörgő at 8-Oct-12 2:06am
   
1) Why do you think I have downwoted your answer? Since I did not.
2) Your answer is the idea, not a method how to do it.
3) And yes, I have that that article, and that is why I have posted it. Because it is a way to do what you drafted.
+1) Don't take things so personal!
Maxim Kartavenkov at 8-Oct-12 2:18am
   
Why it is not method? bcs it is not described as an article? You should specify that is related to mine stuff or even just make the comment but you instead specify the solution.
Not personal - but it looks not good from your side.
Zoltán Zörgő at 8-Oct-12 2:42am
   
I don't want to argue with you. Think what you want.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Hello,
 
The application can have only one concole that's true. But who told that you can do additional application for each console?
Use function CreateProcess and specify your console application path (you may even use the windows application and call AllocConsole API). For comunication with your app you can specify stdin and/or stdout for your child process by using SetStdHandle and comunicate via it. There are a lot of methods for interprocess comunications you can use one of them. For example NamedPipes: you can trite to pipe and signal via shared named event in one application and read in another. Other way is to usage of shared memory: see CreateFileMapping API. Plus using the thread handle you can check if child process alive or not. Along with it you can use PostThreadMessage, or broadcast messages registered via RegisterWindowMessage. So just research in that part and decide what is better for your case.
 
For Dave: Same thing as I have seen mostly - the question is "how to", but not the "possible or not". And Same suggestion - Do not provide the solution with the "not supported" "not possible" - that is related only to personal experience. I wonder that someone downvote the question, since what is that, from that point if this is required and you don't know how to implement that? - That's not good - if you don't know the solution leave the question to someone smarter than you and do not show that you can't provide proper answer.
 
Regards,
Maxim.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 CPallini 550
1 Sergey Alexandrovich Kryukov 405
2 George Jonsson 288
3 Pheonyx 218
4 OriginalGriff 200
0 OriginalGriff 4,813
1 CPallini 3,890
2 Sergey Alexandrovich Kryukov 3,274
3 George Jonsson 2,552
4 Gihan Liyanage 2,186


Advertise | Privacy | Mobile
Web04 | 2.8.140905.1 | Last Updated 7 Oct 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100