Hi to all,
I've started programming vb.net last week and I'm a newbie...

I'm programming an application for my navigation system.
1) Development tool is: MS Visual Studio .Net 2003 - SP1
2) Navigation system is equipped with:
a) MS Windwows CE .net 5.00
b) MS .NET Compact Framework 1.0.4292.00

I've a question for you:
I wish to "start external program" programmatically, on button click event.

I'm Visual Basic v. 6.0 expert and Shell(), ShellExecute() and
ShellExecuteEx() were very useful, but into vb.net language they are not!???

I wish the vb.net equivalent of vb60 instruction:

retVal=Shell("\MySubDir\Notepad.exe", vbShow)

I've tried "ShellExecute API" but gives me a NotSupportedException
I've tried to use "Process class" but I've not found it into CF.
I explain better... following a summary of my code into form
"frmNavSystem.vb"

----------------------------------------------------------------------------
------------------------
Imports System.Windows.Forms
Imports System.Runtime.InteropServices
Imports Microsoft.VisualBasic


Public Class frmNavSystem
Inherits System.Windows.Forms.Form
.......................... blà blà blà .....................
Private Sub pcxButton_TopLeft_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles pcxButton_TopLeft.Click
Call ExecuteExternalProgram("\MySubDir\MyApp.exe", "\MySubDir\")
End Sub
.......................... blà blà blà .....................
Private Function ExecuteExternalProgram(ByVal strPRMPath As String, ByVal
strPRMDirectory As String) As Boolean
'********************************* HERE IS THE QUESTION
*****************************
'***************** Here I wish "Process class" option into drop-down
list, but it isn't there!!!!!
'Dim objProcess As System.Diagnostics.{}

'************ This is inexistent
'Call Shell(strPRMPath , AppWinStyle.NormalFocus)
'********************************* HERE IS THE QUESTION
*****************************
End Function
.......................... blà blà blà .....................
End Class
----------------------------------------------------------------------------
------------------------

Besides, Project => MyProject property => Common Properties => Imported
reference => List of name spaces includes only "System".

The Shell() function doesn't exist into .net (? I think ?), because
generation gives me an error.
The drop-down list of System.Diagnostic.{--} doesn't give me the .Process
class option... so, I can't select it!!

Please, can you help me? Can you give me an example?
Thanks in advance
Francesco

Re: Newbie: start external program like Shell() function by ctacke/>

ctacke/>
Mon Nov 19 09:50:45 PST 2007

Look at the System.Diagnostics.Process class.


--

Chris Tacke, eMVP
Join the Embedded Developer Community
http://community.opennetcf.com



"Francesco Ranieri" <francesco.ranieri@eng.it> wrote in message
news:%23MFyxBtKIHA.1164@TK2MSFTNGP02.phx.gbl...
> Hi to all,
> I've started programming vb.net last week and I'm a newbie...
>
> I'm programming an application for my navigation system.
> 1) Development tool is: MS Visual Studio .Net 2003 - SP1
> 2) Navigation system is equipped with:
> a) MS Windwows CE .net 5.00
> b) MS .NET Compact Framework 1.0.4292.00
>
> I've a question for you:
> I wish to "start external program" programmatically, on button click
> event.
>
> I'm Visual Basic v. 6.0 expert and Shell(), ShellExecute() and
> ShellExecuteEx() were very useful, but into vb.net language they are
> not!???
>
> I wish the vb.net equivalent of vb60 instruction:
>
> retVal=Shell("\MySubDir\Notepad.exe", vbShow)
>
> I've tried "ShellExecute API" but gives me a NotSupportedException
> I've tried to use "Process class" but I've not found it into CF.
> I explain better... following a summary of my code into form
> "frmNavSystem.vb"
>
> ----------------------------------------------------------------------------
> ------------------------
> Imports System.Windows.Forms
> Imports System.Runtime.InteropServices
> Imports Microsoft.VisualBasic
>
>
> Public Class frmNavSystem
> Inherits System.Windows.Forms.Form
> .......................... blà blà blà .....................
> Private Sub pcxButton_TopLeft_Click(ByVal sender As Object, ByVal e As
> System.EventArgs) Handles pcxButton_TopLeft.Click
> Call ExecuteExternalProgram("\MySubDir\MyApp.exe", "\MySubDir\")
> End Sub
> .......................... blà blà blà .....................
> Private Function ExecuteExternalProgram(ByVal strPRMPath As String,
> ByVal
> strPRMDirectory As String) As Boolean
> '********************************* HERE IS THE QUESTION
> *****************************
> '***************** Here I wish "Process class" option into drop-down
> list, but it isn't there!!!!!
> 'Dim objProcess As System.Diagnostics.{}
>
> '************ This is inexistent
> 'Call Shell(strPRMPath , AppWinStyle.NormalFocus)
> '********************************* HERE IS THE QUESTION
> *****************************
> End Function
> .......................... blà blà blà .....................
> End Class
> ----------------------------------------------------------------------------
> ------------------------
>
> Besides, Project => MyProject property => Common Properties => Imported
> reference => List of name spaces includes only "System".
>
> The Shell() function doesn't exist into .net (? I think ?), because
> generation gives me an error.
> The drop-down list of System.Diagnostic.{--} doesn't give me the .Process
> class option... so, I can't select it!!
>
> Please, can you help me? Can you give me an example?
> Thanks in advance
> Francesco
>
>



Re: Newbie: start external program like Shell() function by Christopher

Christopher
Mon Nov 19 13:02:08 PST 2007

Hi,

"<ctacke/>" <ctacke[at]opennetcf[dot]com> wrote in message
news:uhu13StKIHA.1188@TK2MSFTNGP04.phx.gbl...
> Look at the System.Diagnostics.Process class.

Chris probably missed the bit where the original poster mentioned they were
using CF 1.0. Version 1 of the Compact Framework did not have the
System.Diagnostics.Process class.

Your only solution is to use some PInvoke declarations to access an API
within the operating system called CreateProcess (and/or ShellExecuteEx
depending upon your needs).

Alternativly you might like to investigate the OpenNETCF Smart Device
Framework (SDF). Version 1.4 supports compact framework 1.0 and provides a
suitable Process class which behaves similiar to the one found in .NET CF
2.0.

take a look at
http://samples.gotdotnet.com/quickstart/CompactFramework/doc/waitforsingleobject.aspx
for one example way to wrap up the CreateProcess API

Hope this helps,
Christopher Fairbairn


Re: Newbie: start external program like Shell() function by Francesco

Francesco
Tue Nov 20 06:20:15 PST 2007

Thanks Christopher, thank you very much: you have solved my troubles.
Unfortunately, .NET 2003 has CF v. 1.0.5000 while, smart device, has CF v.
1.0.4292.00: I can't update CF of smart device because it has its operative
system into nand memory (rom)...and updating it, I could lose warranty on
it.

I've another question for you: distribuiting application on my smart device,
.NET 2003 puts its libraries .dll (Microsoft.VisualBasic.dll,
Microsoft.WindowsCE.Forms.dll, mscorlib.dll, System.Data.dll etc) in the
same folder of my application "NavSystem.exe".
Could I set any option to copy my application into a folder FolderA and
library files into another sub-folder FolderB?
I wish something like this:

-SDMMC
|-NavSystem.exe
|-BinFolder
| |-Microsoft.VisualBasic.dll
| |-Microsoft.WindowsCE.Forms.dll
| |- ...............................
| |-System.Xml.dll
|
|-OtherFolder

Thank you very much again
Francesco

"Christopher Fairbairn" <christopher@christec.co.nz> ha scritto nel
messaggio news:73FB34B5-2AA4-4881-B3B7-F712504222D4@microsoft.com...
> Hi,
>
> "<ctacke/>" <ctacke[at]opennetcf[dot]com> wrote in message
> news:uhu13StKIHA.1188@TK2MSFTNGP04.phx.gbl...
> > Look at the System.Diagnostics.Process class.
>
> Chris probably missed the bit where the original poster mentioned they
were
> using CF 1.0. Version 1 of the Compact Framework did not have the
> System.Diagnostics.Process class.
>
> Your only solution is to use some PInvoke declarations to access an API
> within the operating system called CreateProcess (and/or ShellExecuteEx
> depending upon your needs).
>
> Alternativly you might like to investigate the OpenNETCF Smart Device
> Framework (SDF). Version 1.4 supports compact framework 1.0 and provides a
> suitable Process class which behaves similiar to the one found in .NET CF
> 2.0.
>
> take a look at
>
http://samples.gotdotnet.com/quickstart/CompactFramework/doc/waitforsingleobject.aspx
> for one example way to wrap up the CreateProcess API
>
> Hope this helps,
> Christopher Fairbairn
>