Is there a simple way to run another program, say IE, FF or just a simple .bat file sith c++? ive searched around a bit but all ive found is rocket science and didn't seem to be what im looking for. i dont wish to run it "trough" my program, just as if i had found the destination and doubleclick'ed it.
Bladtman242
8
Junior Poster
Recommended Answers
Jump to Postin windows can you use ShellExecute, which is an API call that will allow you to spawn an application.
Jump to Postwell, it's included in the windows.h, so try this:
#include <iostream> #include <windows.h> int main(int argc, char **argv) { ShellExecute(NULL, "open", "C:\\windows\\system32\\calc.exe","", "C:\\", SW_NORMAL); return 0; }
EDIT: Negative. ShellExecute is NOT C++.... ShellExecute is a windows function that can be called from any language with the …
Jump to PostThe first parameter, hWnd (passed NULL) is the window to associate the new process with (NULL means you aren't using this feature).
The second, lpOperation, is what you want to do with the file specified in the next parameter. Here we are "open"ing it.
Speaking of which, the …
Jump to PostOr use..
execlp(...)
Jump to Postreplace '_tmain' with 'main' :)
(I have serious doubts if this solution will work at all, so we might be just wasting our time...)
All 65 Replies
Comatose
290
Taboo Programmer
Team Colleague
Bladtman242
8
Junior Poster
Comatose
290
Taboo Programmer
Team Colleague
Bladtman242
8
Junior Poster
death_oclock
103
Posting Whiz
Comatose
commented:
Precisely!
+10
cikara21
37
Posting Whiz
Comatose
290
Taboo Programmer
Team Colleague
Bladtman242
8
Junior Poster
Bladtman242
8
Junior Poster
nucleon
114
Posting Pro in Training
Bladtman242
8
Junior Poster
death_oclock
103
Posting Whiz
Bladtman242
8
Junior Poster
Comatose
290
Taboo Programmer
Team Colleague
Bladtman242
8
Junior Poster
Comatose
290
Taboo Programmer
Team Colleague
Bladtman242
8
Junior Poster
Nick Evan
4,005
Industrious Poster
Team Colleague
Featured Poster
Bladtman242
8
Junior Poster
Bladtman242
8
Junior Poster
Comatose
290
Taboo Programmer
Team Colleague
Bladtman242
8
Junior Poster
Comatose
290
Taboo Programmer
Team Colleague
Bladtman242
8
Junior Poster
Comatose
290
Taboo Programmer
Team Colleague
Bladtman242
8
Junior Poster
Comatose
290
Taboo Programmer
Team Colleague
Bladtman242
8
Junior Poster
Nick Evan
4,005
Industrious Poster
Team Colleague
Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.