question on shellexecute

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.
 
H

Herfried K. Wagner

* 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.
 
A

Armin Zingler

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.
 
T

Tom Shelton

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...
 

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