Can a Win32 console application detect if it has been run from the explorer or not?

See http://support.microsoft.com/kb/99115, “INFO: Preventing the Console Window from Disappearing”. The idea is to use GetConsoleScreenBufferInfo to determine that the cursor has not moved from the initial 0,0 position. Code sample from @tomlogic, based on the referenced Knowledge Base article: // call in main() before printing to stdout // returns TRUE if program is in its …

Read more

Groovy console can’t “remember” any variables – always says “unknown property”

This is standard behavior in the Groovy shell, not peculiar to the Grails shell. You probably don’t want to def the variable. See the following: ~ $ groovysh Groovy Shell (2.3.4, JVM: 1.7.0_45) Type ‘:help’ or ‘:h’ for help. ——————————————————————————- groovy:000> def x = 42 ===> 42 groovy:000> x Unknown property: x groovy:000> y = …

Read more

Custom text color in C# console application?

The list found at http://msdn.microsoft.com/en-us/library/system.console.backgroundcolor.aspx I believe are the only supported colors in console. No hex allowed. Black DarkBlue DarkGreen DarkCyan DarkRed DarkMagenta DarkYellow Gray DarkGray Blue Green Cyan Red Magenta Yellow White EDIT Get the working project files off my public Repo https://bitbucket.org/benskolnick/color-console/ But on further investigation you can do a lot of work …

Read more