walstadm
asked on
Opening image files in VB6
I'm trying to write a program that will, at a click of a command button, open an image file in Imaging (Windows standard accessory).
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
try getting the program to certify the file exists befo u try to open it. an easy way to do this would be to use the open file dialog box. (this would also eliminate tha possibility of an incorrectly spelt file path)
or have u already tried this?
or have u already tried this?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Yeah, forgot the space...
That should do it.
You can add a Common Dialog Control to your form and let the
user select the image like suma_ds said.
Add the Microsoft Common Dialog Control to the toolbox by right clicking on the tool box and choose components... Then choose it from the list. Add the control to your form along with a textbox and button. The button code is below.
' Get image path
Private Sub Command1_Click()
CommonDialog1.ShowOpen
Text1.Text = CommonDialog1.FileName
End Sub
' Then just pass the Text1.Text value as the parameter.
pathtoprogram = "C:\Program Files\Windows NT\Accessories\ImageVue\wa ngimg.exe "
imagetoopen = Trim(Text1.Text)
Shell pathtoprogram & imagetoopen, vbMaximizedFocus
--------
D_M_D
That should do it.
You can add a Common Dialog Control to your form and let the
user select the image like suma_ds said.
Add the Microsoft Common Dialog Control to the toolbox by right clicking on the tool box and choose components... Then choose it from the list. Add the control to your form along with a textbox and button. The button code is below.
' Get image path
Private Sub Command1_Click()
CommonDialog1.ShowOpen
Text1.Text = CommonDialog1.FileName
End Sub
' Then just pass the Text1.Text value as the parameter.
pathtoprogram = "C:\Program Files\Windows NT\Accessories\ImageVue\wa
imagetoopen = Trim(Text1.Text)
Shell pathtoprogram & imagetoopen, vbMaximizedFocus
--------
D_M_D
ASKER