News:

As usual while waiting for the next release - don't forget to check the nightly builds in the forum.

Main Menu

Open dialog

Started by MikeR, August 28, 2005, 06:10:46 PM

Previous topic - Next topic

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.


If you 're using windows, then lookup ShellExecute() ;)
(it can also "open" files, i.e. document.txt, page.htm, etc)
Be patient!
This bug will be fixed soon...

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:

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


It compiles, but doesn't work.

grv575

#include <iostream>

int main()
{
   std::cout << "Hello world!" << std::endl;
   system("folder\\notepad.exe");
   return 0;
}

directory structure:
c:\test
   console.exe
c:\test\folder
   notepad.exe

and then ran console.exe and it works.

MikeR

#6
Thankyou. :)
I tried it, but had to move the exe to the root folder to make it work. I'll keep playing with it becouse I know I really don't need it there. It is working tho. Many many thanks.

Edit to add: Fixed and working properly. Thanks.