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 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 Postreplace '_tmain' with 'main' :)
(I have serious doubts if this solution will work at all, so we might be just wasting our time...)
Jump to PostDepends on your IDE. In Dev-C++ you go to Project Options and set the type to a Console program.
Jump to Post
int _tmain(int argc, _TCHAR* argv[])
toint main(int argc, char **argv)
, but I doubt that is going to make a big difference. Just so you know, in code::blocks IDE, windows XP SP2, this compiles (and works) just fine:#include "windows.h" #include "shellapi.h" int …
Jump to PostI don't remember if anyone's suggested initializing COM. Try this.
#include <iostream> #include <windows.h> #include <objbase.h> // Link with ole32 (add -lole32 to the linker command line) #define FILE "c:\\test.bat" //#define FILE "c:\\windows\system32\msg.exe" #define VERB "runas" //#define VERB "open" int main(int argc, char **argv[]) { SHELLEXECUTEINFO shExecInfo; …
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 developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.