...sorry -- add a command button and a common dialog to Form1...
Pete
-----Original Message-----
From: Peter N. Kipe [mailto:pkipe@c...]
Sent: Monday, November 25, 2002 11:07 AM
To: professional vb
Subject: [pro_vb] RE: Opening an image in the default image viewer
Paste this into a new project's Form1 code:
Option Explicit
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()
Dim strFileName As String
Dim lngReturn As String
' set up for display
CommonDialog1.CancelError = True
' have user select the file to be opened
CommonDialog1.Action = 1
' if no file selected, do nothing
If CommonDialog1.FileName = "" Then
Exit Sub
End If
' save path and filename, and filename only.
strFileName = CommonDialog1.FileName
lngReturn = ShellExecute( _
Me.hWnd, _
"OPEN", _
strFileName, _
"", _
"", _
vbNormalFocus)
End Sub
Pete
-----Original Message-----
From: Michael Clemmons [mailto:michael@c...]
Sent: Monday, November 25, 2002 10:57 AM
To: professional vb
Subject: [pro_vb] Opening an image in the default image viewer
Can anyone tell me how to open an image (via VB) in the computers default
imaging program?
I would like to give my users the ability to double click on a image and
then have that image open up, in say Photoshop, for further manipulation.
Thanks,
Mike Clemmons