 |
|
 |
I test on 2TB Virtual Disk,it simulate a 2TB disk,1024,2048,4096 bytes/secotr,this app can not work.I found it on http://www.2tdisk.com
|
|
|
|
 |
|
 |
When CMainFrame::ShowSplitter( FALSE ); is called (i.e. show only the m_pStdioView window) then you get a memory leak when the app is closed.
This happens even if CMainFrame::ShowSplitter( TRUE ) is previously called.
I haven't yet fixed or found out how to fix the problem but somewhere a child window list is getting an entry deleted; putting a breakpoint in CQuickView::~CQuickView() only stops once after CMainFrame::ShowSplitter( FALSE ); is called.
Sorry for the small amount of info, but at least you will now know where the memory leak is coming from.
Karel
Added this:
Adding m_pStderrView->SetParent(this); to the else void CMainFrame::ShowSplitter(BOOL bShow) clears everything up.
{
m_pStdioView->SetParent(this);
m_pStdioView->ShowWindow(SW_SHOW);
m_pStdioView->SetDlgCtrlID(AFX_IDW_PANE_FIRST);
SetActiveView(m_pStdioView);
m_pStderrView->SetParent(this);//karel
}
Obviously SetParent calls the parent and adds the caller to a list of children.
modified on Friday, June 10, 2011 4:26 AM
|
|
|
|
 |
|
 |
Thank you for a wonderful program (and solution)!
I have been trying to do just what QuickWin does for a couple of months now and only met with partial success.
It all started with Microsoft's own code for "Creating a Child Process with Redirected Input and Output".
(http://msdn.microsoft.com/en-us/library/ms682499(VS.85).aspx)
Then I added in the code from 'Cedric' at stackoverflow.com (March 5th post) for his StdOutRedirect class and its code.
I was able to get stuff working until I wanted to bring everything together under a Dialog-Based application (Visual Studio 2008).
Never could - but QuickWin proves that you can!
Now I have to pull *your* code apart to see how you do it!
BTW, under Visual Studio 2008 there are two mods that I had to make to your code out-of-the-box to get it to compile and execute properly.
They were solutions found in these posts:
------------------
Airpatrol 4/24/04:
Modify the following functions:
void CRedir::OnChildStarted(LPCSTR lpszCmdLine)
void CRedir::OnChildWrite(UINT OutputID, LPCSTR lpszOutput)
The line CFrameWnd *pFrame = (CFrameWnd*)AfxGetMainWnd();
should be changed to
CFrameWnd *pFrame = (CFrameWnd*)AfxGetApp()->GetMainWnd();
------------------
and
------------------
seclib 2/6/04:
change
LPRESULT CQuickWinApp::OnStdioCommand(WPARAM wCommand, LPARAM lParam)
to
void CQuickWinApp::OnStdioCommand(WPARAM wCommand, LPARAM lParam)
and change
afx_msg LPRESULT OnStdioCommand(WPARAM wParam, LPARAM lParam);
to
afx_msg void OnStdioCommand(WPARAM wParam, LPARAM lParam);
------------------
Again, I can't thank you enough for sharing this code with the rest of us.
-Matt
|
|
|
|
 |
|
 |
Under Windows XP,when I drag and drop a file into QuickwinView window of the app.How can I fix it?And not like microsoft write.exe add a ole object,I want to overide the action to run the droped file app?
|
|
|
|
 |
|
 |
I built this application in Visual Studio 2003.
After some troubleshooting, I found that the console text was using \r\r\n to end a line. The Rich Edit View no likey this format. If you want a quick fix add the following line in CQuickView:Append(LPCTSTR lpszStr)
strText.Replace("\r\r\n", "\r\n")
Otherwise, anyone have any ideas why compiling in VS2003 and running it on XP might cause this problem?
|
|
|
|
 |
|
 |
This is a great test program I've been trying to solve a problem using it, so far to no avail.
I have a win32 console application that I need to spawn for a .net project, similar to your project.
I need to be able to clean up nicely by sending the win32 console application a WM_CLOSE, CNTRL-C, or a quit command over the pipe. The console application is a single thread, and currently uses kbhit() to detect if it should process data on stdin. Of course as it happens kbhit() does not work on stdin when it is a pipe.
getch() works, but blocks the console application from doing work, so I need a kbhit() replacement that works in this situation to send a close command over the pipe, or I need a way to send a cntrl-c or WM_CLOSE to this child process.
Any ideas would be great!
-M
|
|
|
|
 |
|
 |
How would you send an ALT-] keystroke to the console using this class?
KFD
|
|
|
|
 |
