| | |
Hide prompt when running system() command?
Please support our C++ advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Sep 2008
Posts: 4
Reputation:
Solved Threads: 0
I have a fairly simple question, which may or may not have a simple solution. How can I run the system(); command, in a win32 (not console) application, without the black command prompt window flashing on the screen?
If relevant, I am using Dev-C++.
If relevant, I am using Dev-C++.
Last edited by Zach1188; Dec 28th, 2008 at 12:20 am.
•
•
Join Date: Aug 2008
Posts: 206
Reputation:
Solved Threads: 31
The short answer is that you can't. The system() function (it's not a command) supported by win32 compilers/libraries starts up a command shell, and that command shell shows the "black command prompt window".
If you actually need a command shell (eg you're running an inbuilt shell command or executing a .BAT file), then you have no choice. However, you might be able to find a way to implement your required functionality without using a command shell.
If you want to run a third-party program (eg another win32 application) with more control than is possible with the system() command, look up the CreateProcess() function in the win32 API.
If you actually need a command shell (eg you're running an inbuilt shell command or executing a .BAT file), then you have no choice. However, you might be able to find a way to implement your required functionality without using a command shell.
If you want to run a third-party program (eg another win32 application) with more control than is possible with the system() command, look up the CreateProcess() function in the win32 API.
•
•
Join Date: Sep 2008
Posts: 4
Reputation:
Solved Threads: 0
I know, system() isn't a command, I was in a hurry when I wrote that.
Well, basically what I'm trying to do is make a program that automatically starts the user in the SYSTEM account (if you've seen guides on how to do that). It's not a particularly "useful" program, but it's good practice. I am trying to use the "at" command using /interactive to start explorer.exe as SYSTEM.
Example:
Perhaps this is was a stupid question, I suppose I could use CreateProcess() to run at.exe. Am I correct?
Well, basically what I'm trying to do is make a program that automatically starts the user in the SYSTEM account (if you've seen guides on how to do that). It's not a particularly "useful" program, but it's good practice. I am trying to use the "at" command using /interactive to start explorer.exe as SYSTEM.
Example:
C++ Syntax (Toggle Plain Text)
std::string cmd = "at " + calcTime(1) + " /interactive explorer.exe"; system(cmd.c_str());
Perhaps this is was a stupid question, I suppose I could use CreateProcess() to run at.exe. Am I correct?
Last edited by Zach1188; Dec 28th, 2008 at 2:56 am.
![]() |
Similar Threads
- XP not booting - lsass.exe not found (Windows NT / 2000 / XP)
- Error Messages, Laggy, C drive red x, Pos.tmp files .... Please help me!! (Viruses, Spyware and other Nasties)
- Computer hijacked. please help (Viruses, Spyware and other Nasties)
- winfixer popups/ computer restarting (Viruses, Spyware and other Nasties)
- Help (Windows NT / 2000 / XP)
- Cannot find server or DNS Error Explorer & usps.com (Windows NT / 2000 / XP)
- How can I delete Hosts: 1159680172 auto.search.msn.com? (Viruses, Spyware and other Nasties)
- Hotoffers get me mad !! (Viruses, Spyware and other Nasties)
- IE "can't find server" after loading home page (Viruses, Spyware and other Nasties)
Other Threads in the C++ Forum
- Previous Thread: MSVC++ Express 8 error C2228
- Next Thread: Populate an STL map with two arrays (C++)
Views: 1731 | Replies: 4
| Thread Tools | Search this Thread |
Tag cloud for C++
6 api array arrays based beginner binary bmp c++ c/c++ calculator char class classes code compile compiler console conversion convert count data delete deploy dll download dynamic encryption error file forms fstream function functions game givemetehcodez graph gui homeworkhelp iamthwee ifstream input int java lib library lines linkedlist linker list loop looping loops map math matrix memory microsoft newbie news number output pointer problem program programming project python random read recursion recursive reference return simple sort spoonfeeding stream string strings struct temperature template templates test text text-file tree url variable vector video visual visualstudio void win32 windows winsock wordfrequency wxwidgets





