I am coding in C not C++. How can I transfer focus to the glut window from the Windows Dos windows? I can do it now by clicking with the mouse in the glut window but would like to just have it happen when the glut window opens. I use glut’s keyboard to stay focused on the glut window.
This is not an answer, but may be an option if you don’t want to have dos window at all:
Q36: How do you avoid the Console window appearing when you compiler a Win32 GLUT application with Microsoft compilers?
A36: Try using the following Microsoft Visual C compiler flags:
/SUBSYSTEM:WINDOWS /ENTRY:mainCRTStartup
These are linker options… if main or wmain are defined, MSVC build a CONSOLE app by default; hence the need for /SUBSYSTEM:WINDOWS. if /SUBSYSTEM:WINDOWS is defined, MSVC expects WinMain or wWinMain to be defined; hence the need to /ENTRY:mainCRTStartup (eg the entry point is the usual C main).
stdout/stderr are [apparently] not “attached”; output via printf is simply “eaten” unless redirected at the command-line or by a parent program.