|
|
Hai
How Can Run a Batch file ? as We can do with ShellExecute()/CreateProcess()/System()is there any method
so i can run a batch file .
Fly Like An Eagle With MIGHTY POWER.
|
|
|
|
|
system() is ok if you don't want to keep track it till the end of the tasks in the batch file.
Otherwise you had better choose other approaches.
Maxwell Chen
|
|
|
|
|
You can run a batch file exactly like any other executable...
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
ShellExecute() is probably the best way, since it will automatically look up the .bat association and run cmd.exe or whatever your command processor is.
--Mike--
Visual C++ MVP
LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
|
|
|
|
|
I am trying to get my program to accept the data from an internet source, like a webpage or a java applet. Can somebody refer me to a tutorial? I don't even know where to begin!
Thanx...
Aurora
|
|
|
|
|
Do you need to download file
|
|
|
|
|
Please look at CHttpFile in the documentation
Yaron
Interface basics click here :
http://www.codeproject.com/com/COMBasics.asp
don't forget to vote
|
|
|
|
|
You can use IHTMLDocument2 Interface to read the file content in the HTML form
Vision is Always important and so is your ATTITUDE.
Wishes.
Anshuman Dandekar
|
|
|
|
|
use :
InternetReadFile
Cheers
"Peace of mind through Technology"
|
|
|
|
|
can anyone tell me how do i get the current directory in VC++ code?
|
|
|
|
|
Hi.
You could do something like this:
char myCurDir[512];<br />
<br />
BOOL bret = GetCurrentDirectory(512, myCurDir);
After that line the variable myCurDir hold th complete path.
Regards.
Demian.
"I have always wished that my computer would be as easy to use as my
telephone. My wish has come true. I no longer know how to use my telephone."
-Bjarne Stroustrup, computer science professor, designer of C++
programming language (1950- )
|
|
|
|
|
Hi.
I'm writing a SDI application with 2 views. A left view, (CTreeCtrl) and an CEditView at right.
The CTreeView shows some files, (plain text files).
And when some file is clicked I want to show the content of the file in the CEditView.
I have the OnSelchanged message handle in the left view where I have read from disk the file and filled a CMyDocument::CStringArray with the texts lines.
Now start my problem: How could I show the data hold in the StringArray in the CEditView.
I know it's a simple question, but I'm something entangled with all this stuff, (I mean, multiple views stuff).
Now I'm stopped at the end of the CLeftView::OnSelchanged message handle with the data ready to be showed in the other view, but I don't know how.
Please, I need some guide
Thankx.
Demian.
"I have always wished that my computer would be as easy to use as my
telephone. My wish has come true. I no longer know how to use my telephone."
-Bjarne Stroustrup, computer science professor, designer of C++
programming language (1950- )
|
|
|
|
|
Call UpdateAllViews() on your document, and in the OnUpdate() handler in the edit view, implement code that reads the data from the document and inserts it into the edit box.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Ok Ryan.
Thank you for your answer.
But how do you insert the text in the edit view?, using SetWindowText() member function?, because I'm doing the following in OnUpdate() and it doesn't work:
CString tmp;<br />
<br />
for(i=0; i < GetDocument()->m_dumpData.GetSize(); i++)<br />
{<br />
tmp += GetDocument()->m_dumpData[i]; <br />
<br />
}<br />
<br />
GetEditCtrl().SetWindowText(tmp);
m_dumpData is the StringArray object that holds the lines of text, and I have traced that object inside the loop and I could see the data.
tmp is a CString object and my idea was add every line of text in the CStringArray to tmp and then show it with SetWindowText(). Nothing happen, no exception and no text.
Should I use a CView instead of CEditView and try to print the text lines using TextOut??
I did that before and it works, but I had some problems scrolling the view, then I though to change the view to CEditView because I think is more "natural" talking about text files.
The largest files is about 32kb, so, an Edit control should works fine.
Thank you.
Demian.
"I have always wished that my computer would be as easy to use as my
telephone. My wish has come true. I no longer know how to use my telephone."
-Bjarne Stroustrup, computer science professor, designer of C++
programming language (1950- )
|
|
|
|
|
Demian Panello wrote: ...and it doesn't work:
Why not? Does tmp get appended to? Is m_dumpData non-empty?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"We will be known forever by the tracks we leave." - Native American Proverb
|
|
|
|
|
Yes m_dumpData is not empty, (I could dump the lines in the debug window) and I put a break in the line SetWindowText() and I could see what tmp contain, (all the text). But it looks like I need some refresh or something like that 'cause after calling SetWidowText() the scroll bars apears, but I can't see the text inside the edit view.
This is all my code in CMyEditView::OnUpdate() handle:
int i;<br />
<br />
if(GetDocument()->FileType== 1)<br />
{<br />
CString tmp;<br />
for(i=0; i < GetDocument()->m_dumpData.GetSize(); i++)<br />
{<br />
tmp += GetDocument()->m_dumpData[i]; <br />
TRACE("\n%s", m_dumpData[i]);
}<br />
GetEditCtrl().SetWindowText(tmp); <br />
<br />
TRACE("\nString length: %i", tmp.GetLength()); <br />
<br />
<br />
}
Thank you
Demian.
"I have always wished that my computer would be as easy to use as my
telephone. My wish has come true. I no longer know how to use my telephone."
-Bjarne Stroustrup, computer science professor, designer of C++
programming language (1950- )
|
|
|
|
|
Your problem is in the call to GetEditCtrl() . Once that function returns, the CEdit& is not guaranteed to exist. You need to save that to a variable if you want to use it later.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"We will be known forever by the tracks we leave." - Native American Proverb
|
|
|
|
|
I changed to
CEdit& myEdit = GetEditCtrl();
and then
myEdit.SetWindowText(tmp); // instead of GetEditCtlr().SetWindowText(tmp)
And I get the same bug. It looks like SetWindowText() works, (I can see the scroll bars growing), but I can't see the text.
Demian.
"I have always wished that my computer would be as easy to use as my
telephone. My wish has come true. I no longer know how to use my telephone."
-Bjarne Stroustrup, computer science professor, designer of C++
programming language (1950- )
|
|
|
|
|
Demian Panello wrote: ...but I can't see the text.
Has its color been changed to match the background?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"We will be known forever by the tracks we leave." - Native American Proverb
|
|
|
|
|
No.
I'm trying to find the problem, but I can't.
I have commented all the lines in the OnUpdate() handle and just write:
myEdit.SetWindowText("Hello");
well, I get the same bug, it looks like "Hello" is printed in the edit view, (the caret has been moved) but I can't see the text. I have not changed the color.
Demian.
"I have always wished that my computer would be as easy to use as my
telephone. My wish has come true. I no longer know how to use my telephone."
-Bjarne Stroustrup, computer science professor, designer of C++
programming language (1950- )
|
|
|
|
|
I FOUND THE BUG!!!
My stupid bug!! :->
When my View was a CView, I had overwritten the OnPaint() handle!!!!
And then I move my view to CEditView but the OnPaint() handle still there!!!!.
Now I have removed the OnPaint() handle, and everything works fine.
Sorry about my stupid bug and thank you very much for your feedback.
This forum is the heaven!!!
And all of you are Gods.
Demian.
"I have always wished that my computer would be as easy to use as my
telephone. My wish has come true. I no longer know how to use my telephone."
-Bjarne Stroustrup, computer science professor, designer of C++
programming language (1950- )
|
|
|
|
|
Demian Panello wrote: "I have always wished that my computer would be as easy to use as my
telephone. My wish has come true. I no longer know how to use my telephone."
-Bjarne Stroustrup,
Did he really say so?
Maxwell Chen
|
|
|
|
|
Yes he did it.
But I don't know where I have read it.
Demian.
"I have always wished that my computer would be as easy to use as my
telephone. My wish has come true. I no longer know how to use my telephone."
-Bjarne Stroustrup, computer science professor, designer of C++
programming language (1950- )
|
|
|
|
|
Maxwell Chen wrote:
Did he really say so?
You might try his Web site.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"We will be known forever by the tracks we leave." - Native American Proverb
|
|
|
|