Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ShellExecute API 1

Status
Not open for further replies.

lydro

Programmer
Mar 7, 2005
36
CA
I'm using the ShellExecute API, but it is not opening any file with its associated program.

here is my coding:

Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _
(ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, _
ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd _
As Long) As Long

Public Sub RunProgram(ByVal strProgram As String)
Dim lRet As Long
lRet = ShellExecute(vbNull, "Open", strProgram, "", "", 1)
If lRet <= 32 Then
MsgBox("Error Running Program")
End If
End Sub

Public Sub btmView_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnview.Click
RunProgram(file_location)
end sub


It doesn't give me the error either. PLEASE HELP!

 
Dim p As New Process
p.StartInfo.UseShellExecute = True
p.StartInfo.FileName = "c:\mydoc.doc"
p.Start()
\\\
\\\
Dim p As New System.Diagnostics.ProcessStartInfo()
p.WindowStyle = ProcessWindowStyle.Hidden
p.FileName = "C:\mydoc.doc"
p.UseShellExecute = True
System.Diagnostics.Process.Start(p)


found via google :
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top