Click here to Skip to main content
15,895,815 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
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

Multiple consoles are not supported. According to the MSDN doc's on the Console API, a process can only have a single console attached.
 
Share this answer
 
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#.
 
Share this answer
 
Comments
Maxim Kartavenkov 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ő 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 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ő 8-Oct-12 2:42am    
I don't want to argue with you. Think what you want.
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.
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900