Hi everybody.
I would like to build a little encoder application that uses CMD line executeables to do the work.
A problem i havent found a solution to, is how to get the contents of a CMD prompt in progress.
Alltho i TOTAL noob in C++ , i managed to create another .dll application once for a game, that did something like it. (getting text from game console) and it was using WM_GETTEXT
So, i'm convinced that i can use WM_GETTEXT in c++ to get the contents of 8any) window.. but i dont' know exaclty how to.. =/
Any pointers would be highly apreciatedCode:Here's the fundamental stuff of my old similar project #include "dll.h" #include <windows.h> using namespace std; #pragma warning(disable:4129) #define PARENTWND "Console" #define CHILDWND "Edit" #define MAX_BUFFER 16384 #define CR 13 #define LF 10 static HWND hwndParent = NULL; static HWND hwndEdit = NULL; static HWND hwndConsole = NULL; void SetWindowHandles(){ hwndParent = FindWindow(0, PARENTWND); hwndEdit = FindWindowEx(hwndParent, NULL, CHILDWND, NULL); hwndConsole = FindWindowEx(hwndParent, hwndEdit, CHILDWND, NULL); } char* GetTextFromWindow() { SendMessage(hwndConsole, WM_GETTEXT, (WPARAM)sizeof(consolestream), (LPARAM)consolestream); return consolestream; } int main(){ SetWindowHandles(); }
Try StreamFab Downloader and download from Netflix, Amazon, Youtube! Or Try DVDFab and copy Blu-rays!
+ Reply to Thread
Results 1 to 6 of 6
Thread
-
-
There's a possible solution here, but I'm wondering why it is you want to capture the output in the first place. If you want to show progress, then why not just bring the cmd window into the foreground. Or is it for some other reason?
Also, if you're going to be using command line tools for all the work, then why not just write a batch file, rather than diving in to C++. Check out the link in my sig for an example.
Slainte
middersVolunteer for https://www.computersforkids.org.uk/ -
Originally Posted by midders
-
Google search for "redirect stdout to a textbox"
Donadagohvi (Cherokee for "Until we meet again") -
Originally Posted by freebird73717
Originally Posted by jagabo
A quick fix solution would be to run the command line tool in a child window of your main application; then you can move the window around, change it's size and colour etc. however you like. -
@squadjot
redirect these output streams to files in a command window are ineffectual
http://forum.lazarus.freepascal.org/index.php/topic,43411.0.html
-> GoTo: "RunFFmpeg".
This App is written with the Lazarus-Component-Library (LCL) and FreePascal (FPC), but it works the same Way with C++.
If You want it really nice & fast, You have to open the File via the FFmpeg-Libraries themselves, as shown
in the ScreenRecorder2FPC-Example, above on the same Site.
BTW: I saw, that this Thread is really very, very old, but
it's pending since then, though that Issue is still up-to-date.FFmpeg based FFPlay4Laz + FFGrab4Laz - RunFFmpeg.
Similar Threads
-
how to run as admin in CMD in Windows XP?
By jyeh74 in forum Newbie / General discussionsReplies: 7Last Post: 29th Jan 2010, 18:26 -
wildcards in cmd
By cL0N31 in forum ComputerReplies: 6Last Post: 3rd Apr 2009, 20:58 -
why does ffmpeg progress go to 1000+%?
By jsegel in forum ffmpegX general discussionReplies: 1Last Post: 8th Oct 2008, 22:14 -
Video info tool (cmd-line-way) wich one?
By squadjot in forum Video ConversionReplies: 2Last Post: 19th Sep 2008, 14:01 -
Are there any ffmpeg builds that will read VirtualDub frameserves ?
By vhelp in forum Video ConversionReplies: 6Last Post: 1st Aug 2007, 02:00