0

I have a program that opens a WAV file and then plots the waveform. If the WAV file has 2 channels, two graphs are shown, one for each channel. It's working fine but I want to add things in the File Menu that I created. So far, I have three buttons: New, Open File, and Close. So far, the Open File and the Close buttons are working fine.

I want to make the program to be able to let the user view several waveforms of several WAV Files at the same time. One option would be to create more graphs, the process would be quite tedious. Another option would be to open another window and this is what I want to do.

However, this is my problem. I made a quick search on how to open an existing program in C++, and so far, the solutions that I encounter involve opening an exe file and the project folder does not contain an exe file.

I also tried to take a quick look on the functions and I can't find the function that seems to open the window and I can't seem to find it.

Razgriz
  • 7,179
  • 17
  • 78
  • 150

2 Answers2

1

Your best bet is to use fork. Alternatively you could use threads.

Ed Heal
  • 59,252
  • 17
  • 87
  • 127
  • I know this would sound stupid but I'm using wxDev-C++ as my platform. fork(); does not seem to work properly. – Razgriz Jan 01 '13 at 13:29
  • @Razgriz In what way (is this windows). – Ed Heal Jan 01 '13 at 13:31
  • Yes, it is windows. I tried including the unistd.h header file via `#include `. I'll try to copy paste everything and include it via `#include "unistd.h"` – Razgriz Jan 01 '13 at 13:43
  • I tried `pid_t fork(void);` and `fork()`, the former does not work and the latter gives the following error: `[Linker Error] undefined reference to `fork()'` – Razgriz Jan 01 '13 at 13:50
  • See http://stackoverflow.com/questions/9147941/how-can-i-start-a-sub-process-in-windows – Ed Heal Jan 01 '13 at 13:52
  • This does answer the question of how to spawn another process, but makes no mention of the fact that spawning another process is absolutely unnecessary for solving the problem the OP has. – Cubic May 28 '13 at 11:24
  • @cubic - I do not know the architecture of the s/W. Perhaps it is easier to have a separate process or thread. It does not specify the platform. I am sure that the perform has adequate fibre as to looking up fork or its moral equivalent. – Ed Heal May 28 '13 at 21:55
0

Use GetModuleFileName API to get the path+ name of your executable. Then Use ShellExecute to run this APP.

Taryn
  • 242,637
  • 56
  • 362
  • 405
Tony Thomas
  • 967
  • 10
  • 20