|
 |
Can QuickWin be adapted for VB.NET. DLL wrapper?
|
|
|
|
 |
|
 |
Hello
I am coding a version for C#. However I have the problem that the application throws
"An unhandled exception of type 'System.NullReferenceException' occurred in Unknown Module."
So far I have no clue what the problem is. To get Redirect class working on C# front-end I created a DLL where Redirect lives and linking from C#
|
|
|
|
 |
|
 |
As a follow up of my previous post, it seems that my callback delegate I pass to native code is garbage collected, then app dies. Even if I keep a private member reference to it, app dies when outputting lot of text. Say, when you do 'dir /s' from C:\
No solution to this yet =(
|
|
|
|
 |
|
 |
Sorted out!
gprodri, I think converting from C# to VB is not too hard now. Get in touch if you still hold the request.
Greetings
|
|
|
|
 |
|
 |
Thats Great! Could you post your C# code.
|
|
|
|
 |
|
 |
Hello
Sorry I didn’t reply sooner but I was away. This is the C# code. Beware that it is a very simplified version of the one exposed in this article. But I think it is better so you can convert it to VB.NET and add your own features.
Now, the solution I am using is creating a DLL that handles the redirection part (coded in C++) and C# handles the front end. It might be a better solution (pure C# perhaps?) so any suggestion is very welcome.
The solution includes two files (DelegateGenerator.cs and Reflector.cs) I took from Jecho Jekov’s article http://www.codeproject.com/dotnet/Cdecl_CSharp_VB.asp (which includes VB explanation)
Instead of posting here the code, I add this link to the whole solution so you can see the whole thing. It works in VS 2003, but in VS 2005 it doesn’t due to some problems with DelegateGenerator.cs and Reflector.cs files. A solution is included in Jecho Jekov’s article though.
If the link brakes, please let me know.
http://www.xretro.com/software/XConsole.zip
Hope this help
|
|
|
|
 |
|
 |
Hi all,
is there anyone that knows how to send a ctrl+C or a ctrl+break to the child console application ?
I've tried with the GenerateConsoleCtrlEvent but a processo group ID is needed and I'm not able to provide one.
Thank you in advance for any hint...
michele, axel
|
|
|
|
 |
|
 |
If it's your own console app (and you have the source), use 'signal()' and specify which signals to handle. If you want to generate a signal , call 'raise()', indicating which signal you wish to send to the process that has focus.
See Help in your IDE for both cases.
|
|
|
|
 |
|
 |
Hi all,
I have problem with redirect output form time critical application. I used to redirect output to file by windows pipe. But now I want to put it into memory buffer and send it to socket. When I use redirect class every time when ReadFile is called it return 4182 characters in buffer and my application is suspended for a while (time critical so … ) Anyone know how to extend this? Why 4182 bytes is a highest value? I already changed BUFFER_SIZE to 10240 but it doesn’t help always is 4182 bytes.
Cheers
Mariusz
Mariusz G.
|
|
|
|
 |
|
 |
I'm trying to simply get the output text from defrag.exe. How can I do this?
CRedirect defrag;
defrag.StartChildProcess("C:\\Windows\\System32\\defrag.exe C: -a",1);
LPCSTR myText;
while(defrag.IsChildRunning())
{
//need to get the text in here, code below does not work
defrag.OnChildStdOutWrite(myText);
}
|
|
|
|
 |
|
 |
First of all I would like to say that this peace of code is just very nice.
The class CRedirect is asserting on line 173 (on ::TerminateChildProcess()).
It is possible to see that even using the sample application if compiled in DEBUG mode.
Is there a way to fix this?
Best Regards,
Crercio O. Silva / DBTools Development
http://www.dbtools.com.br
-- modified at 12:08 Sunday 28th August, 2005
|
|
|
|
 |
|
 |
I have a win32 console application which sends a file to a terminal, it displays its progress as percentage of completion. I tried to run it using QuickWin, it runs properly but when its execution duration is not long, QuickWin displays its output after process termination, and if it is long, it displays its output with long delay. I want to process output of this application and display it on a progress bar in my app, how can I solve this problem to do that?
|
|
|
|
 |
|
 |
I found a tricky solution which may be usefull for anyone having my problem.
My console application uses standard COM ports for sending or receiving files. So I calculated real send/receive speed for a typical file using a special transfer speed (38400bps for example), so I ran my console application using this code, and waited until OnChildTerminate sends me termination signal while showing the user a progress bar in my OnIdle in the App class [or OnTimer in the CWnd derived class] which only checks time intervals. When OnChildTerminate signals console termination I check termination message, if it consists of an "Error" word I send an error to user and if not, my program does its normal tasks. This method helped me to hide console window and prepare a more user friendly environment for my users.
However this method works fine only when I have enough information about the file which is transfered (its size I mean) and I have this one only when I want to send a file. So while receiving I show the user a busy bar which shows him/her a file transfer is running.
|
|
|
|
 |
|
 |
I turned to your class because I couldn't get telnet.exe to work with my own code. But appearently it doesn't work with yours either. Do you know why this is? My guess is security, but perhaps a more subtle problem is the cause.
|
|
|
|
 |
|
 |
Hi,
I used to have the same issue on Unix (SUNOS 4) with telnet.
This is due to the fact that the application uses the POSIX function istty() to check that the stdin/stdout files are real terminals, and not pipes or files.
The solution then was to use special /dev files named pseudo-tty, but I am affraid this was a platform dependant solution tied to SUNOS/Solaris.
But, what is the point to remotely control telnet ?
I tried to do that because I was in first year of computer science school, and I wanted to write an application able to send fake email .
A few months later, we learn a new thing called sockets that made this a lot more easy
Seriously, you should consider using your own socket application. It is very easy, and you can found very well documented samples on this very website (try searching "TCP IP Server" and you will find both server and clients (like telnet) samples).
Eric
"If it is not broken, do not fix it"
|
|
|
|
 |
|
 |
I have a program that calls an external program and I want the output of the program to be redirected to a file. Unfortunately, the external program reads the redirect symbol '>' as an input parameter and fails. The external program prints output to the command window without fail, but I want to redirect this output to a file. How do I do that? Any way to redirect quickwin output to a file without manual user intervention? Jim Roeb
|
|
|
|
 |
|
 |
i am trying to figure out how to go from a win console to wince. the prog is a simple calculator type program. I just want it to have approx. 30 fields that will take my variable data as the user goes through the fields and perform the calculations as i have them in the console prog. I have downloaded the free embedded vs from microsoft along with the correct srvc pak and emulator. i have tried to do a win32 app but keep having problems with tutorials and "graphics.h" not being recognized in my msvs 6.0 as well as dev-c++. A great big thanks in advance to anyone who can help me or guide me in the right direction
|
|
|
|
 |
|
 |
The program looks well done, compliment!
But I think that another subject could be even
more useful... redirecting output of your own
app!
It is feasible, there are a couple of articles
about that in codeproject, but some issues still
need to be considered, like spawning a separate
interface thread in case of lengthy jobs called
by main interface thread (not good programming,
actually) and avoid iostream buffering...
Just a few thoughts...
Merry christmas!
|
|
|
|
 |