|
 |
|
|
 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?
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
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?

|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
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
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
|
 |
|
|
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#
|
| Sign In·View Thread·PermaLink | 1.00/5 (1 vote) |
|
|
|
 |
|
|
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 =(
|
| Sign In·View Thread·PermaLink | 2.00/5 (1 vote) |
|
|
|
 |
|
|
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
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
|
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 
|
| Sign In·View Thread·PermaLink | 2.00/5 (1 vote) |
|
|
|
 |
|
|
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
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
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.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
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.
|
| Sign In·View Thread·PermaLink | 1.50/5 (2 votes) |
|
|
|
 |
|
|
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); }
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
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
|
| Sign In·View Thread·PermaLink | 2.00/5 (1 vote) |
|
|
|
 |
|
|
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?
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
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.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
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.
|
| Sign In·View Thread·PermaLink | 1.67/5 (3 votes) |
|
|
|
 |
|
|
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"
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
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
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
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
|
| Sign In·View Thread·PermaLink | 1.00/5 (1 vote) |
|
|
|
 |
|
|
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!
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
It's me again.... what could be useful for? Sometimes you use third party libraries that send output to stdout, or you just want to call a "main-like" program inside a windows app, or may be you want to build a simil-command line app for Windows CE, or....
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
That's easy, ask your favorite F1-Key... (o.k., try google before) MSVC 6.0
#include <windows.h> #include <fcntl.h> #include <io.h> #include <iostream>
int main(int,char**) { int old = _dup(_fileno(stdout)); // save old
// redirect to file char const fn[] = "c:\\tmp\\test.txt"; FILE * f = fopen(fn,"wt");
_dup2(_fileno(f),_fileno(stdout)); // switch
std::cout << "hello file" << std::endl; // write to file std::cerr << "hello err" << std::endl; // write to stdout
_dup2(old,_fileno(stdout)); // switch back fclose(f);
// show file std::cout << "from file: " ; system("cmd.exe /c type c:\\tmp\\test.txt");
std::cout << "hello again" << std::endl;
// now to be more sophisticated, pipes int handles[2]; _pipe(handles,2048,_O_BINARY); // create read/write pipehandle _dup2(handles[1],_fileno(stdout)); // switch to pipe std::cout << "hello pipe" << std::endl; // write to pipe std::cerr << "hello again err" << std::endl; // write to stdout _dup2(old,_fileno(stdout)); // switch back
// read from pipe, may have own thread, write screen _and_ file char b[1024]; b[0]=0; int n= _read(handles[0],b,sizeof b); b[n] = 0; std::cout << "read from pipe: " << b << std::endl;
return 0; }
Greetings, Michael Bruschkewitz
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Very neat code indeed, but.... it does not work on a Win32 Application (even right after WinMain) I really don't have a clue.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |