HI,
Can any one tell me that how can i get results from sevral commands like dir , Time , Ping etc from my dialog based Application without showing their black console windows.
Thanks!
HI,
Can any one tell me that how can i get results from sevral commands like dir , Time , Ping etc from my dialog based Application without showing their black console windows.
Thanks!
Hey,
I dunno if this is the best way, but it works. Call the dos command with system() or CreateProcess() or whatever you want to use, and send the command/results out to a temp file that your prog can delete when its finished:
You now have the info you need in c:\test.txt, however this does pop up the annoying console box, you would need to use a different function to do that.Code:system("dir >> c:\test.txt");
Now you would just need to read in test.txt into a varible, and then delete it with DeleteFile("c:\test.txt");
I would tell you how to read in but i cant remember the code offhand, sorry but let me know if you need it
Hope that helps,
TNT
TNT
You Can Stop Me, But You Cant Stop Us All
Thanks! TNT
You can do as suggested above....but a more professional way to do it is to use the feature provided with CreateProcess...you can run the command without creating a consol...and also give custom handles for stdin & stdout - and then just read these handles and handle the IO yourself
look here
Ok! but Create Process is some what difficult to understand will you please tell me that how can i use this function