Launching .NET app fails

G

Guest

Hello,

I have tried a couple of methods to execute/shellT application from within a
..NET application but can't get it to work.

Using ShellExecuteEx I get the following error message:
Cannot find MyApp (or one of its components). Make sure the path and
filenames are correct and that all the required libaries are available.

(Where MyApp is my .NET application)

I am using the ShellExecuteEx wrapper code from here:
http://www.opennetcf.org/forums/topic.asp?topic_id=263

Points to note:
- Launching other executables in the \Windows\ directory can be launched by
my code.
- Copying all my .exe and .dll files into \Windows causes this code to work.
Indicating that it is indeed not finding the files as indicated in the error
message.
(obviously this is not a permanent solution :) )
- I have specified the full path in both the lpFile and lpDirectory
parameters but still no luck.

I am guessing that the current working directory for the ShellExecuteEx
points to \Windows and therefore not finding my files.

Any ideas or pointers would be appreciated,
Philip Fourie
 
G

Guest

After double checking my code I found a problem in my lpDir variable pointing
to the wrong location.

In case someone else needs to this. This also works and is simpler than my
initial ShellExecuteEx code:

ProcessStartInfo psi = new ProcessStartInfo();
psi.FileName = @"\MyDir\MyApp.exe";
psi.WorkingDirectory = @"\MyDir";

Process.Start(psi);
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top