CreateProcess

H

Harry Simpson

I'm in VS2008, trying to create a simple little CF app to run WCELOAD to execute a CPF.
I've added a reference to OpenNETCF but for the life of me cannot find the diagnostics namespace....The smart device app wants me to use
Namespace System.Diagnostics

Member of System


Where do I hook into the OpenNETCF stuff

I've seen references in the archives to this - some with extra whacks and some without so I'm a little confused.
Anything wrong with this syntax that's pops out?

Dim argPath As String = "/noaskdest /noui \Storage Card\\pprofile.cpf"

Dim argName As String = "\" + argPath + " \"



Dim programPath As String = "\windows\\wceload.exe"

Dim programName As String = "\" + programPath + "\"



Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

Process.Start(programName, argName)

End sub



The programName, argName in a messagebox looks like this:

\\windows\\wceload.exe\ \/noaskdest /noui \Storage Card\\pprofile.cpf\

Which when I run the silly app I get a Win32 error so....it's probably as bad as it looks....
 
C

Chris Tacke, eMVP

What OpenNETCF stuff? The Process class is part of the CF, so you just call it like so:

System.Diagnostics.Process.Start("wceload.exe", "my params");

It's pretty well documented online:
http://msdn.microsoft.com/en-us/library/system.diagnostics.process.aspx


--

Chris Tacke, Embedded MVP
OpenNETCF Consulting
Giving back to the embedded community
http://community.OpenNETCF.com


I'm in VS2008, trying to create a simple little CF app to run WCELOAD to execute a CPF.
I've added a reference to OpenNETCF but for the life of me cannot find the diagnostics namespace....The smart device app wants me to use
Namespace System.Diagnostics

Member of System


Where do I hook into the OpenNETCF stuff

I've seen references in the archives to this - some with extra whacks and some without so I'm a little confused.
Anything wrong with this syntax that's pops out?

Dim argPath As String = "/noaskdest /noui \Storage Card\\pprofile.cpf"

Dim argName As String = "\" + argPath + " \"



Dim programPath As String = "\windows\\wceload.exe"

Dim programName As String = "\" + programPath + "\"



Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

Process.Start(programName, argName)

End sub



The programName, argName in a messagebox looks like this:

\\windows\\wceload.exe\ \/noaskdest /noui \Storage Card\\pprofile.cpf\

Which when I run the silly app I get a Win32 error so....it's probably as bad as it looks....
 
P

Paul G. Tobey [eMVP]

There are multiple possible problems. Your programPath declaration is
clearly wrong. There wouldn't be one backslash at the beginning and two in
the middle. I think that you want \\ at each path separator. And, in your
argPath, you're going to need some quotes around that path to the .cpf file,
since it's in a path that has a space in it. Something more like this:

Dim argPath As String = "/noaskdest /noui \"\\Storage Card\\pprofile.cpf\""

and then I don't think you want argName at all and don't want to use it.
argPath seems like your parameters, to me.

Paul T.

I'm in VS2008, trying to create a simple little CF app to run WCELOAD to
execute a CPF.
I've added a reference to OpenNETCF but for the life of me cannot find the
diagnostics namespace....The smart device app wants me to use
Namespace System.Diagnostics

Member of System


Where do I hook into the OpenNETCF stuff

I've seen references in the archives to this - some with extra whacks and
some without so I'm a little confused.
Anything wrong with this syntax that's pops out?

Dim argPath As String = "/noaskdest /noui \Storage Card\\pprofile.cpf"

Dim argName As String = "\" + argPath + " \"



Dim programPath As String = "\windows\\wceload.exe"

Dim programName As String = "\" + programPath + "\"



Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

Process.Start(programName, argName)

End sub



The programName, argName in a messagebox looks like this:

\\windows\\wceload.exe\ \/noaskdest /noui \Storage Card\\pprofile.cpf\

Which when I run the silly app I get a Win32 error so....it's probably as
bad as it looks....
 
H

Harry Simpson

Thanks Chris and Paul,

Easiest way I found that works is KISS principle
Dim processInfo As New ProcessStartInfo

processInfo.FileName = " \Storage Card\profile.cpf"

Try

Dim ProfileProcess As Process = Process.Start(processInfo)

Catch ex As Exception

End Try

Thanks

Harry

"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam DOT
com> wrote in message news:[email protected]...
 
P

Paul G. Tobey [eMVP]

Yep, should have thought of that myself...

Paul T.

Harry Simpson said:
Thanks Chris and Paul,

Easiest way I found that works is KISS principle
Dim processInfo As New ProcessStartInfo

processInfo.FileName = " \Storage Card\profile.cpf"

Try

Dim ProfileProcess As Process = Process.Start(processInfo)

Catch ex As Exception

End Try

Thanks

Harry

"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam DOT
com> wrote in message news:[email protected]...
There are multiple possible problems. Your programPath declaration is
clearly wrong. There wouldn't be one backslash at the beginning and two
in the middle. I think that you want \\ at each path separator. And, in
your argPath, you're going to need some quotes around that path to the
.cpf file, since it's in a path that has a space in it. Something more
like this:

Dim argPath As String = "/noaskdest /noui \"\\Storage
Card\\pprofile.cpf\""

and then I don't think you want argName at all and don't want to use it.
argPath seems like your parameters, to me.

Paul T.

I'm in VS2008, trying to create a simple little CF app to run WCELOAD to
execute a CPF.
I've added a reference to OpenNETCF but for the life of me cannot find
the diagnostics namespace....The smart device app wants me to use
Namespace System.Diagnostics

Member of System


Where do I hook into the OpenNETCF stuff

I've seen references in the archives to this - some with extra whacks and
some without so I'm a little confused.
Anything wrong with this syntax that's pops out?

Dim argPath As String = "/noaskdest /noui \Storage Card\\pprofile.cpf"

Dim argName As String = "\" + argPath + " \"



Dim programPath As String = "\windows\\wceload.exe"

Dim programName As String = "\" + programPath + "\"



Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

Process.Start(programName, argName)

End sub



The programName, argName in a messagebox looks like this:

\\windows\\wceload.exe\ \/noaskdest /noui \Storage Card\\pprofile.cpf\

Which when I run the silly app I get a Win32 error so....it's probably as
bad as it looks....
 

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