New console window when developing in the repl - clojure

If I'm developing, let's say, a console text editor, how could I call a new console frame from the lein repl? (or any repl)
If it's called (main "file.txt") from the repl it would be 'popped' a new console window with the the file.txt content where I could edit.

Related

How can I output to the parent console window from a Win32 C++ application?

I have a WinAPI/Win32 application. If I try to use cin/cout/cerr when it is run from a command prompt, it doesn't work. I tried switching the project type from Windows Application to Console Application, but the problem is that a console window appears when I run it normally by double-clicking the executable.
So my question is: Is there any way I can use cin/cout/cerr with the parent (calling) console window in a Win32 application? (I only want this behaviour if parameter /c or /? were passed, so if it is called with no arguments then no matter what it should launch the GUI).
A GUI app does not have a console window attached to it by default.
When a GUI app is run from a console process, the GUI app can use AttachConsole() to attach itself to the console.
Or, if the GUI app is not run from a console process, but still wants to use a console window, it can create its own console window using AllocConsole().
Once the GUI app is attached to a console, it can use GetStdHandle() to get handles to the console's STDIN/STDOUT, and then redirect cin/cout to use them (how is dependent on your particular STL implementation).
Or, you can ignore cin/cout and just use ReadConsole() and WriteConsole() directly instead.

Paste From QT Window to Another Application Input Widget

I am very new to C++ programming and the bulk of my program will be using the QT libraries. However, there is one part where I believe I will need to use Win32.
The scenario I want to code for is as follows:
I will have a QT application running. I want to be able to take some text which has been typed into a TextBox on the QT Window and paste that text into a TextBox in another application e.g. the address bar of Chrome, the address bar of Windows Explorer.
I want to be able to do that as a response to a button click on the QT Window. So, it would all happen in 3 steps. For example:
User types text into QT Window;
User places cursor in address bar of Chrome (Browser);
User clicks button on Window which pastes text into address bar of Chrome.
A nudge in the right direction would be most appreciated.
Edit - Additional Info
The application I’m building is a self-set assignment. I want to build a clipboard manager, similar to this old Delphi application http://www.joejoesoft.com/vcms/97/ . It will run in the system tray, in a minimised state.
The user, will put their focus into a text input in some application
which is running on their Windows machine e.g. Notepad.
Then, they will hit a hot key combination which will open a form (my QT Window.
The application will have been collecting clips as the user presses Ctrl-C (or by right-clicking) and those will be listed in that QT Form (just like the app in the link above).
The user then clicks on the particular item that they want paste and it will be pasted into the original input that they had put the cursor into.
Further Edit - further info
I'll break step 4 into a couple of sub-steps as it is causing confusion:
The user then clicks on the particular item that they want paste
Focus changes from QT Window back to the window of the other Win32 application which originally had focus
Content is pasted into the input control which now has the focus
I pretty much know how I can gather up items when the user copies things. But I have no idea how I will paste from my application to the target application.
Cheers

GUI app with redirected stdout stream doesn't return control back to the console

I have a GUI Windows application written in C++ (with MFC) that attaches itself to a parent console for an output via stdout stream. It uses the AttachConsole API and the RedirectIOToConsole method described here.
So if I call the following line from a regular console application (that natively has the output to stdout):
_tprintf(_T("Test message.\n"));
I get this output that I'd expect:
But if I call the same line of code from my GUI app (with an attached parent console) I get the following, except that the control doesn't seem to be returned back to the parent command prompt window (see red circle):
Note that I can type into the parent command prompt window, so it's not hanging, and if I hit enter it will execute whatever I typed as a command.
So what have I not called from my console app to return control back to the parent console?
It's not about returning control.
When you run a console application from a command prompt the command prompt waits until the console application finishes, so you see the output from the console application followed by a fresh prompt, as your first picture shows.
When you run a GUI application from a command prompt the command prompt doesn't wait for the GUI application to finish, so you normally see a fresh prompt followed by the output from the GUI application, like this:
C:\>TestGuiProjWithOutputToConsole
C:\>Test Message.
_
As you've noted, nothing has gone wrong. You can type commands and they work, it's just that the prompt has appeared in the wrong place.
Your second example doesn't show the second prompt, maybe because you've got a carriage-return character so the prompt is being overwritten. Try outputting a newline before the test message and you should see the prompt (though still in the wrong place).
You can tell the console to wait for a GUI application by running:
start /wait TestGuiProjWithOutputToConsole
In short, GUI applications don't play well with the command-prompt because they are both running at the same time outputting to the same console so their output is jumbled up.

Open console inside gui application

I'm trying to create a program in C++, which open with him, within the form, the CMD, so that I can run a program within the CMD that is inside the program. As an example, in this photo:
I found some examples, but could not implement them in code, so, I ask your help... To be more precise, I want to create a function in a dll, so I can call this CMD, starting from any language
basically an embedding a Console
I see two methods:
Write your own console widget and pass all entered command to the std::system command
Do what is described in How to open a console window in a Win32 application

How do I open a new window on start up using C++?

I don't know how to make a window when I start up Windows. I just want a simple window that has some text in it, such as a reminder. I don't want to download anything, and I think C++ is the easiest way to do it.
The easiest way to display a window with a message in Windows would be use use VBScript. Create a text file with the following in it.
msgbox("hello world")
Now, name the file MyProgram.vbs or anything else with a .vbs extension.
Double click on the file to run it. The message "hello world" should be shown in a small window on your screen. As seen in the image below.
To run it at start up, just drag it in your Startup folder in your Start Menu.