I'm trying to use the Shell command to run a .exe file on a mobile Pocket PC, but when I run/debug the program on the phone it keeps coming up with the FileNotFound error. I'm thinking it is the path that is wrong, but I can't find anywhere as to how to address the path on a mobile device.. i.e. Shell("c:\program files\calc.exe").
I have tried every combination i can think of, from My Device, to C: to just \... but nothing seems to work and I know I'm missing something. Any help would be appreciated.

Using VB program to open file on a CDMA device - PPC6700
sjh174
Still trying to figure this one out. Any idea on how to get the ID of a process I do a process.start on test.exe.. but I can't get an ID to close it with now. Or is there any other way to stop the process I'm thinking it might be a limitation of .Net compact, but I'm not sure.
Also, VB2005 will not let me use a Process.Kill either. Here is the example, If someone can PLEASE tell me a way to Close, Stop, Kill this process after I run it, It would hep greatly.
If
System.IO.File.Exists("\program files\start menu\test.exe") Then Dim theProcess As New ProcessStartInfo()theProcess.FileName =
"\program files\start menu\test.exe"Process.Start(theProcess)
ElseMessageBox.Show(
"File does not appear to exist in the location given") End IfPeter McEvoy
its a \ (backslash) that indicates the root directory. be sure that you specify the correct full path to the file you wish to execute. So if my file was in [Root]\test\test1.exe then....
\test\test1.exe
would be my path
simon burgess
Almost there I hope, here is current problem:
I get a "Overload resolution failed because no accessible 'New' accepts this number of arguments."
at the :
Dim theProcess As New ProcessStartInfo("\test\test.exe")
line..
What am I missing now
Leon Mayne
Kevin Hoffman
If you would look at this: http://msdn2.microsoft.com/en-us/library/system.diagnostics.process.kill(VS.80).aspx
It shows that this should be avaliable in the .Net Compact Framework.. supported in: 2.0
I guess what I can do is try to kill it by the Process ID, but I can't figure out how to get the Process ID of my "test.exe" file... anyone know of a method to get this ID If i could get that, I can atleast try to Kill it with that method.
Hassan Ayoub
I am using .NET 2.0 and Visual Studio 2005.
When I use file explorer, it shows: My Device as being the "Root" and I made a folder there called "Test" and in the "Test" folder, i have my test.exe file.
buladbanaw
No, that did not work...
Is there any way someone could send me or tell me where to find a sample code for Visual Basic for Pocket PC that will open a .exe file when a button is clicked
Say for instance I want to use the button to open calc.exe. Is using the Shell("calc.exe") the proper command, or would that be a ShellExectue("calc.exe")
I'm not sure if that is my problem, or if it is just the fact that the PATH is still wrong for a Pocket PC...
This is driving me crazy so any help would be appreciated.
I do feel this is the correct command, it is just when the event happens and attempts to run the calc.exe it gives me the FileNotFoundException was unhandled error... so it does try to do the Shell, but can't find the file right
grantsamuels
Ok, new problem:
How Do I Kill this process now I have search till my eyes bleed and I've found this:
Private
Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.ClickSystem.Diagnostics.ProcessStartInfo.
Dim ps As Process()ps = Process.GetProcessesByName(
"test") For Each p As Process In psp.Kill()
Next End SubBut the problem is that : Error 2 'GetProcessByName' is not a member of 'System.Diagnostics.Process'.
The only options I have that will work is GetProcessByID or GetCurrentProcess.. is there something else that I'm not doing right now
I don't know what the "ID" is to kill it by that... is there an easy way to figure out the "ID" and just use that Or is this some kind of limitation in Programming a Pocket PC I'm trying to write this program for a Pocket PC running WM 5.0
mapvman
there isnt shell or rather you shouldnt use it.
Wilk06
my mistake. Was trying to write it off by heart but didnt work.
change it to.....
Dim theProcess As New ProcessStartInfo()
theProcess.FileName = "\test\test.exe"
Process.Start(theProcess)
SonuK
Markw2004
if using .NET 2.0 then use the Process class to launch your file.
imports System.Diagnostics
imports System.IO
..
..
private sub button1_Click(byval sender as object, byval e as Eventargs) handles button1.click
if System.IO.File.Exists("\test\test.exe") then
Dim theProcess as new ProcessStartInfo("\test\test.exe")
Process.Start(theProcess)
else
MessageBox.Show("File does not appear to exist in the location given")
end if
end sub
seco
Well, thanks for the process start info, but it seems I'm back to my root (grin) problem.
It gives me the
File does not appear to exist in the location given
..
I opened File explorer on the Pocket PC, when back as far as possible (ROOT) where at top it says "My Device" in that location, I made the folder "test" then i placed my "test.exe" in that folder.
So i'm still not understanding why it can't find the program to run it.. any more suggestions
kadabba
Process.Start( ProcessStartInfo ) returns a Process object. ( http://msdn2.microsoft.com/en-us/library/0w4h05yb.aspx )
You can use that process object to kill the process later.
If System.IO.File.Exists("\program files\start menu\test.exe") Then
Dim theProcess As New ProcessStartInfo()theProcess.FileName =
"\program files\start menu\test.exe"Dim p As Process = Process.Start(theProcess) ' <----- save the process object that was previously being ignored
' let the process do whatever it needs to do here... maybe wait for some signal that says its time to kill it
p.Kill() ' <------ use the process object we got from start to kill that same process
ElseMessageBox.Show(
"File does not appear to exist in the location given") End IfHope that helps,
Noah
.Net Compact Framework