Portable way to hide console window in GLUT application? - c++

Hey, I'm creating a little GLUT application and need help with hiding/removing the console window.
I am developing on windows and I already know of the various methods to hide the console window on a windows system, however is there no portable method of hiding it?
Thanks...

You don't really want to "hide" the console window. What you want is to configure your compiler to generate a "Windows application" instead of a "Console application". That will tell windows to never create a console for your application. You'll need to consult your compiler's documentation to figure out how to do that. For Visual Studio, it is a step on one of the wizards.
There isn't really a good way to control the console inside of a console application. The console is designed so that the application knows nothing about it. While it is possible, as you said, it's not very portable or clean.
The correct approach if you need fine-grained control over the "console" is to implement your own window which provides a text output area where you can print things. Then you can do pretty much anything with your "console" because it isn't really a console, it's just another window owned and operated by your application.

Related

How does Qt program monitor keyboard while hiding?

I create a Qt program and it normally stay as a tray on the right bottom of the screen. I need to use keyboard to active it, such as CTRL+ALT+A. But I can not find way to implement it. I searched a lot of information and it seems that using native windows API helps.
I'm here asking is there anyone knows how to do this with Qt or with windows API.

Prevent a Windows app from stealing the focus

I have created a windows application in C++ and I want to make so whenever I run it, it doesn't steal focus from whichever window is currently focused(or maybe steal the focus and give it back right away). I'm not creating any window so i'm not sure how to change the window style, my program runs in the background.
I couldn't find any answer that worked for C++, is there any way I can do this?
When you start your application by clicking on the EXE or shortcut, Windows Explorer takes focus, not your app. The only way to start your app and not let Windows Explorer take focus is to start your program when Windows starts, via registry key.
Make sure you use the extended style WS_EX_NOACTIVATE when using CreateWindowEx().
See the Microsoft Docs for CreateWindowEx.

Make a custom taskbar and shell area for my own custom explorer program?

What I would like to do is to create my own custom explorer instead of windows explorer.exe but I would like to be able to create my own taskbar with the active programs and the shell area with the icons as well.
I looked online for a day and can't find anything out about. My main language is c++ and I am very familiar with the windows api calls, resources, and even extracting resources from dlls as well.
I just don't know how to start with the task bar.
Like I said I want to be able to make my own explorer program for windows with the taskbar and all.
I just don't know where to look or start.
Thank you all :)

Is it possible to embed a command prompt in a win32 app?

In linux and when installing packages etc. There are some installers that have a progress bar and a dos window which shows the files being extracted etc. How can i add this window to my C++ Win32 programs so that i can have it showing the tasks im doing? I cannot find any documentation on MSDN.
Question: How can i add a console window (if that's what its called, sure looks like one) in my program to show the details of the task at hand being done?
Here is a window with what i am asking.. (personal info so I erased the details. :]
You cannot embed a real console window inside another window (although a windowed process can have a separate console window). While it looks like a console window / command prompt, it is just a matter of appearances. What you want to do is create a sub-window/control with similar characteristics as a console window and then redirect the console output from the application(s) being run to append to that sub-window. For more information on how to do redirect the console output in Windows, see http://support.microsoft.com/kb/190351.
That "dos window" is a regular edit control: CreateWindow(ES_MULTILINE, EDIT, ...
However, it has the font set to a fixed-width one (Looks like courier). This is done by sending WM_SETFONT to the edit control.
#user995048 says "You cannot embed a real console window inside another window". But "cannot" is a strong word! I can run an entire virtualized computer in a window if I wish. :) So one can quite reasonably intuit that there are ways of doing what you say.
Sure, it is true that what you've seen are almost certainly cases of output redirection into a custom widget, designed to mimic the simple appearance of a terminal. However...if you want to embed one application's window inside another, there are things you can look into which might fit. Cooperative methods exist like GtkPlug, for instance:
http://developer.gnome.org/gtk/2.24/GtkPlug.html
To actually capture a not-designed-to-cooperate app's window and throw it in your app would be trickier. But possible, just as screen captures and virtual machines are possible. Probably best to avoid that sort of thing unless there's really a cause for it, though...
Try this
http://www.codeguru.com/cpp/misc/misc/article.php/c277/
link. I think the solution provided is what you need.
I tried it many years ago and it worked. I have not tried it in newer versions of windows though.

Is there a way to make the MFC app work both ways console as well as Window

Is there a way to make the MFC app work both ways console as well as Window.
Yes, although it is slightly complicated. You would call AttachConsole(), instead of creating any windows, when you want to run as a console app.
No, this can't be done! There are way to achieve more or less the same result though. Here's the authoritative source: Link .
depends which mfc class are you using.! you can run MFC program both Console and Windows.
However it totally depend upon what you going to program, which is not clear from your question.
I have programmed window application written in MFC to run both in Windows and console application, but that is project related requirement.