News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Multiple consoles

Started by Astro, March 17, 2010, 12:34:34 AM

Previous topic - Next topic

Astro

Hi,

I guess this is less of a MASM question and more of an implementation question.

Is it possible to run multiple consoles from a single application? A bit like multiple terminal session in *NIX?

Best regards,
Robin.

GregL

Astro,

I've never had the need to do so, but I think you could use AllocConsole to create the additional consoles.


Astro

Damn.

QuoteA process can be associated with only one console
OK - IPC it is...

Best regards,
Robin.

hutch--

Robin,

Thats easy, run multiple threads to control multiple consoles and use a master thread to control the console driving threads.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

Astro

Ahh! Great!

Best regards,
Robin.

evlncrn8

Quote from: Greg Lyon on March 17, 2010, 12:45:17 AM
Astro,

I've never had the need to do so, but I think you could use AllocConsole to create the additional consoles.



sometimes its good to read the page first..

"A process can be associated with only one console, so the AllocConsole function fails if the calling process already has a console. "

thus.. multiple consoles = NOT POSSIBLE..which is obvious given that the only way to get the console input / output / error handles is via GetStdHandle..

dedndave


dedndave

the only way i can think of is to execute a seperate process and find some way to communicate back and forth (like file I/O)
so it is possible - just a tad clumsy

when you use AllocConsole, the original console becomes useless - the function almost makes no sense


clive

Quote from: dedndave on March 22, 2010, 06:38:15 PM
the only way i can think of is to execute a separate process and find some way to communicate back and forth (like file I/O)
so it is possible - just a tad clumsy

Or pipes.  http://msdn.microsoft.com/en-us/library/aa365590%28VS.85%29.aspx

Drivers, IPC, or a mapped file view spring to mind too. You could pin the same 4K page(s) between multiple processes.

http://msdn.microsoft.com/en-us/library/aa365574%28VS.85%29.aspx

-Clive
It could be a random act of randomness. Those happen a lot as well.

Astro

Hi,

Thanks for the code/links!

I'm trying to implement pipes as they seem to be the most suitable - just sorting out async I/O to make it work.

The idea is to have a main process handling communication between the pipe (as it will be presently) and a device, and to send commands from another process to it in order to send control commands to both the process and the device.

Best regards,
Robin.

dedndave

Mike (Slugsnack) was doing some cool stuff with pipes a while back
the forum search tool might turn up some goodies