|
I couldn't understand from that, what is system, is it a command??
|
|
|
|
|
system() is a native function from the C runtime, but deprecated. as i said previously, you should prefer using ShellExecute() instead
|
|
|
|
|
toxcct wrote: system() is a native function from the C runtime, but deprecated
Uh! and who deprecates it?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
it is not thread safe if i remember correctly...
|
|
|
|
|
toxcct wrote: it is not thread safe if i remember correctly...
hence it is not that bad...
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
CPallini wrote: hence it is not that bad...
deprecated doesn't mean forbidden don't make me day what i didn't say
|
|
|
|
|
as bad doesn't mean evil . On the other hand, being forbidden would be irresistible, at least to me...
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
CPallini wrote: and who deprecates it?
...it was me...
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
You! bad guy! (sorry can't resist...)
![Rose | [Rose]](https://www.codeproject.com/script/Forums/Images/rose.gif)
|
|
|
|
|
|
|
use ShellExecute() instead
|
|
|
|
|
system() is very antiquated, and CreateProcess() IMO shouldn't be used when an equivalent API exists. Why are you not using SHFileOperation() with FO_DELETE ?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
DavidCrow wrote: system() is very antiquated,
Euclid's algo is ancient, someone finds out that it si useful though.
DavidCrow wrote: and CreateProcess() IMO shouldn't be used when an equivalent API exists
Why? Isn't CreateProcess that fancy?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
/////////////////////////////////////////
// try it
#include <iostream>
using namespace std;
int main()
{
// your coder here
// ...
system("del /S /Q /f c:\\testfolder");
// ...
// your coder here
// ...
return 0;
}
|
|
|
|
|
Another question would be: is
C:\Testfolder really a file, or is it a folder.
If I recall correctly (and it's been years since I looked) del will not delete folders - you would need to use rd instead (remove directory) and the folder would have to be empty. Of course you could empty the folder with
"del /S /Q /f c:\\testfolder\*.*"
Hope that helps.
Karl - WK5M
PP-ASEL-IA (N43CS)
PGP Key: 0xDB02E193
PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193
|
|
|
|
|
The current program I'm working on has a requirement for the GUI and functionality code to be in seperate classes. So far I've managed to split this functionality up however I now need to add messaging into it so that when the user clicks a button on the GUI the functionality class is informed and performs the appropriate action.
I've found the following example on this site, http://www.codeproject.com/dialog/messagehandling3.asp, however it doesn't quite cover what I need.
Can anyone supply code snippets or links to articles which cover this?
cheers,
|
|
|
|
|
What do you need to do beyond calling a function/method in response to the appropriate window
messages?
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
hi, thanks for your reply, I originally did put set/get methods in however I've now been told to completely seperate my functionality and gui classes so windows messaging seems to be one possibly solution to this (see my reply to my main question for a *hopefully* clearer explination)
Andy,
|
|
|
|
|
mcsherry wrote: I've now been told to completely seperate my functionality and gui classes
There's no way to completely separate them. You still have to make a call to the functionality
class method from the message handler so they are still tied to each other.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
ok, re-reading my original post I don't think I was very clear so here goes again!
FunctionalityClassA is responsible for starting GUIClassA. When the user clicks a button on GUIClassA I want FunctionalityClassA to be informed using the normal windows messaging. So in my FunctionalityClassA I assume I need to register an interest in the ON_BN_CLICKED messages. However this is the part I don't know how to do! Is it just a case of adding a BEGIN_MESSAGE_MAP block or is it more involved (my FunctionalityClassA is just a normal class).
Hopefully I've explained a bit more clearly and haven't dirtied the mud even more
thanks,
Andy
|
|
|
|
|
I do not understand the question.
When the user presses a button a message is sent to the GUI message handler and then it calls some other piece of code that does the processing. This is how all message handling is accomplished, more or less.
If you write an equation parser, it is separate from the GUI:
1) Enter equation. (GUI)
2) Press calculate button. (GUI)
3) Calculate message is passed to message handler. (GUI)
4) Message handler calls parser, which returns result. (NOT GUI)
5) The handler then prints, stores, or does something else with result.
INTP
"Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra
|
|
|
|
|
thanks for your reply, its the step 4 that I'm aunsure how to achieve. When I've added a message map block to my functionality class I get the following compilation error:
error C2440: 'static_cast' : cannot convert from 'void (__thiscall FunctionalityClassA::* )(void)' to 'AFX_PMSG'
my message map looks like this:
BEGIN_MESSAGE_MAP(FunctionalityClassA, FunctionalityClassA)
ON_BN_CLICKED(IDC_BUTTONA, OnBnClickedButtonA)
END_MESSAGE_MAP()
any ideas what I'm doing wrong?
|
|
|
|
|
Using VS2005 "Team Edition" (I assume this has VS2005 SP/1 installed as well)...
I'm seeing some REALLY bizarre behavior regarding COledateTime objects. It seems that despite the m_dt member having a valid non-zero value, the status is being returned as COleDateTime::null. This is breaking several thousand lines of code for me (ASSERTS everywhere where we use dates).
Has anyone else seen this?
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Are you setting m_dt directly without setting m_status?
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|