Click here to Skip to main content
15,887,267 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
See more:
i have a vb.net console application
but i want to make it open another different console
from a different module if it's possible

What I have tried:

i found a code in c++ but i want it in vb.net

https://www.codeproject.com/Articles/13368/Multiple-consoles-for-a-single-application
Posted
Comments
Dotnet_Dotnet 16-Jan-18 20:51pm    
sir try
Dim proc As New System.Diagnostics.Process()

proc = Process.Start("d:\windows\notepad.exe", "")
ZurdoDev 17-Jan-18 13:23pm    
I suggest posting as solution.
THE-CODER-SALEH 20-Jan-18 11:17am    
i didnt understand what do you mean with posting
THE-CODER-SALEH 20-Jan-18 11:16am    
this code don't open anew console
it opens the notepad application
ZurdoDev 20-Jan-18 11:34am    
But can't you figure out how to change it to open the app you want to?

1 solution

Because this was an interesting question, I did some digging.

A process can only ever be associated with one console. You cannot have multiple console windows open at the same time for the same process. If your process detaches from the existing console and AllocConsole's another one, the first console window will be destroyed.

I know what you're asking. So how does that library do it? The big clue is what I highlighted above. The library launches another process, called ConsoleLoggerHelper.exe, which it then opens a pipe with to talk to it. The pipe is for "inter-process communication". The second process just listens to the pipe for any messages to display in its own console window.

The concept is relatively easy to understand. The implementation of it is bit more difficult. What you have to research is not how to allocate a console window. It's how interprocess communication works over pipes.
 
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