|
The easiest way to do this is to put that long command line in a batch file and run the batch file via CreateProcess() .
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
I went and tried what you suggested and I get the same result it opens the console for a split second but nothing happens,
I was able to shorten the length of the command line to
"C:\Documents and Settings\bob\very very\long\path batch.bat"
batch file = (foo input.file < key.txt)
This batch filel will work outside of my program but not when called from within it.
Any Ideas
|
|
|
|
|
Nitefall2060 wrote:
batch file = (foo input.file < key.txt)
Go ahead and qualify these three files with a path, too.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
You can do two things first
echo "input" | foo.exe
Second:
Create a Pipe Using CreatePipe Assign the out side of the pipe to the STARTUPINFO.hStdInput then set STARTUPINFO.dwflags = STARTF_USESTDHANDLES the call create process with bInheritHandles = true. The use writefile to write to the pipe and yo should be good.
A programer trapped in a thugs body
|
|
|
|
|
ky_rerun wrote:
You can...
Thanks, but I think you meant to send this to Nitefall2060.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
|
I can answer this one! This drove me batty a while ago. You cannot combine the lines together in the arguments to CreateProcess. From my code:
int rc = CreateProcess(CalExe, Arguments, NULL, NULL, NULL, 0, NULL, NULL, NULL, &ProcInfo);
CalExe has nothing but "c:\blah\file.exe". Arguments contains the arguments. I have NO idea why one would code it this way but such is life.
C. Gilley
Will program for food...
Whoever said children were cheaper by the dozen... lied.
|
|
|
|
|
Does any one know how I can Manipulate Views consisting of field values from several tables using Visual C++. I want to Insert new records in one instance,Update Data in another instance and delete data using MS SQL Views.
|
|
|
|
|
How can I shutdown a remote PC after saving all the running applications on it?
|
|
|
|
|
hey, i started building my app in VC++6 and i want to access an IE window's javascript to retrieve the contents of an HTML input box. how can i do that? can you post a sample script?
|
|
|
|
|
I created an own MFC web browser, fetched some interfaces to MSHTML and retrieved the contents that way.
Maybe there is also a way to get the MSHTML interface by injecting a DLL or by creating a toolbar...
Don't try it, just do it!
|
|
|
|
|
I hear there's a simple way to do it using DOM, but how?
|
|
|
|
|
I have an MFC application based on Document/View Architecture which is also an MDI application. I am able to add ToolBar and StatusBar in MDI Child window but instead I need to add menu to MDI child windows. Is there any trick available to add menu in MDI Child window? Per MSDN, MDI Child window can not have its own menu. Please help.
|
|
|
|
|
I can replace the floating frame class in my application with my own ( derived class from CMiniDockFrameWnd )
by using something like :
m_pFloatingFrameClass = RUNTIME_CLASS(MyMiniFrame);
but it replaces all the floating frames for the application ( toolbars, floating windows, ... )
Is there a way to have a different class for each toolbar ( for example ) so that I can do something special for each ?
I'm trying to set a minimum size on the floating window with OnGetMinMaxInfo, but when doing so, it also set the size for the toolbars ( when floating ) and do it will create a frame that is larger than the actual size of the toolbar.
Thanks.
Max.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
I have created a modeless dialog. I am passing in the pointer to the parent window - which happens to be a CFormView derived class.
m_pModeless = new CModelessDialogHeap(this);
Now when I want to get the parent pointer (m_pModeless) from the modeless dialog I can do two things. A. Store the pointer passed into the constructor of the modeless dialog and use that -- which works.
B. Or, according to one article on this site "http://thecodeproject.com/dialog/gettingmodeless.asp" I should be able to use GetParent().
When I do, it doesn't. It returns an empty pointer
CWnd * tmpPtr = this->GetParent();
What am I missing? Thanks!
|
|
|
|
|
|
Sorry I dont' know what you mean. The dialog is created via clicking a button on a CFormView derived class and its pointer (this) is passed to the Modeless Dialog constructor.
|
|
|
|
|
a window's parent is set by the code that creates the window (in the case of a modeless dialog, that's generally your code). if you don't set a parent wnd (usually in the dlg ctor, or in Create) it will remain NULL.
Cleek | Image Toolkits | Thumbnail maker
|
|
|
|
|
Look at my first post. I am setting the parent window to the dialog.
Please give me an example if I am off base.
|
|
|
|
|
|
Here is the code that creates the modeless dialog box
void CFormsFormsFormsView::OnModelessheap() {
if(m_pModeless){
m_pModeless->SetForegroundWindow();
m_pModeless->CenterWindow();
}
else {
m_pModeless = new CModelessDialogHeap(this);
m_pModeless->Create(CModelessDialogHeap::IDD);
m_pModeless->CenterWindow();
m_pModeless->ShowWindow(SW_SHOW);
}
}
It all works fine. I just don't understand why GetParent() doesn't when called from the modeless dialog box.
Thanks
|
|
|
|
|
can you step into that Create call ?
i suspect some other bit of code somewhere is setting the dlg's m_pParentWnd to NULL. Create is another common place to set that variable.
Cleek | Image Toolkits | Thumbnail maker
|
|
|
|
|
Yes I've stepped through the code. Like I said, the parent is passed into it just fine because I can assign that pointer to a member variable.
But GetParent() should do the same thing...right?
Appreciate your help. Here is the code
CModelessDialogHeap::CModelessDialogHeap(CWnd* pParent /*=NULL*/)
: CDialog(CModelessDialogHeap::IDD, pParent)
{
//{{AFX_DATA_INIT(CModelessDialogHeap)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
m_parent=pParent;
}
|
|
|
|
|
mx483 wrote:
m_pModeless->Create(CModelessDialogHeap::IDD);
The only thing I do different for my modeless dialogs is to call Create(IDD) from within the dialog's constructor.
Does commenting out the call to CenterWindow() have any effect?
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
I've tried this several different ways and it works fine each time (i.e., GetParent() returns the correct value). What does the constructor of CModelessDialogHeap look like? From where are you calling GetParent() ? Is CModelessDialogHeap derived from CDialog ?
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|