question on shellexecute

  • Thread starter Thread starter The8thSense
  • Start date Start date
T

The8thSense

Hi,

i would like to invoke another applcation in my program.I 've tried
shellexecute ,but it doesnt work .

here is my code :
ShellExecute(0, "open", "C:\windows\system32\notepad.exe", vbNull, vbNull,
SW_SHOWMAXIMIZED)

what amendment should i make in order to make it work ?

thanks very much.
 
* The8thSense said:
i would like to invoke another applcation in my program.I 've tried
shellexecute ,but it doesnt work .

here is my code :
ShellExecute(0, "open", "C:\windows\system32\notepad.exe", vbNull, vbNull,
SW_SHOWMAXIMIZED)

what amendment should i make in order to make it work ?

Use 'System.Diagnostics.Process.Start' instead and have a look at the
'ProcessStartInfo' class.
 
Nice Chap said:
Dim P as new System.Diagnostics.Process()
P.Start("Notepad.exe")

It works, but don't expect p to point to the Notepad process because the
Start method is shared.
 
Hi,

i would like to invoke another applcation in my program.I 've tried
shellexecute ,but it doesnt work .

here is my code :
ShellExecute(0, "open", "C:\windows\system32\notepad.exe", vbNull, vbNull,
SW_SHOWMAXIMIZED)

what amendment should i make in order to make it work ?

thanks very much.

Imports System.Diagnostics

....

Dim p As New Process()

With p.StartInfo
.File = "Notepad.exe"
.WindowStyle = ProcessWindowStyle.Maximized
End Wit

p.Start()


Or, if it is a document and you want to open the default handler...

Dim p As New Process()
With p.StartInfo
.File = "myfile.txt"
.Verb = "open"
.WindowSytle = ProcessWindowStyle.Maximized
.UseShellExecute = True ' this is the default anyway
End With
p.Start()

HTH...
 
Back
Top