I have several questions all related to a windows application that also runs as a console application.
In my programs entry point I have logic to determine if command line parameters are being passed in and, if so, I call AllocConsole(). This works well enough but I am curious if it is possible to not pop a new console window. So the expectation is that a user will be calling this from a command window so I would like to have the output from the application go into the window the user is currently working in, not in some other screen. Additionally the console window that is popped via AllocConsole() is less than user friendly. For example if the user miskeys an argument the new window will open, inform the user of their mistake, then the user has to go back to their original window to fix the mistake, and run the command again. Basically I am looking for a more traditional command line experience. Is this possible in my scenario?
The next question is related to formatting Console output. I have read several articles here on SO and on the MSDN but I can't seem to find a good answer. I am currently doing something like this:
Console.WriteLine("{0,0}\t\t{1,10}", item.Key, item.Value);
This works well enough but it is entirely possible that the value in item.Value will be several lines long thus wrapping several lines. I am looking for a more traditional 'table' layout where the text for item.Value would still wrap lines but be confined to its own column and not wrap underneath the value of item.Key. Is this possible and, if it is, what is the best way to go about it?
Thanks!