|
First of all... The pipe is represented by the |, and it means that the output of a program is the input of another.
What you mean is simply the redirection of the output to a file. In that case, only one > (greater than) is necessary.
If some.exe > c:\\text.txt using SellExecute doesn't work, by using system("some.exe > c:\\text.txt") should.
Jaime
|
|
|
|
|
> = redirect output
>> = append redirected output
Neither > nor >> work with Shellexecute. I may have to use CreateProcess instead of shellexecute because I am waiting on a single object 'ShExecInfo.hProcess' to give the user a chance to kill the running process.
Everything is already coded with ShellExecute using SHELLEXECUTEINFO and it works great minus not being able to redirect the output to a file... It would suck to have to go back through my code and change all the ShellExecutes to CreateProcess, and I dont think system() would fit my application.
Thanks anyway,
Rob
Whoever said nothing's impossible never tried slamming a revolving door!
|
|
|
|
|
I had to shellexec cmd.exe with params of "/c some.exe >> log.txt"
Rob
Whoever said nothing's impossible never tried slamming a revolving door!
|
|
|
|
|
I'm curious why you are not using handles with the call to CreateProcess() . The hStdOutput , hStdInput , and hStdError members of the STARTUPINFO structure contain handles returned by GetStdHandle() . You can then use ReadFile() to read from the different handles.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
I should have used CreateProcess from the get-go, but I didn't think I would need the output so I opt'ed for the 'easier to use' shellexecute. Bad judgement on my part. I may go back through my code and change to CreateProcess instead of ShellExecute.
Rob
Whoever said nothing's impossible never tried slamming a revolving door!
|
|
|
|
|
Hi Rob ,
I do not have an exact answer to ur query. but , if ur looking for ways
to redirect the out put of a child process (created using Win32 API )
, i have got some pointers.
Redirecting the output to file is actually piping the output to the file or
some other process in the chain. One can use Anonymous pipes to redirect
the output to a file . Exact mechanism which u have to look for is
How to Create Anonymous PIPES ?
How Handle to the process can be retrieved ?
( if ur using CreateProcess instead of shellexecute u can )
How u can pipe the process to anonymous pipe etc
when i gave a search in the google
(Search string - Anonymous pipe process creation win32) , i got an excellent article at the following url
http://www.codeguru.com/Cpp/misc/misc/article.php/c277
Hope this helps
Praseed Pai
www.praseedpai.com
|
|
|
|
|
how do I convert a handle to an HWND to CWnd?
Thanks
|
|
|
|
|
Cwnd::Attach(HWND)
dont forget to detach
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
I have a handle to a window,
I need to get a CWnd pointer variable to point to that window..
ex:
suppose I have "DWORD Handle" that is returning the handle to a window in a DWORD
and I have CWnd *pointCWnd
how do I get "pointCWnd" to point to the window for which the handle was returned byt the handle. ?
|
|
|
|
|
Use Attach() just like Papa prescribed.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Hai,
I do not want to have more than one instance of my app running at a given time. If the app is already running on the machine, I want the invocation of the app to just bring the already running app in focus. I would assume there is a standard way of doing this since a lot of apps do it. Can someone give me an example? Thanks a lot.
|
|
|
|
|
See here and here.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Can anybody help in this problem:
There's an edit control - hwnd_edit.
SetWindowText(hwnd_edit, "A line #1\nHere goes next line");
I need to do this:
|-------------------|
|A line #1 |
|Here goes next line|
| |
| |
|-------------------|
Bus what's up? I see the following:
|---------------------------------|
|A line #1[]Here goes next line |
| |
| |
|---------------------------------|
[] is a small square
How to deal with it?
|
|
|
|
|
Try a \r\n
Make sure that the style multiline is checked
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
\n\r doesn't work - now there are two squares instead of CR LF.
Multiline is certainly checked
XPiS
|
|
|
|
|
XPiS wrote:
\n\r doesn't work
It's important that you use \r\n (not \n\r) as was prescribed.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Try \r\n, or even \r allone.
Jaime
|
|
|
|
|
As far as I know, nothing like that will cause a multil-line title bar. Simply because Windows is meant to be user-friendly (read: consistent).
I dont think using owner-draw for the title bar can accomplish multi-line title bars either.
I suggest u change your strategy and display the required data in an appropriate place.
Again, one of the reasons Windows is popular is because of the GUI consistency it maintains.
Bikram Singh
|
|
|
|
|
Where is there mention of a multi-line title bar? Unless the OP changed his post, he wanted a multi-line edit box. Yes?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
sorry ! my mistake!
Bikram Singh
|
|
|
|
|
I have an MFC based app that uses the SDI methodology .
I have a View that creates and maintains a CWnd derived class pointer (CScreen *ptr) .
Now this app is an interactive GUI and I have to display various Screens for which I have implemented classes that derive from CScreen .CScreenDerived1 , CScreenDerived2
Now based on the stage of the GUI the view creates objects of different types = CScreenDerived1 , CScreenDerived2 using the *ptr to point to derived class objects !
like this in the view.cpp file
<br />
case 1:<br />
ptr = (CScreen *) new CScreenDerived1(this);<br />
break;<br />
case 2:<br />
ptr=(CScreen *) new CScreenDerived2(this);<br />
break; Now i have handled the WM_PAINT message in CScreen by implementing OnPaint
Screen.h file ---------------------------
afx_msg void OnPaint();
Screen.cpp -------------------------------
<br />
BEGIN_MESSAGE_MAP(CScreen, CWnd)<br />
ON_MESSAGE(ID_SCREEN_REPAINT, ScreenRefresh)
ON_WM_PAINT()<br />
ON_WM_LBUTTONDOWN()<br />
ON_WM_ERASEBKGND()<br />
END_MESSAGE_MAP()
Also I want to do specific rendering tasks for which I thought of overriding the OnPaint in the derived classes so Using classView I added an OnPaint Function in CScreenDerved1 and CScreenServied 2 , but I found that the breakpoints that i set in the entry points of these functions was never called .
I found a way that worked where I added the afx call (.h) and the MESSAGE MAP entry(.cpp) in the derived classes and the call was made .
I was assuming that polymorphism will help me out when I directly overrode the OnPaint method in the derived class .
I would be grateful if someone can expalin the mechanism used in this case .
is it because ive done this
ptr=(CScreen *) and forced the type cast !
|
|
|
|
|
That you instantiate the CWnd -derived classes does not mean that they will be displayed. You'll have to call Create and - depending on the styles you set - ShowWindow . You'll also have to move the windows in response to the parent resizing. This is accomplished by handling WM_SIZE in the view (you'll get a function called OnSize ), checking for window existence by testing the m_hWnd member of CScreenX.
|
|
|
|
|
Hi guys
I have a problem , but only happens in XP.
When I open a dialog in my app, I do a movewindow related to the parent position. In W2K the windows is placed exactly where I want and when I execute my app in XP it appears in a higher place than in W2K.
Do you know why could this happens?
What is different in XP that my window is not placed in the same place than in w2K?
Another related question.
Why depending the size of the dialog in W2K it appears correctly and in XP the scrollbars appear?
Best Regards
Doc
|
|
|
|
|
Thank you for your Best Regards
This is intriguing.
I cant be sure exactly, but if you're sure you're code complies with MS dox completely, it wud help if you posted the relevant code.
I would sure like to replicate this !
Bikram Singh
|
|
|
|
|
Thanks in advance for your help
CRect rect,rect3;
m_pParent->GetWindowRect(rect3);
GetWindowRect(rect);
MoveWindow(rect3.left+381,rect3.top+123,rect.Width(),rect.Height(),TRUE);
m_pParent it's a pointer to the dialog parent class.
And Best Regards
Doc
|
|
|
|