R
Robert Styma
I have used SHellExecute from C++ successfully on
Visual Studio 6. I am currently using Visual Studio 2008
coding in Visual Basic. All the examples I have tracked down
to use ShellExecute to open a file with the appropriate application
end up looking something like this:
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 Command1_Click()
Const SW_SHOWDEFAULT As Long = 10
Dim sFullPathToFile As String
Dim rc As Long
sFullPathToFile = "C:\tmp\EditMenu.htm"
rc = ShellExecute(0, "Open", sFullPathToFile _
, 0&, 0&, SW_SHOWDEFAULT)
End Sub
When I execute the above, it does not throw an exception, It does not
generate anything in the event log. It appears to run.
rc is returned as 1642688007033061378
x"16CA000A00000002"
According to the documentation, this is a handle and means the
call worked.
The path to the file does exist and IE is defined as the
default application for .html files. The problem is that
nothing happens. I have tried changing the command
to SW_SHOWNORMAL As Long = 1 with the same result.
The command shows it worked, but nothing appears
Can someone give me a pointer as to how to fix this issue?
Visual Studio 6. I am currently using Visual Studio 2008
coding in Visual Basic. All the examples I have tracked down
to use ShellExecute to open a file with the appropriate application
end up looking something like this:
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 Command1_Click()
Const SW_SHOWDEFAULT As Long = 10
Dim sFullPathToFile As String
Dim rc As Long
sFullPathToFile = "C:\tmp\EditMenu.htm"
rc = ShellExecute(0, "Open", sFullPathToFile _
, 0&, 0&, SW_SHOWDEFAULT)
End Sub
When I execute the above, it does not throw an exception, It does not
generate anything in the event log. It appears to run.
rc is returned as 1642688007033061378
x"16CA000A00000002"
According to the documentation, this is a handle and means the
call worked.
The path to the file does exist and IE is defined as the
default application for .html files. The problem is that
nothing happens. I have tried changing the command
to SW_SHOWNORMAL As Long = 1 with the same result.
The command shows it worked, but nothing appears
Can someone give me a pointer as to how to fix this issue?