User forums > General (but related to Code::Blocks)

Open dialog

(1/2) > >>

MikeR:
I have tried till I'm bald and can't figure out how to open another program from within a program.
What I'm trying to do is to have my users click on "open" in the tab, then it opens "notebook.exe". I just haven't figured out how to do this. Any suggestions?

I've tried:

system(../../notebook.exe);

(don't recall the other ways I've done this. There are too many to list anyway)

but it doesn't work. Compiles without errors, but doesn't work.

mandrav:

--- Quote from: MikeR on August 28, 2005, 06:10:46 pm ---I have tried till I'm bald and can't figure out how to open another program from within a program.
What I'm trying to do is to have my users click on "open" in the tab, then it opens "notebook.exe". I just haven't figured out how to do this. Any suggestions?

I've tried:

system(../../notebook.exe);

(don't recall the other ways I've done this. There are too many to list anyway)

but it doesn't work. Compiles without errors, but doesn't work.


--- End quote ---

If you 're using windows, then lookup ShellExecute() ;)
(it can also "open" files, i.e. document.txt, page.htm, etc)

MikeR:
I'm using the standard C++ library.
I'll see what I can find on ShellExecute() Thanks.

grv575:
I'd use system().  This is both portable (linux, windows) and passes all directory path handling to the system's shell, so that quotes ("") and spaces in pathnames are handled transparently.  You sure system("..\..\notebook.exe") or sytem("..\\..\\notebook.exe") are no good?

MikeR:
This is my code:


--- Code: ---case 100: //File -> open
              // env->addFileOpenDialog(L"Please select a file to open");
               system("media/texteditor/MdiApp.exe");
               break;
--- End code ---

It compiles, but doesn't work.

Navigation

[0] Message Index

[#] Next page

Go to full version