Terminal Widget for MFC/Win32 applications? - mfc

I need a terminal Widget which is able to emulate a windows console and a simple VT100 terminal on Windows. Something like VTE for GTK or QConsole for QT.
Is it even possible to run a Windows Console like cmd.exe inside a child window?

Usually a "console" or Terminal hooks up at a rs-232 interface. cmd.exe is AFAIK a native application only acting like a command line interpreter. Therefor you will not be able to use it in an child window.
Do you need a terminal emulator that communicates with a VT100? If so, there are tons of out there. If you want to write your own Interface take a look at the
Windows PowerShell API.
Another great Open Source Project for achieving something you want is PuTTY for Windows under MIT License. You could communicate with the VT100 using Telnet. The Windows Telnet client should be accessible using PowerShell.

Just call AllocConsole to create your own console window. You can use the normal console mode CRT functions to read and write from/to it. A more GUI friendly approach would be to just create a window with a multi-line readonly Edit control with a fixed-pitch font.

Related

How to use Windows C++ AttatchConsole with Cygwin terminals

I have a c++ windows application that runs via a GUI. I made a CLI for it to automate some things and this works fine if I use
AllocConsole();
or even
AttachConsole(PID);
as long as it is attaching to a windows CMD terminal.
I want to attach to a Cygwin terminal so I can use Expect to automate some things, but attach console always fails here and results in errors when trying to write to it.
Does anyone know how to make a windows application attach to a Cygwin terminal like this?
Not all cygwin terminals use the windows console. If you are not using a windows console then AttachConsole simply will not help you.
In particular a mintty.exe terminal will not work with AttachConsole because it is not a windows console.

How to programmatically get current directory of a Windows command line or Windows explorer?

I'm writing a Qt C++ program on Windows and it has registered a global shortcut Ctrl+j. Whenever the user press Ctrl+j, the program's UI will show up. When the active window is a Windows command line or a Windows explorer and the user presses Ctrl+j, I want to get the current directory of the Windows command line or a Windows explorer. Is that possible?
For Windows Explorer you can write a BHO and communicate with it from your application. BHO - Browser Helper Object - will load into Windows Explorer process and can access anything, e.g. windows handles, text in the textboxes etc. We've done this for Internet Explorer.

Stopping the explorer.exe taskbar from opening when using the windows file explorer on XP

I am creating a shell-replacement for developers, which creates a new windows user, titled "developer" and only when you log into this user, should the shell be launched.
The replacement start menu is replaced with a shell based terminal with great features, the taskbar is replaces with a tree based view for windows, and the process monitor is replaced with a view where you can attach process monitors, debuggers, profiles, and memory leak detectors, etc.
I would like my application replace the regular windows shell. I have however came across a registry key that, on windows 7, works just fine. but on windows XP if I use the regular windows XP file manager the windows XP task bar from explorer.exe launches, even though I changed said registry entry!
Does anybody have any idea what it is I need to do to fully replace the windows shell AND taskbar using windows XP while still retaining use of the windows based file manager?: )
Edit:
Using C++, developing using NetBeans using Qt for my gui library. however, as I do not think this should effect the answer, I figured I would include it either way.
I believe Windows XP does not support per-user shell replacement (not sure, it's been a while since I played with the desktop stuff), but you should be able to set the 'Shell' entry under HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon and prevent Explorer from registering itself as the shell when it first runs. This will affect all the users in the machine, of course.

how to add in Visual Studio 2010 WinForm Object to a C++ Console Application Project

I am building a C++ Console Application which makes some OpenGL printing.
The entire thing is done by glut and gl libraries. My new goal is to add some Windows Forms to the project so one could "configure" the 'game' with some textbox and other controls provided by VS before the console appliction starts.
I know that the best solution for the current problem is to add Win32 API, but I don't know how to integrate console application project with win32 API alltogether.
I know that in C# it's done quite easily with the .ShowDialog() command.
Although launching a window from a console application is perfectly doable, that window will not be responsive, because your console application does not have a message queue. (Or rather, it has a message queue, but it is implemented by code that you have no control over.) So, you can open up a window, draw in it, and force it to manually update, but you cannot receive user input in it.
I would suggest that you forget about doing it this way, and you write a little windowed application instead, which prompts for the configuration and then launches the console application passing it the configuration as command-line parameters, or fills-in a configuration file for the console application to read.

AIR NativeProcess API

I use nativeprocess api in AIR to launch a c++ console app. The console app runs correctly but does not appear, but I want it to be visible and user be able to interact with it. How can I achieve that?
Instead of launching your executable directly, you'll need to launch your platform's terminal application (on Windows, that's CMD.exe, on OS-X it's Terminal.app, and on unix/linux it's xterm).
By default, the terminal application will run an interactive shell prompt, but you can use command-line arguments to tell it to execute any other program instead. In this case, you'll want to tell it to execute your C++ console application.
On Windows, this might look something like this:
CMD.exe /K C:\path\to\your\app.exe
on OS-X, it's a little more complicated. Here's a related S.O. post ( Running a command in a new Mac OS X Terminal window)