|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
ShellExecute in VB2005get no errors, but nothing is happening. Here is my code: Option Explicit On Public Class frmPROTest Const SW_SHOWNORMAL = 1 Dim hwnd 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 Private Sub PDF_Click() Call ShellExecute(Me.hwnd, "open", "S:\Users\JJolly\PRO CD\pdf\english\ESY Book.pdf", "", 0, SW_SHOWNORMAL) End Sub End Class Thanks for any help.
Show quote
Hide quote
"Jedi10180" <Jedi10***@discussions.microsoft.com> schrieb: Your declarations are wrong. Instead of fixing them, I suggest to use > Does ShellExecute work in VB2005? I am trying to open a pdf with a > button - I > get no errors, but nothing is happening. Here is my code: > Option Explicit On > > Public Class frmPROTest > Const SW_SHOWNORMAL = 1 > Dim hwnd > > 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 'System.Diagnostics.Process.Start' instead of 'ShellExecute'. -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/> I have also tried 'System.Diagnostics.Process.Start', but apparently my
declarations are wrong when I try it too because nothing happens at all. Can you just give a short code snippet that would include everything I need to open a pdf file using 'System.Diagnostics.Process.Start'? Also, we want this program to be run directly from a CD with no installation - how do I go about doing that? Thanks. Show quoteHide quote "Herfried K. Wagner [MVP]" wrote: > "Jedi10180" <Jedi10***@discussions.microsoft.com> schrieb: > > Does ShellExecute work in VB2005? I am trying to open a pdf with a > > button - I > > get no errors, but nothing is happening. Here is my code: > > Option Explicit On > > > > Public Class frmPROTest > > Const SW_SHOWNORMAL = 1 > > Dim hwnd > > > > 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 > > Your declarations are wrong. Instead of fixing them, I suggest to use > 'System.Diagnostics.Process.Start' instead of 'ShellExecute'. > > -- > M S Herfried K. Wagner > M V P <URL:http://dotnet.mvps.org/> > V B <URL:http://classicvb.org/petition/> > > Jedi10180,
Programs written in a .Net language require the .Net framework to be installed in order to execute the program. Kerry Moorman Show quoteHide quote "Jedi10180" wrote: > Also, we want this program to be run directly from a CD with no installation > - how do I go about doing that? > Thanks. > Jedi10180 wrote:
> Does ShellExecute work in VB2005? I am trying to open a pdf with a Have you considered the following method using the .NET framework?> button - I get no errors, but nothing is happening. \\\ Dim proc As New Process With proc.StartInfo .FileName = "S:\Users\JJolly\PRO CD\pdf\english\ESY Book.pdf" .UseShellExecute = True .Verb = "open" End With 'Launch the file proc.Start() /// -- (O)enone why doesn't cmd.exe with arguments /c copy c:\file.txt d:\directory work with
the process start? Show quoteHide quote "Oenone" wrote: > Jedi10180 wrote: > > Does ShellExecute work in VB2005? I am trying to open a pdf with a > > button - I get no errors, but nothing is happening. > > Have you considered the following method using the .NET framework? > > \\\ > Dim proc As New Process > > With proc.StartInfo > .FileName = "S:\Users\JJolly\PRO CD\pdf\english\ESY Book.pdf" > .UseShellExecute = True > .Verb = "open" > End With > > 'Launch the file > proc.Start() > /// > > -- > > (O)enone > > >
How to minimize to system tray ? VS 2003
Keep software running The Irish fada (áéíóú/ÁÉÍÓÚ) and encryption/decryption problem! How to create a "DataSource" & "Items" properties on Custom Combob Binding sources question in Vs2005 Working with structures and the New keyword Detect Remote Shutdown Alignment problem displaying .txt file in window's textbox? Encyrption in VB and Decryption in VB.NET DataTable.Expression |
|||||||||||||||||||||||