1

I am creating a c# multithread console application, my solution uses +2 projects, 1 as a "main" project, then sub projects as the program's actual functions, however

running a sub project thread runs perfectly, however I would like this thread(s) to open a console of its own,

the only method I am familiar with is launching it separately but that would defeat the purpose of the threading

Cœur
  • 37,241
  • 25
  • 195
  • 267
CybeX
  • 2,060
  • 3
  • 48
  • 115
  • Already answered @ http://stackoverflow.com/questions/1277563/how-do-i-get-the-handle-of-a-console-applications-window – Jay Jul 12 '15 at 18:20
  • I'm not sure if this is possible but it isn't a great idea. Writing to separate files is easy, when you need Windows then use WinForms or WPF. – H H Jul 12 '15 at 18:32
  • @Jay see comment below – CybeX Jul 12 '15 at 18:37
  • @HenkHolterman the application runs fine, but I want =this to create another sperate console for output of the main thread, but still use the main console to run other applications "projects linked in the solution", at the moment, when the main applications output is done and reaches the join, it switches to the sub thread which displays its output, but i want these 2 seperate – CybeX Jul 12 '15 at 18:39
  • @Jay , also, I looked at the link you posted, i might be mistaken but this refers to only the current window, but keep in mind, all application(the whole solution) ouput points to only 1 console, which is what i dont want – CybeX Jul 12 '15 at 18:46

2 Answers2

2

I have discovered the answer, this question has already been answered, but I will answer my own question in a more understandable way

Open a new console with every new Thread in C#?

Refering to the link above, a poster mentioned that each process can have only 1 console associated with it, thus 1 process -> 1 console

thus for each thread a new console has to be created and assigned to the thread, thus creating a new process with in the thread's code

Community
  • 1
  • 1
CybeX
  • 2,060
  • 3
  • 48
  • 115
1

It's not possible for a process to own multiple consoles, so in order to work you need to start additional processes and send data to them (which is not trivial)

A better solution would be to create a winforms or wpf project and create multiple windows. It's much easier, and the way to go...

Philip W
  • 781
  • 3
  • 7
  • thanks for your answer @Phillip W, I posted an answer to this question after having a stroke of luck while doing more googling, seems like this isnt a easy topic to find a solution for... – CybeX Jul 12 '15 at 19:00